protected void addMyControls() { // add browser-style control buttons JButton home = new JButton(new ImageIcon("data/Home24.gif")); JButton back = new JButton(new ImageIcon("data/Back24.gif")); JButton fwd = new JButton(new ImageIcon("data/Forward24.gif")); home.setToolTipText("Home"); home.addActionListener(this); home.setActionCommand(homeCmd); back.setToolTipText("Back"); back.addActionListener(this); back.setActionCommand(backCmd); back.setEnabled(false); // initially disabled fwd.setToolTipText("Forward"); fwd.addActionListener(this); fwd.setActionCommand(forwardCmd); fwd.setEnabled(false); // initially disabled add(home); add(back); add(fwd); add(new JToolBar.Separator()); // set built-in index variables homeIndex = getComponentIndex(home); backIndex = getComponentIndex(back); forwardIndex = getComponentIndex(fwd); JComboBox comboBox = new JComboBox(); comboBox.setEditable(true); comboBox.addActionListener(this); comboBox.setActionCommand(comboCmd); comboBox.setMaximumRowCount(3); // don't let it get too long comboBox.insertItemAt(mainBrowserURL, 0); // don't start it out empty add(comboBox); comboBoxIndex = getComponentIndex(comboBox); }
private void createComponents() { categoryLabel = new JLabel(Language.text("contrib.category")); categoryChooser = new JComboBox<String>(); categoryChooser.setMaximumRowCount(20); categoryChooser.setFont(Toolkit.getSansFont(14, Font.PLAIN)); updateCategoryChooser(); categoryChooser.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { category = (String) categoryChooser.getSelectedItem(); if (ContributionManagerDialog.ANY_CATEGORY.equals(category)) { category = null; } filterLibraries(category, filterField.filters); contributionListPanel.updateColors(); } }); filterField = new FilterField(); }