Java Code Examples for javax.swing.JButton#setName()

The following examples show how to use javax.swing.JButton#setName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: netbeans   File: Buttons.java    License: Apache License 2.0 6 votes vote down vote up
@NbBundle.Messages({
    "CTL_OK=OK",
    "CTL_Cancel=Cancel",
})
public static JButton[] buttons() {
    final Buttons btns = new Buttons();
    final Object[] all = btns.list();
    for (int i = 0; i < all.length; i += 3) {
        JButton b = new JButton();
        b.setName(all[i].toString());
        b.setText(all[i + 1].toString());
        if (Boolean.TRUE.equals(all[i + 2])) {
            b.setEnabled(false);
        }
        btns.arr.add(b);
    }
    if (btns.arr.isEmpty()) {
        JButton ok = new JButton(Bundle.CTL_OK());
        ok.setName("OK");
        btns.arr.add(ok);
        btns.arr.add(new JButton(Bundle.CTL_Cancel()));
    }
    return btns.arr.toArray(new JButton[0]);
}
 
Example 2
Source Project: ghidra   File: ToolBarItemManager.java    License: Apache License 2.0 5 votes vote down vote up
public JButton createButton(final DockingActionIf action) {
	JButton button = action.createButton();
	button.addActionListener(this);
	button.addMouseListener(this);
	button.setName(action.getName());
	DockingToolBarUtils.setToolTipText(button, action);
	return button;
}
 
Example 3
Source Project: xdm   File: XDMComboBoxUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected JButton createArrowButton() {
	JButton button = new CustomButton();
	button.setBackground(ColorResource.getDarkBgColor());
	button.setIcon(ImageResource.getIcon("down.png", 10, 10));
	button.setBorderPainted(false);
	button.setFocusPainted(false);
	button.setName("ComboBox.arrowButton");
	return button;
}
 
Example 4
public UpdateNotifyPanel() {
	super(new BorderLayout());
	setBorder(new EmptyBorder(getScaledInt(10), getScaledInt(15),
			getScaledInt(10), getScaledInt(15)));
	JPanel p2 = new JPanel(new BorderLayout());
	p2.setOpaque(false);
	lbl = new JLabel();
	lbl.setFont(FontResource.getItemFont());
	p2.add(lbl);
	desc = new JLabel();
	p2.add(desc, BorderLayout.SOUTH);
	add(p2, BorderLayout.CENTER);

	// b.add(Box.createHorizontalGlue());
	JButton btn = new JButton(StringResource.get("LBL_INSTALL_NOW"));
	btn.setFont(FontResource.getBigBoldFont());
	btn.setName("OPT_UPDATE_FFMPEG");
	btn.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent e) {
			if (mode == UpdateChecker.APP_UPDATE_AVAILABLE) {
				XDMUtils.browseURL(
						XDMApp.APP_UPDATE_CHK_URL + XDMApp.APP_VERSION);
			} else {
				FFmpegDownloader fd = new FFmpegDownloader();
				fd.start();
			}
			XDMApp.getInstance().clearNotifications();
		}
	});
	add(btn, BorderLayout.EAST);
}
 
Example 5
/**
 * Returns a panel of buttons, each button representing a day in the month.
 * This is a sub-component of the DatePanel.
 *
 * @return the panel.
 */
private JPanel getCalendarPanel() {

    final JPanel p = new JPanel(new GridLayout(7, 7));
    final DateFormatSymbols dateFormatSymbols = new DateFormatSymbols();
    final String[] weekDays = dateFormatSymbols.getShortWeekdays();

    for (int i = 0; i < this.WEEK_DAYS.length; i++) {
        p.add(new JLabel(weekDays[this.WEEK_DAYS[i]], 
                SwingConstants.CENTER));
    }

    this.buttons = new JButton[42];
    for (int i = 0; i < 42; i++) {
        final JButton b = new JButton("");
        b.setMargin(new Insets(1, 1, 1, 1));
        b.setName(Integer.toString(i));
        b.setFont(this.dateFont);
        b.setFocusPainted(false);
        b.setActionCommand("dateButtonClicked");
        b.addActionListener(this);
        this.buttons[i] = b;
        p.add(b);
    }
    return p;

}
 
