protected JComboBox createLogLevelCombo() { JComboBox result = new JComboBox(); Iterator levels = getLogLevels(); while (levels.hasNext()) { result.addItem(levels.next()); } result.setSelectedItem(_leastSevereDisplayedLogLevel); result.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox box = (JComboBox) e.getSource(); LogLevel level = (LogLevel) box.getSelectedItem(); setLeastSevereDisplayedLogLevel(level); } }); result.setMaximumSize(result.getPreferredSize()); return result; }
void hideMe(final boolean isOk){ if(isOk){ contentType = (String)jcb_content_type.getSelectedItem(); charset = (String)jcb_charset.getSelectedItem(); // Fire all listeners: for(ContentTypeCharsetChangeListener listener: listeners){ listener.changed(contentType, charset); } } else{ jcb_content_type.setSelectedItem(contentType); jcb_charset.setSelectedItem(charset); } setVisible(false); }
private void initializeComponents (BillboardParticleBatch renderer) { alignCombo = new JComboBox(); alignCombo.setModel(new DefaultComboBoxModel(AlignModeWrapper.values())); alignCombo.setSelectedItem(getAlignModeWrapper(renderer.getAlignMode())); alignCombo.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent event) { sortCombo = new JComboBox(); sortCombo.setModel(new DefaultComboBoxModel(SortMode.values())); sortCombo.setSelectedItem(getSortMode(renderer.getSorter())); sortCombo.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent event) { contentPanel.add(new JLabel("Align"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(alignCombo, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(new JLabel("Use GPU"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(useGPUBox, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(new JLabel("Sort"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(sortCombo, new GridBagConstraints(1, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
JLabel label = new JLabel("Filter Level:"); gridbag.setConstraints(label, c); add(label); label = new JLabel("Filter Thread:"); gridbag.setConstraints(label, c); add(label); label = new JLabel("Filter Logger:"); gridbag.setConstraints(label, c); add(label); Level.TRACE }; final JComboBox priorities = new JComboBox(allPriorities); final Level lowest = allPriorities[allPriorities.length - 1]; priorities.setSelectedItem(lowest); aModel.setPriorityFilter(lowest); gridbag.setConstraints(priorities, c);
@Override protected void initCustomizer() { combo.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { Class c = (Class) combo.getSelectedItem(); try { setNewValue(c.newInstance()); } catch (InstantiationException ex) { Logger.getLogger(MarkerEditor.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(MarkerEditor.class.getName()).log(Level.SEVERE, null, ex); } } }); combo.setSelectedItem(getNewValue().getClass()); panel = new JPanel(new BorderLayout()); panel.add(combo); }
/** * Layout the component */ @Override public void layoutEditor() { m_stepToBlockBox.setEditable(true); StepManager sm = getStepToEdit().getStepManager(); List<StepManagerImpl> flowSteps = getMainPerspective().getCurrentLayout().getFlow().getSteps(); for (StepManagerImpl smi : flowSteps) { m_stepToBlockBox.addItem(smi.getName()); } JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createTitledBorder("Choose step to wait for")); p.add(m_stepToBlockBox, BorderLayout.NORTH); add(p, BorderLayout.CENTER); String userSelected = ((Block) getStepToEdit()).getStepToWaitFor(); if (userSelected != null) { m_stepToBlockBox.setSelectedItem(userSelected); } }
protected JToolBar createToolBar() { JToolBar tb = new JToolBar(); tb.putClientProperty("JToolBar.isRollover", Boolean.TRUE); JComboBox fontCombo = new JComboBox(); JComboBox fontSizeCombo = new JComboBox(); _fontSizeCombo = fontSizeCombo; fontCombo.addItem(fonts[j]); fontCombo.setSelectedItem(_fontName); fontSizeCombo.addItem("8"); fontSizeCombo.addItem("9"); fontSizeCombo.addItem("10"); fontSizeCombo.addItem("12"); fontSizeCombo.addItem("24"); fontSizeCombo.setSelectedItem(String.valueOf(_fontSize)); fontSizeCombo.addActionListener( new ActionListener() { tb.add(new JLabel(" Font: ")); tb.add(fontCombo); tb.add(fontSizeCombo);
@Override public void actionPerformed(ActionEvent e) { List<Employee> employeeList = nurseRosteringPanel.getSolution().getEmployeeList(); // Add 1 to array size to add null, which makes the entity unassigned JComboBox employeeListField = new JComboBox( employeeList.toArray(new Object[employeeList.size() + 1])); LabeledComboBoxRenderer.applyToComboBox(employeeListField); employeeListField.setSelectedItem(shiftAssignment.getEmployee()); int result = JOptionPane.showConfirmDialog(EmployeePanel.this.getRootPane(), employeeListField, "Select employee", JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { Employee toEmployee = (Employee) employeeListField.getSelectedItem(); nurseRosteringPanel.moveShiftAssignmentToEmployee(shiftAssignment, toEmployee); } }
@Override synchronized public void restoreDefaults() throws Exception { FirmwareUtils.restoreDefaults((String)controllerConfigs.getSelectedItem()); updatingCombo = true; String selected = (String) controllerConfigs.getSelectedItem(); this.controllerConfigs.removeAllItems(); for (String item : configFiles.keySet()) { this.controllerConfigs.addItem(item); } controllerConfigs.setSelectedItem(selected); updatingCombo = false; updateComponentsInternal(settings); }
private JComboBox<String> createComboBox(final JPanel panel, final String selected) { final JComboBox<String> typeBox = new ComboBox<>(); final ConfigurableTypes[] types = ConfigurableTypes.values(); for (final ConfigurableTypes type : types) { typeBox.addItem(type.getTyp()); } typeBox.setSelectedItem(selected); typeBox.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { final int idx = getComponentIndex(panel); if (e.getItem().equals(ConfigurableTypes.ARTIFACT.getTyp())) { rootPanel.add(createArtifactRow("", "", "", ""), idx); rootPanel.remove(panel); rows.remove(idx); } else if (e.getItem().equals(ConfigurableTypes.RAWCOMMAND.getTyp())) { rootPanel.add(createCommandRow("", ""), idx); rootPanel.remove(panel); rows.remove(idx); } else if (e.getItem().equals(ConfigurableTypes.EXE.getTyp())) { rootPanel.add(createExeRow("", "", ""), idx); rootPanel.remove(panel); rows.remove(idx); } else { LOG.error("Unknown type : " + e.getItem()); } } }); return typeBox; }
expirationComboBox.setSelectedItem(expiration); expirationComboBox.setMaximumSize(new Dimension(100, 32)); expirationComboBox.addActionListener(new ActionListener() { toolBar.add(pauseLabel); toolBar.add(Box.createHorizontalGlue()); toolBar.add(new JLabel("Clear after:")); toolBar.add(expirationComboBox);
private void addDisplayFormatComponent() { formatLabel = new JLabel(Messages.getString("ToolPanel.disp_format") + StringUtil.COLON); //$NON-NLS-1$ this.add(formatLabel); formatCombo = new JComboBox<>(Format.values()); formatCombo.setFocusable(false); formatCombo.setSelectedItem(view.getCurrentFormat()); formatCombo.addActionListener(e -> view.setFormat((Format) formatCombo.getSelectedItem())); this.add(formatCombo); } }
private void updateAlgorithmMethod() { methodSpinner.removeActionListener(methodListener); methodSpinner.removeAllItems(); final List<String> methods = controller.getMethods(); for (String method : methods) { methodSpinner.addItem(method); } methodSpinner.setSelectedItem(controller.getMethod()); methodSpinner.setEnabled(methods.size() > 1); methodSpinner.addActionListener(methodListener); }
@Override public void actionPerformed(ActionEvent e) { TspSolution tspSolution = tspPanel.getSolution(); JComboBox previousStandstillListField = new JComboBox(); for (Standstill previousStandstill : tspSolution.getVisitList()) { previousStandstillListField.addItem(previousStandstill); } previousStandstillListField.addItem(tspSolution.getDomicile()); previousStandstillListField.setSelectedItem(visit.getPreviousStandstill()); int result = JOptionPane.showConfirmDialog(TspListPanel.this.getRootPane(), previousStandstillListField, "Visit " + visit.getLocation() + " after", JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { Standstill toStandstill = (Standstill) previousStandstillListField.getSelectedItem(); tspPanel.doMove(visit, toStandstill); tspPanel.getWorkflowFrame().resetScreen(); } }
uiDialog.getSourcesCombo().setSelectedItem(DownloadSources.SCRYFALL); selectedSource = ScryfallImageSource.instance; uiDialog.getSourcesCombo().addItemListener((ItemEvent event) -> { uiDialog.getLaunguagesCombo().setSelectedItem(PreferencesDialog.getPrefImagesLanguage()); reloadLanguagesForSelectedSource(); selectedSource.setCurrentLanguage((CardLanguage) uiDialog.getLaunguagesCombo().getSelectedItem());
f.add(variantPanel("regular")); f.add(variantPanel("large")); JPanel customPanel = new JPanel(); customPanel.add(createCustom("One")); customPanel.add(createCustom("Two")); JPanel variantPanel = new JPanel(); variantPanel.add(createVariant("One", size)); variantPanel.add(createVariant("Two", size)); names.add(info.getName()); final JComboBox combo = new JComboBox(names.toArray()); String current = UIManager.getLookAndFeel().getName(); combo.setSelectedItem(current); combo.addActionListener(new ActionListener() {
JComboBox<EditorTheme> themesCbx = new JComboBox<>(editorThemes); for (EditorTheme theme : editorThemes) { if (theme.getPath().equals(settings.getEditorThemePath())) { themesCbx.setSelectedItem(theme); break;
private void initializeComponents (BillboardParticleBatch renderer) { alignCombo = new JComboBox(); alignCombo.setModel(new DefaultComboBoxModel(AlignModeWrapper.values())); alignCombo.setSelectedItem(getAlignModeWrapper(renderer.getAlignMode())); alignCombo.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent event) { sortCombo = new JComboBox(); sortCombo.setModel(new DefaultComboBoxModel(SortMode.values())); sortCombo.setSelectedItem(getSortMode(renderer.getSorter())); sortCombo.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent event) { contentPanel.add(new JLabel("Align"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(alignCombo, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(new JLabel("Use GPU"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(useGPUBox, new GridBagConstraints(1, i++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(new JLabel("Sort"), new GridBagConstraints(0, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); contentPanel.add(sortCombo, new GridBagConstraints(1, i, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
JLabel label = new JLabel("Filter Level:"); gridbag.setConstraints(label, c); add(label); label = new JLabel("Filter Thread:"); gridbag.setConstraints(label, c); add(label); label = new JLabel("Filter Logger:"); gridbag.setConstraints(label, c); add(label); final JComboBox priorities = new JComboBox(allPriorities); final Priority lowest = allPriorities[allPriorities.length - 1]; priorities.setSelectedItem(lowest); aModel.setPriorityFilter(lowest); gridbag.setConstraints(priorities, c);
private JPanel createLinePane() { JPanel lineStylePane = new JPanel(); lineStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); lineStylePane.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), JMeterUtils.getResString("graph_resp_time_settings_line"))); // $NON-NLS-1$ lineStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("graph_resp_time_stroke_width"), //$NON-NLS-1$ strokeWidthList)); strokeWidthList.setSelectedItem(StatGraphProperties.getStrokeWidth()[DEFAULT_STROKE_WIDTH_LIST]); lineStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("graph_resp_time_shape_label"), //$NON-NLS-1$ pointShapeLine)); pointShapeLine.setSelectedIndex(DEFAULT_LINE_SHAPE_POINT); return lineStylePane; }