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; }
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("14"); fontSizeCombo.addItem("16"); fontSizeCombo.addItem("18"); fontSizeCombo.addItem("24"); fontSizeCombo.setSelectedItem(String.valueOf(_fontSize)); fontSizeCombo.addActionListener( new ActionListener() { tb.add(new JLabel(" Font: ")); tb.add(fontCombo); tb.add(fontSizeCombo);
final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS)); mainPanel.setBorder(new Theme.InsetsBorder(10, 10, 10, 10)); final JPanel formatPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 10)); formatPanel.add(new JLabel("Format:")); formatBox = new JComboBox<>(); formatBox.addItem("SVG"); formatBox.addItem("PNG"); formatBox.addItem("PDF"); formatBox.addItem("CSV"); formatBox.setSelectedItem("SVG"); formatPanel.add(formatBox); final JPanel delimiterPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 10)); delimiterPanel.add(new JLabel("Delimiter:")); delimiterBox = new JComboBox<>(); delimiterBox.addItem(new Delimiter(',', ",")); delimiterBox.addItem(new Delimiter(';', ";")); delimiterBox.addItem(new Delimiter(':', ":")); delimiterBox.addItem(new Delimiter('\t', "Tab")); delimiterBox.addItem(new Delimiter(' ', "Space")); delimiterPanel.add(delimiterBox); final JPanel quotesPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 10)); quotesPanel.add(new JLabel("Quotes:")); quotesBox = new JCheckBox("Escape output using quotes", true); quotesPanel.add(quotesBox);
/** * 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); } }
@Override public void addUI(JComponent mainPanel, GridBagConstraints labelConstraints, GridBagConstraints editConstraints) { addToPanel(mainPanel, labelConstraints, 0, 0, new JLabel("Type: ", JLabel.RIGHT)); addToPanel(mainPanel, editConstraints, 1, 0, rosterAction = new JComboBox<>()); rosterAction.addItem(Action.get_roster); rosterAction.addItem(Action.add_item); rosterAction.addItem(Action.delete_item); addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel("JID: ", JLabel.RIGHT)); addToPanel(mainPanel, editConstraints, 1, 1, rosterItem = new JTextField(20)); }
/** * Create a panel containing the implementation details * * @return the panel */ protected final JPanel getImplementationPanel(){ JPanel implPanel = new HorizontalPanel(); implPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("web_server_client"))); // $NON-NLS-1$ implPanel.add(new JLabel(JMeterUtils.getResString("http_implementation"))); // $NON-NLS-1$ httpImplementation.addItem("");// $NON-NLS-1$ implPanel.add(httpImplementation); return implPanel; }
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; }
/** creates the combo box GUI in this option */ protected JPanel createComboBox() { JPanel comboBoxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); String[] labels = optionType.getValueLabels(); String[] values = optionType.getValues(); for (int i = 0; i < labels.length; i++) { comboBox.addItem(labels[i]); //if (currValue.equals(values[i])) // comboBox.setSelectedItem(labels[i]); } comboBox.getAccessibleContext() .setAccessibleDescription(optionType.getOptionDescription()); updateUI(); comboBoxPanel.add(comboBox); //mainPanel.add(comboBoxPanel, BorderLayout.CENTER); return comboBoxPanel; }
@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 JPanel makeSettingsPanel(JButton browseButton, JButton goButton, JButton cxButton) { JPanel settingsPanel = new JPanel(); GridBagHelper helper = new GridBagHelper(settingsPanel, new double[] { 0.2, 0.7, 0.1, 0.1 }); helper.addLabel("Root source directory:"); helper.addLabel("Language:"); for (int i = 0; i < LANGUAGE_SETS.length; i++) { languageBox.addItem(String.valueOf(LANGUAGE_SETS[i][0]));
private void initApplyToComboBox(final Container contentPane) { applyToComboBox = new JComboBox(); final int selectedCellRow = table.getSelectedRow(); if (selectedCellRow >= 0) applyToComboBox.addItem(ApplicationDomain.CURRENT_CELL); final List<GraphObject> selectedGraphObjects = tableModel.getObjects(); if (selectedGraphObjects != null && !selectedGraphObjects.isEmpty()) applyToComboBox.addItem(ApplicationDomain.CURRENT_SELECTION); applyToComboBox.addItem(ApplicationDomain.ENTIRE_ATTRIBUTE); final Dimension widthAndHeight = applyToComboBox.getPreferredSize(); final Dimension desiredWidthAndHeight = new Dimension(180, 30); applyToComboBox.setPreferredSize(desiredWidthAndHeight); applyToComboBox.setMinimumSize(desiredWidthAndHeight); applyToComboBox.setSize(desiredWidthAndHeight); applyToComboBox.setMaximumSize(desiredWidthAndHeight); contentPane.add(applyToComboBox); applyToComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { applicationDomain = (ApplicationDomain)applyToComboBox.getSelectedItem(); } }); applyToComboBox.setEditable(false); applyToComboBox.setEnabled(false); }
protected static void populateComboBoxWithSprites(JComboBox<JLabel> comboBox, Map<String, String> m) { comboBox.removeAllItems(); for (Map.Entry<String, String> entry : m.entrySet()) { JLabel label = new JLabel(); label.setText(entry.getKey()); Optional<Spritesheet> opt = Resources.spritesheets().tryGet(entry.getValue()); if (opt.isPresent() && opt.get().getTotalNumberOfSprites() > 0) { BufferedImage scaled = opt.get().getPreview(24); if (scaled != null) { label.setIcon(new ImageIcon(scaled)); } } comboBox.addItem(label); } }
JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS)); mainPanel.setBorder(new Theme.InsetsBorder(10, 10, 10, 10)); mainPanel.add(Box.createVerticalStrut(10)); JPanel directoryPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); directoryPanel.add(new JLabel("Directory: ")); directoryField = new JTextField(20); directoryField.setEditable(false); JPanel rangePanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 0)); rangePanel.add(new JLabel("From:")); fromField = new JTextField("1", 5); rangePanel.add(fromField); JPanel formatPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); formatPanel.add(new JLabel("Format:")); formatBox = new JComboBox<>(); formatBox.addItem("SVG"); formatBox.addItem("PNG"); formatBox.addItem("PDF"); formatBox.setSelectedItem("SVG"); formatPanel.add(formatBox); mainPanel.add(formatPanel);
private static final JPanel cards = new JPanel(new CardLayout()); private static final JComboBox combo = new JComboBox(); private final String name; this.setPreferredSize(new Dimension(320, 240)); this.setBackground(new Color(random.nextInt())); this.add(new JLabel(name)); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); for (int i = 1; i < 9; i++) { CardPanel p = new CardPanel("Panel " + String.valueOf(i)); combo.addItem(p); cards.add(p, p.toString()); JPanel control = new JPanel(); combo.addActionListener(new ActionListener() { control.add(combo); f.add(cards, BorderLayout.CENTER); f.add(control, BorderLayout.SOUTH); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true);
/** * Sets the step to edit and configures the dialog * * @param step the step to edit */ @Override public void setStepToEdit(Step step) { copyOriginal(step); try { List<String> visiblePerspectives = getGraphicalEnvironmentCommandHandler().performCommand( GetPerspectiveNamesGraphicalCommand.GET_PERSPECTIVE_NAMES_KEY); for (String s : visiblePerspectives) { m_perspectivesCombo.addItem(s); } } catch (WekaException ex) { showErrorDialog(ex); } String current = ((SendToPerspective) getStepToEdit()).getPerspectiveName(); m_perspectivesCombo.setSelectedItem(current); JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory .createTitledBorder("Choose perspective to send to")); p.add(m_perspectivesCombo, BorderLayout.NORTH); createAboutPanel(step); add(p, BorderLayout.CENTER); }
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("14"); fontSizeCombo.addItem("16"); fontSizeCombo.addItem("18"); fontSizeCombo.addItem("24"); fontSizeCombo.setSelectedItem(String.valueOf(_fontSize)); fontSizeCombo.addActionListener( new ActionListener() { tb.add(new JLabel(" Font: ")); tb.add(fontCombo); tb.add(fontSizeCombo); tb.addSeparator(); tb.addSeparator();