Example 6
/**
 * Build the global panel of sets.
 *
 * @return the global panel of sets
 */
private Panel buildSetsPanel ()
{
    Panel panel = new Panel();
    panel.setNoInsets();
    panel.setPreferredSize(new Dimension(BOARD_WIDTH, 160));

    FlowLayout layout = new FlowLayout();
    layout.setAlignment(FlowLayout.LEADING);
    panel.setLayout(layout);
    panel.setBackground(Color.LIGHT_GRAY);

    for (ShapeSet set : ShapeSet.getShapeSets()) {
        Shape rep = set.getRep();

        if (rep != null) {
            JButton button = new JButton();
            button.setIcon(rep.getDecoratedSymbol());
            button.setName(set.getName());
            button.addActionListener(setListener);
            button.setToolTipText(set.getName());
            button.setBorderPainted(false);
            panel.add(button);

            // Create the related shapesPanel
            shapesPanels.put(set, buildShapesPanel(set));
        }
    }

    panel.addKeyListener(keyListener);

    return panel;
}
 
Example 7
public static JButton createBindableJButton(String text, Icon ic, int key, String name)
{
	JButton b = new JButton(text, ic);
			b.setName(name);
	ShortKeyManager.inst().setShortCutTo(key, b);
	return b;
}
 
Example 8
Source Project: seaglass   File: SeaGlassTitlePane.java    License: Apache License 2.0 5 votes vote down vote up
private void assembleSystemMenu() {
    windowMenu = new JPopupMenu();
    addSystemMenuItems(windowMenu);
    enableActions();
    menuButton = new JButton();
    menuButton.setName("InternalFrameTitlePane.menuButtonAccessibleName");
    updateMenuIcon();
    menuButton.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                showSystemMenu();
            }
        });
    setInheritsPopupMenu(true);
}
 
Example 9
/**
 * Create a "browse" button.
 *
 * @return created button.
 */
private JButton createBrowseButton() {
  JButton button = new JButton();
  button.setName( ComponentLookup.BROWSE_BUTTON.name() );
  button.setText( Messages.getString( "DrillDownDialog.BrowseButton.Text" ) );
  return button;
}
 
Example 10
private JButton buttonForFitFunctionFactory(int pixelsFromTop, final FitFunctionTypeEnum fitFunctionType) {

        JButton functionChoiceButton = new ET_JButton(fitFunctionType.getPrettyName());
        functionChoiceButton.setName(fitFunctionType.getName());
        functionChoiceButton.setFont(new Font("SansSerif", Font.PLAIN, 11));
        functionChoiceButton.setMargin(new Insets(0, 0, 0, 0));
        functionChoiceButton.setBounds(5, pixelsFromTop, 110, 20);

        functionChoiceButton.addActionListener((ActionEvent e) -> {
            for (AbstractRawDataView rawDataModelView : rawDataModelViews) {
                DataModelFitFunctionInterface rawRatioDataModel1 = (DataModelFitFunctionInterface) rawDataModelView.getDataModel();
                if (rawRatioDataModel1.containsFitFunction(fitFunctionType)) {
                    rawRatioDataModel1.setSelectedFitFunctionType(fitFunctionType);
                }
                try {
                    rawDataModelView.updatePlotsWithChanges((FitFunctionDataInterface) rawDataModelView);
                } catch (Exception e2) {
                }
            }
            ((TripoliSessionRawDataView) sampleSessionDataView).getTripoliSession().setFitFunctionsUpToDate(false);
            // ((AbstractRawDataView) sampleSessionDataView).refreshPanel(true);

            for (int i = 0; i < rawDataModelViews.length; i++) {
                rawDataModelViews[i].refreshPanel(false, false);
            }
//            // be sure changes to unknowns go to data table
//            if (rawDataModelViews[0] instanceof FitFunctionsOnRatioDataView) {
//                if (((FitFunctionDataInterface) rawDataModelViews[0]).amShowingUnknownFraction()) {
//                    updateReportTable();
//                }
//            }

            updateReportTable();
        });

        fitFunctionButtonGroup.add(functionChoiceButton);
        return functionChoiceButton;
    }
 
Example 11
Source Project: testing-cin   File: Calculator.java    License: MIT License 5 votes vote down vote up
private JButton buildNumberButton(int number) {
    JButton button = new JButton(Integer.toString(number));
    button.setName(""+number);
    button.putClientProperty(NUMBER_PROPERTY, Integer.valueOf(number));
    button.addActionListener(numberListener);
    return button;
}
 
Example 12
Source Project: intellij-xquery   File: DataSourcePanel.java    License: Apache License 2.0 5 votes vote down vote up
public DataSourcePanel() {
    super(new BorderLayout());
    setName(DATA_SOURCE_PANEL);
    dataSourceSelectorComponent = new LabeledComponent<JComboBox>();
    dataSourceSelectorComponent.setLabelLocation("West");
    dataSourceSelectorComponent.setText("&Data source");
    dataSourceSelectorComponent.setComponent(new JComboBox());
    dataSourceSelector = getDataSourceSelector();
    add(dataSourceSelectorComponent, BorderLayout.CENTER);
    configureDataSourcesButton = new JButton("Configure");
    configureDataSourcesButton.setName(CONFIGURE_DATA_SOURCES_BUTTON);
    configureDataSourcesButton.setMnemonic(KeyEvent.VK_O);
    configureDataSourcesButton.addActionListener(getShowDialogActionListener());
    add(configureDataSourcesButton, BorderLayout.EAST);
}
 
Example 13
Source Project: rest-client   File: ReqTabPanel.java    License: Apache License 2.0 4 votes vote down vote up
/**
* 
* @Title: init 
* @Description: Component Initialization 
* @param  name
* @return void 
* @throws
 */
private void init(String name)
{
    this.setLayout(new BorderLayout(RESTConst.BORDER_WIDTH, 0));

    List<String> colNames = new ArrayList<String>();
    colNames.add(name);
    colNames.add(RESTConst.VALUE);

    tabMdl = new TabModel(colNames);
    tab = new JTable(tabMdl);
    tab.setFillsViewportHeight(true);
    tab.setAutoCreateRowSorter(false);
    tab.getTableHeader().setReorderingAllowed(false);
    tab.addMouseListener(ma);
    tab.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    miRmSel = new JMenuItem(RESTConst.RM_SEL);
    miRmSel.setName(RESTConst.RM_SEL);
    miRmSel.addActionListener(this);

    miRmAll = new JMenuItem(RESTConst.RM_ALL);
    miRmAll.setName(RESTConst.RM_ALL);
    miRmAll.addActionListener(this);

    pm = new JPopupMenu();
    pm.add(miRmSel);
    pm.add(miRmAll);
    
    txtFldKey = new JTextField(RESTConst.FIELD_SIZE);
    txtFldVal = new JTextField(RESTConst.FIELD_SIZE);

    lblKey = new JLabel(RESTConst.KEY + ":");
    lblVal = new JLabel(RESTConst.VALUE + ":");

    iconAdd = UIUtil.getIcon(RESTConst.ICON_ADD);
    iconDel = UIUtil.getIcon(RESTConst.ICON_DEL);

    btnAdd = new JButton(iconAdd);
    btnAdd.setName(RESTConst.ADD);
    btnAdd.setToolTipText(RESTConst.ADD + " " + name);
    btnAdd.addActionListener(this);

    btnDel = new JButton(iconDel);
    btnDel.setName(RESTConst.DELETE);
    btnDel.setToolTipText(RESTConst.DELETE + " " + name);
    btnDel.addActionListener(this);

    JPanel pnlNorth = new JPanel();
    pnlNorth.setLayout(new FlowLayout(FlowLayout.CENTER));
    pnlNorth.add(lblKey);
    pnlNorth.add(txtFldKey);
    pnlNorth.add(lblVal);
    pnlNorth.add(txtFldVal);
    pnlNorth.add(btnAdd);
    pnlNorth.add(btnDel);

    this.add(pnlNorth, BorderLayout.NORTH);

    JPanel pnlCenter = new JPanel();
    pnlCenter.setLayout(new GridLayout(1, 1));
    JScrollPane spHdr = new JScrollPane(tab);
    pnlCenter.add(spHdr);

    this.add(pnlCenter, BorderLayout.CENTER);
}
 
Example 14
Source Project: rest-client   File: ReqView.java    License: Apache License 2.0 4 votes vote down vote up
/**
* 
* @Title: init 
* @Description: Component Initialization 
* @param
* @return void 
* @throws
 */
private void init()
{
    this.setLayout(new BorderLayout(RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH));
    this.setBorder(BorderFactory.createEmptyBorder(RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH));

    pnlUrl = new Panel();
    pnlUrl.setLayout(new BorderLayout(RESTConst.BORDER_WIDTH, 0));
    
    iconStart = UIUtil.getIcon(RESTConst.ICON_START);
    iconStop = UIUtil.getIcon(RESTConst.ICON_STOP);

    btnStart = new JButton(iconStart);
    btnStart.setName(RESTConst.START);
    btnStart.setToolTipText(RESTConst.START);
    btnStart.addActionListener(this);

    cbMtd = new JComboBox<HttpMethod>(HttpMethod.values());
    cbMtd.setToolTipText(RESTConst.METHOD);
    cbMtd.addActionListener(this);
    
    cbUrl = new JComboBox<String>();
    cbUrl.setEditable(true);
    cbUrl.setToolTipText(RESTConst.URL);
    cbUrl.requestFocus();
    
    pnlUrl.add(cbMtd, BorderLayout.WEST);
    pnlUrl.add(cbUrl, BorderLayout.CENTER);
    pnlUrl.add(btnStart, BorderLayout.EAST);

    this.add(pnlUrl, BorderLayout.NORTH);

    // pane contains body, header, cookie, parameter
    JTabbedPane tp = new JTabbedPane();

    pnlBody = new ReqBodyPanel();
    tp.add(RESTConst.BODY, pnlBody);

    pnlHdr = new ReqTabPanel(RESTConst.HEADER);
    tp.add(RESTConst.HEADER, pnlHdr);

    pnlCookie = new ReqTabPanel(RESTConst.COOKIE);
    tp.add(RESTConst.COOKIE, pnlCookie);

    this.add(tp, BorderLayout.CENTER);

    pb = new JProgressBar();
    pb.setVisible(false);
    this.add(pb, BorderLayout.SOUTH);
    this.setBorder(BorderFactory.createTitledBorder(null, RESTConst.HTTP_REQUEST, TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION));
}
 
Example 15
private void initUI() {
	setUndecorated(true);

	try {
		if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
				.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
			if (!Config.getInstance().isNoTransparency()) {
				setOpacity(0.85f);
			}
		}
	} catch (Exception e) {
		Logger.log(e);
	}

	setIconImage(ImageResource.getImage("icon.png"));
	setSize(getScaledInt(400), getScaledInt(300));
	setLocationRelativeTo(null);
	setAlwaysOnTop(true);
	getContentPane().setLayout(null);
	getContentPane().setBackground(ColorResource.getDarkestBgColor());

	JPanel titlePanel = new TitlePanel(null, this);
	titlePanel.setOpaque(false);
	titlePanel.setBounds(0, 0, getScaledInt(400), getScaledInt(50));

	JButton closeBtn = new CustomButton();
	closeBtn.setBounds(getScaledInt(365), getScaledInt(5), getScaledInt(30), getScaledInt(30));
	closeBtn.setBackground(ColorResource.getDarkestBgColor());
	closeBtn.setBorderPainted(false);
	closeBtn.setFocusPainted(false);
	closeBtn.setName("CLOSE");

	closeBtn.setIcon(ImageResource.getIcon("title_close.png", 20, 20));
	closeBtn.addActionListener(this);
	titlePanel.add(closeBtn);

	JLabel titleLbl = new JLabel(StringResource.get("BROWSER_MONITORING"));
	titleLbl.setFont(FontResource.getBiggerFont());
	titleLbl.setForeground(ColorResource.getSelectionColor());
	titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(200), getScaledInt(30));
	titlePanel.add(titleLbl);

	JLabel lineLbl = new JLabel();
	lineLbl.setBackground(ColorResource.getSelectionColor());
	lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 1);
	lineLbl.setOpaque(true);
	add(lineLbl);
	add(titlePanel);

	int y = getScaledInt(65);
	int h = getScaledInt(50);
	JTextArea lblMonitoringTitle = new JTextArea();
	lblMonitoringTitle.setOpaque(false);
	lblMonitoringTitle.setWrapStyleWord(true);
	lblMonitoringTitle.setLineWrap(true);
	lblMonitoringTitle.setEditable(false);
	lblMonitoringTitle.setForeground(Color.WHITE);
	lblMonitoringTitle.setText(this.desc);
	lblMonitoringTitle.setFont(FontResource.getNormalFont());
	lblMonitoringTitle.setBounds(getScaledInt(15), y, getScaledInt(370) - getScaledInt(30), h);
	add(lblMonitoringTitle);
	y += h;

	JButton btViewMonitoring = createButton1("CTX_COPY_URL", getScaledInt(15), y);
	btViewMonitoring.setName("COPY");
	add(btViewMonitoring);
	y += btViewMonitoring.getHeight();

}
 
Example 16
/**
 * Creates a new Options object.
 */
public Options ()
{
    // Preload constant units
    UnitManager.getInstance()
            .preLoadUnits(Main.class.getName());

    frame = new JFrame();
    frame.setName("optionsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.getContentPane()
            .setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    frame.add(toolBar, BorderLayout.NORTH);

    // Dump button
    JButton dumpButton = new JButton(dumping);
    dumpButton.setName("optionsDumpButton");
    toolBar.add(dumpButton);

    // Check button
    JButton checkButton = new JButton(checking);
    checkButton.setName("optionsCheckButton");
    toolBar.add(checkButton);

    // Reset button
    JButton resetButton = new JButton(resetting);
    resetButton.setName("optionsResetButton");
    toolBar.add(resetButton);

    // Some space
    toolBar.add(Box.createHorizontalStrut(100));

    toolBar.add(new JLabel("Search:"));

    // Back button
    JButton backButton = new JButton(backSearch);
    backButton.setName("optionsBackButton");
    toolBar.add(backButton);

    // Search entry
    searchField = new JTextField();
    searchField.setMaximumSize(new Dimension(200, 28));
    searchField.setName("optionsSearchField");
    searchField.setHorizontalAlignment(JTextField.LEFT);
    toolBar.add(searchField);

    // Forward button
    JButton forwardButton = new JButton(forwardSearch);
    forwardButton.setName("optionsForwardButton");
    toolBar.add(forwardButton);

    // TreeTable
    UnitModel unitModel = new UnitModel();
    unitTreeTable = new UnitTreeTable(unitModel);
    frame.add(new JScrollPane(unitTreeTable), BorderLayout.CENTER);

    // Needed to process user input when RETURN/ENTER is pressed
    toolBar.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke("ENTER"), "EnterAction");
    toolBar.getActionMap()
            .put("EnterAction", forwardSearch);

    // Resources injection
    ResourceMap resource = Application.getInstance()
            .getContext()
            .getResourceMap(getClass());
    resource.injectComponents(frame);

    // Make sure the search entry field gets the focus at creation time
    frame.addWindowListener(
            new WindowAdapter()
    {
        @Override
        public void windowOpened (WindowEvent e)
        {
            searchField.requestFocus();
        }
    });
}
 
Example 17
/**
 * Creates a new Options object.
 */
public Options ()
{
    // Preload constant units
    UnitManager.getInstance().preLoadUnits();

    frame = new JFrame();
    frame.setName("optionsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    JComponent framePane = (JComponent) frame.getContentPane();
    framePane.setLayout(new BorderLayout());

    InputMap inputMap = framePane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    ActionMap actionMap = framePane.getActionMap();

    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    framePane.add(toolBar, BorderLayout.NORTH);

    // Dump button
    JButton dumpButton = new JButton(dumping);
    dumpButton.setName("optionsDumpButton");
    toolBar.add(dumpButton);

    // Check button
    JButton checkButton = new JButton(checking);
    checkButton.setName("optionsCheckButton");
    toolBar.add(checkButton);

    // Reset button
    JButton resetButton = new JButton(resetting);
    resetButton.setName("optionsResetButton");
    toolBar.add(resetButton);

    // Some space
    toolBar.add(Box.createHorizontalStrut(100));

    toolBar.add(new JLabel("Search:"));

    // Back button
    JButton backButton = new JButton(backSearch);
    backButton.setName("optionsBackButton");
    toolBar.add(backButton);
    inputMap.put(KeyStroke.getKeyStroke("shift F3"), "backSearch");
    actionMap.put("backSearch", backSearch);

    // Search entry
    searchField = new JTextField();
    searchField.setMaximumSize(new Dimension(200, 28));
    searchField.setName("optionsSearchField");
    searchField.setHorizontalAlignment(JTextField.LEFT);
    toolBar.add(searchField);
    inputMap.put(KeyStroke.getKeyStroke("ctrl F"), "find");
    actionMap.put("find", find);
    searchField.getDocument().addDocumentListener(docListener);

    // Forward button
    JButton forwardButton = new JButton(forwardSearch);
    forwardButton.setName("optionsForwardButton");
    toolBar.add(forwardButton);

    // Some space, message field
    toolBar.add(Box.createHorizontalStrut(10));
    toolBar.add(msgLabel);

    // TreeTable
    UnitModel unitModel = new UnitModel();
    unitTreeTable = new UnitTreeTable(unitModel);
    framePane.add(new JScrollPane(unitTreeTable), BorderLayout.CENTER);

    // Needed to process user input when RETURN/ENTER is pressed
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "forwardSearch");
    inputMap.put(KeyStroke.getKeyStroke("F3"), "forwardSearch");
    actionMap.put("forwardSearch", forwardSearch);

    // Resources injection
    ResourceMap resource = Application.getInstance().getContext().getResourceMap(getClass());
    resource.injectComponents(frame);

    // Make sure the search entry field gets the focus at creation time
    frame.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowOpened (WindowEvent e)
        {
            searchField.requestFocus();
        }
    });
}
 
Example 18
private JComponent createUI() {

        editExpressionButton = new JButton("Edit Expression...");
        editExpressionButton.setName("editExpressionButton");
        editExpressionButton.addActionListener(createEditExpressionButtonListener());

        final JPanel gridPanel = GridBagUtils.createPanel();
        int line = 0;
        final GridBagConstraints gbc = new GridBagConstraints();

        gbc.gridy = ++line;
        GridBagUtils.addToPanel(gridPanel, paramBand.getEditor().getLabelComponent(), gbc,
                                "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
        GridBagUtils.addToPanel(gridPanel, paramBand.getEditor().getComponent(), gbc,
                                "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");

        gbc.gridy = ++line;
        GridBagUtils.addToPanel(gridPanel, paramBandType.getEditor().getLabelComponent(), gbc,
                                "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
        GridBagUtils.addToPanel(gridPanel, paramBandType.getEditor().getComponent(), gbc,
                                "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");

        gbc.gridy = ++line;
        GridBagUtils.addToPanel(gridPanel, paramBandUnit.getEditor().getLabelComponent(), gbc,
                                "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
        GridBagUtils.addToPanel(gridPanel, paramBandUnit.getEditor().getComponent(), gbc,
                                "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");

        gbc.gridy = ++line;
        GridBagUtils.addToPanel(gridPanel, paramNoDataValue.getEditor().getLabelComponent(), gbc,
                                "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST");
        GridBagUtils.addToPanel(gridPanel, paramNoDataValue.getEditor().getComponent(), gbc,
                                "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST");

        gbc.gridy = ++line;
        GridBagUtils.addToPanel(gridPanel, paramExpression.getEditor().getLabelComponent(), gbc,
                                "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=NORTHWEST");
        GridBagUtils.addToPanel(gridPanel, paramExpression.getEditor().getComponent(), gbc,
                                "weightx=1, weighty=1, insets.top=3, gridwidth=2, fill=BOTH, anchor=WEST");
        gbc.gridy = ++line;
        GridBagUtils.addToPanel(gridPanel, editExpressionButton, gbc,
                                "weighty=0, insets.top=3, gridwidth=3, fill=NONE, anchor=EAST");

        return gridPanel;
    }
 
Example 19
protected JPanel createPatternInsertionPane() {
    final GridBagLayout gbl = new GridBagLayout();
    JPanel patternPane = new JPanel(gbl);
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.ipadx = 1;
    gbc.ipady = 1;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridy = 0;

    if (booleanExpressionPreferred) {
        final JButton andButton = createInsertButton("@ and @");
        final JButton orButton = createInsertButton("@ or @");
        final JButton notButton = createInsertButton("not @");
        andButton.setName("andButton");
        orButton.setName("orButton");
        notButton.setName("notButton");

        add(patternPane, andButton, gbc);
        gbc.gridy++;
        add(patternPane, orButton, gbc);
        gbc.gridy++;
        add(patternPane, notButton, gbc);
        gbc.gridy++;
    } else {
        final JButton plusButton = createInsertButton("@ + @");
        final JButton minusButton = createInsertButton("@ - @");
        final JButton mulButton = createInsertButton("@ * @");
        final JButton divButton = createInsertButton("@ / @");
        plusButton.setName("plusButton");
        minusButton.setName("minusButton");
        mulButton.setName("mulButton");
        divButton.setName("divButton");

        add(patternPane, plusButton, gbc);
        gbc.gridy++;
        add(patternPane, minusButton, gbc);
        gbc.gridy++;
        add(patternPane, mulButton, gbc);
        gbc.gridy++;
        add(patternPane, divButton, gbc);
        gbc.gridy++;
    }

    final String[] functionNames = getFunctionTemplates();

    final JButton parenButton = createInsertButton("(@)");
    parenButton.setName("parenButton");
    final JComboBox<String> functBox = createInsertComboBox("Functions...", functionNames);
    final JComboBox<String> operBox = createInsertComboBox("Operators...", OPERATOR_PATTERNS);
    final JComboBox<String> constBox = createInsertComboBox("Constants...", CONSTANT_LITERALS);
    functBox.setName("functBox");
    operBox.setName("operBox");
    constBox.setName("constBox");

    add(patternPane, parenButton, gbc);
    gbc.gridy++;
    add(patternPane, constBox, gbc);
    gbc.gridy++;
    add(patternPane, operBox, gbc);
    gbc.gridy++;
    add(patternPane, functBox, gbc);
    gbc.gridy++;

    return patternPane;
}
 
Example 20
public static void bindJButton(JButton b, int key, String name)
{
	b.setName(name);
	ShortKeyManager.inst().setShortCutTo(key, b);
}