private void createUIComponents() { styleComboBox = new ComboBox<>(UiFormatterStyle.values()); }
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; }
private void setupUI() { rootPane = new JPanel(); rootPane.setLayout(new GridLayoutManager(4, 3, JBUI.emptyInsets(), -1, -1)); /*showDetailsCheck = new JCheckBox(); showDetailsCheck.setText("Show servers instances"); rootPane.add(showDetailsCheck, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); showDetailsCheck.addItemListener(e -> { final var checkBox = (JCheckBox) e.getItem(); if (checkBox.isSelected()) { serverBox.setModel(serverWrapModel); } else { serverBox.setModel(serverDefModel); } });*/ serverBox = new ComboBox<>(this.serverDefModel); rootPane.add(serverBox, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); rootPane.add(spacer1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); rootPane.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final Spacer spacer3 = new Spacer(); rootPane.add(spacer3, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final Spacer spacer4 = new Spacer(); rootPane.add(spacer4, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final Spacer spacer5 = new Spacer(); rootPane.add(spacer5, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); }
private void addReplaceOSVarsComponent() { ComboBoxModel<Boolean> replaceOsVarsComboBoxModel = new CollectionComboBoxModel<>(REPLACE_OS_VARS_LIST); ComboBox<Boolean> replaceOsVarsComboBox = new ComboBox<>(replaceOsVarsComboBoxModel); replaceOsVarsComboBox.setRenderer( new ListCellRendererWrapper<Boolean>() { @Override public void customize(@NotNull JList list, @Nullable Boolean value, int index, boolean selected, boolean hasFocus) { if (value == null) { setText("Use Default"); } else { setText(value.toString()); } } } ); replaceOSVarsComponent = LabeledComponent.create(replaceOsVarsComboBox, "Replace OS Vars"); replaceOSVarsComponent.setLabelLocation(BorderLayout.WEST); add(replaceOSVarsComponent, 6); }
private void addCodeLoadingModeComponent() { ComboBoxModel<CodeLoadingMode> codeLoadingModeComboBoxModel = new CollectionComboBoxModel<>(CODE_LOADING_MODE_LIST); ComboBox<CodeLoadingMode> codeLoadingModeComboBox = new ComboBox<>(codeLoadingModeComboBoxModel); codeLoadingModeComboBox.setRenderer( new ListCellRendererWrapper<CodeLoadingMode>() { @Override public void customize(@NotNull JList list, @Nullable CodeLoadingMode value, int index, boolean selected, boolean hasFocus) { if (value == null) { setText("Use Default"); } else { setText(value.toString()); } } } ); codeLoadingModeComponent = LabeledComponent.create(codeLoadingModeComboBox, "Code Loading Mode"); codeLoadingModeComponent.setLabelLocation(BorderLayout.WEST); add(codeLoadingModeComponent, 4); }
private ComboBox buildCheckstyleVersionComboBox() { SortedSet<String> versions = checkstyleProjectService.getSupportedVersions(); SortedSet<String> reversedVersions = new TreeSet<>(Collections.reverseOrder(versions.comparator())); reversedVersions.addAll(versions); String[] supportedVersions = reversedVersions.toArray(new String[reversedVersions.size()]); return new ComboBox(supportedVersions); }
@Nullable @Override public TableCellEditor getEditor(ServiceParameter modelParameter) { Set<String> sorted = modelParameter.getPossibleServices(); ComboBox comboBox = new ComboBox(sorted.toArray(new String[sorted.size()] ), 200); comboBox.setEditable(true); return new DefaultCellEditor(comboBox); } }
@Nullable @Override public TableCellEditor getEditor(MethodParameter.MethodModelParameter modelParameter) { Set<String> sorted = modelParameter.getPossibleServices(); ComboBox comboBox = new ComboBox(sorted.toArray(new String[sorted.size()] ), 200); comboBox.setEditable(true); return new DefaultCellEditor(comboBox); } }
private void createUIComponents() { authComboBox = new ComboBox(); }
private JComboBox createComboBox(JobParameter jobParameter, String defaultValue) { ComboBox comboBox = new ComboBox(jobParameter.getValues().toArray()); if (StringUtils.isNotEmpty(defaultValue)) { comboBox.setSelectedItem(defaultValue); } return comboBox; }
private void createUIComponents() { /* Project fakeProject = ProjectManager.getInstance().getDefaultProject(); VirtualFile sdkBinDir = LocalFileSystem.getInstance().refreshAndFindFileByPath("D:\\connectiq\\connectiq-sdk-win-2.1.3\\bin"); ProjectInfo sdkProjectInfo = MonkeyModuleBuilder.getSdkProjectInfo(fakeProject, sdkBinDir); List<NewProjectFileMap> candidates = sdkProjectInfo.getNewProjectFilesMaps().getNewProjectFileMaps().stream() .filter(fileMap -> fileMap != null && moduleBuilder.getAppType().equals(fileMap.getAppType().getStringValue())) .collect(Collectors.toList()); List<String> names = candidates.stream().map(c -> c.getName().getStringValue()).collect(Collectors.toList());*/ List<String> names = new ArrayList<>(); names.add("simple"); templateCombobox = new ComboBox<String>(); for (String name : names) { templateCombobox.addItem(name); } /* templateCombobox.addActionListener(e -> { selectModule(templateCombobox.getSelectedIndex()); });*/ }
public DubInitForModuleStep(final WizardContext wizardContext) { this.myWizardContext = wizardContext; this.myPanel = new JPanel(new GridBagLayout()); this.myPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // Title label final JLabel titletextLabel = new JLabel(DlangBundle.INSTANCE.message("d.ui.dub.config.label.choosedubinitoptions")); this.myPanel.add(titletextLabel, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(8, 10, 8, 10), 0, 0)); // add combo to choose --format sdl/json for init this.dubFormat = new ComboBox<>(new String[] {"sdl", "json"}); this.dubFormat.setSelectedItem("json"); final JLabel dubFormatLabel = new JLabel(DlangBundle.INSTANCE.message("d.ui.dub.config.label.dubformat")); dubFormatLabel.setLabelFor(dubFormat); this.myPanel.add(dubFormatLabel, new GridBagConstraints(0, -1, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 5, 4), 0, 0)); this.myPanel.add(dubFormat, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(10, 0, 20, 0), 0, 0)); // add combo to choose --type minimal, vibe.d, deimos this.dubType = new ComboBox<>(new String[] {"minimal", "vibe.d", "deimos"}); dubType.setSelectedItem("minimal"); final JLabel dubTypeLabel = new JLabel(DlangBundle.INSTANCE.message("d.ui.dub.config.label.dubprojecttype")); dubTypeLabel.setLabelFor(dubType); this.myPanel.add(dubTypeLabel, new GridBagConstraints(0, -1, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 5, 4), 0, 0)); this.myPanel.add(dubType, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(10, 0, 20, 0), 0, 0)); // add text field to add params instead of using combo boxes as fallback this.dubParams = new JTextField(); final JLabel dubParamsLabel = new JLabel(DlangBundle.INSTANCE.message("d.ui.dub.config.label.dubparamsoverride")); dubParamsLabel.setLabelFor(dubParams); this.myPanel.add(dubParamsLabel, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(10, 0, 20, 0), 0, 0)); this.myPanel.add(dubParams, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(10, 0, 20, 0), 0, 0)); }
private void setupUI() { rootPanel = new JPanel(new BorderLayout()); clientDropdownList = new ComboBox<>(); clientDropdownList.setEditable(true); clientDropdownList.setToolTipText(P4Bundle.getString("configuration.clientname.dropdown-list.tooltip")); JLabel label = SwingUtil.createLabelFor(P4Bundle.getString("configuration.clientname"), clientDropdownList); JPanel buttonPanel = new JPanel(new FlowLayout()); errorLabel = new JLabel(ERROR); errorLabel.setVisible(false); listRefreshButton = new JButton(REFRESH); listRefreshButton.setPreferredSize(new Dimension(REFRESH.getIconWidth() + 2, REFRESH.getIconHeight() + 2)); listRefreshSpinner = new AsyncProcessIcon("Refresh Client List Progress"); listRefreshSpinner.setName("Refresh Client List Progress"); listRefreshSpinner.setVisible(false); buttonPanel.add(errorLabel); buttonPanel.add(listRefreshSpinner); buttonPanel.add(listRefreshButton); rootPanel.add(label, BorderLayout.WEST); rootPanel.add(clientDropdownList, BorderLayout.CENTER); rootPanel.add(buttonPanel, BorderLayout.EAST); } }
private void addTargetSdkVersion(DevicesReader devicesReader) { List<TargetSdkVersion> targetSdkVersions = devicesReader.getTargetSdkVersions(); targetSdkVersionComboBox = new ComboBox<>(); for (TargetSdkVersion targetSdkVersion : targetSdkVersions) { targetSdkVersionComboBox.addItem(targetSdkVersion); } targetSdkVersionComboBox.addActionListener(e -> { final Object selectedItem = targetSdkVersionComboBox.getSelectedItem(); final TargetSdkVersion targetSdkVersion = selectedItem instanceof TargetSdkVersion ? (TargetSdkVersion) selectedItem : null; getTargetDeviceModuleExtension().setTargetSdkVersion(targetSdkVersion); }); JLabel label = new JLabel("Target SDK version"); label.setLabelFor(targetSdkVersionComboBox); panel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(12, 6, 12, 0), 0, 0)); panel.add(targetSdkVersionComboBox, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0)); }
private void addTargetDevice(DevicesReader devicesReader) { List<TargetDevice> targetDevices = devicesReader.parseDevicesXml(); targetDeviceComboBox = new ComboBox<>(); for (TargetDevice device : targetDevices) { targetDeviceComboBox.addItem(device); } targetDeviceComboBox.addActionListener(e -> { final Object selectedItem = targetDeviceComboBox.getSelectedItem(); final TargetDevice targetDevice = selectedItem instanceof TargetDevice ? (TargetDevice) selectedItem : null; getTargetDeviceModuleExtension().setTargetDevice(targetDevice); }); JLabel label = new JLabel("Target Device"); label.setLabelFor(targetDeviceComboBox); panel.add(label, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(12, 6, 12, 0), 0, 0)); panel.add(targetDeviceComboBox, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0)); }
serverComboBox = new ComboBox(); JLabel serverListLabel = new JLabel("Bind to server:");
final JLabel infoLabel = new JLabel(); final ComboBox<MathematicaLanguageLevel> versionComboBox = new ComboBox<>();
component = new ComboBox(comboBoxModel); } else { throw new IllegalArgumentException("unknown config type " + configType);
/** * 初始化方法 * * @param defaultGroupName 默认选中分组 */ private void init(String defaultGroupName) { // 创建一个内容面板 JPanel contentPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); ComboBoxModel<String> comboBoxModel = new CollectionComboBoxModel<>(groupNameList); this.comboBox = new ComboBox<>(comboBoxModel); // 添加下拉框 contentPanel.add(new Label("Group Name:")); contentPanel.add(this.comboBox); // 添加事件按钮 DefaultActionGroup actionGroup = createActionGroup(); // 添加分组选中事件 this.comboBox.addItemListener(e -> changeGroup((String) comboBox.getSelectedItem())); // 选择默认分组 this.comboBox.setSelectedItem(defaultGroupName); ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("Group Toolbar", actionGroup, true); contentPanel.add(actionToolbar.getComponent()); contentPanel.setPreferredSize(JBUI.size(600, 40)); // 将内容面板添加至主面板左边(西边) this.add(contentPanel, BorderLayout.WEST); }
PerlConfigurationProducer::isExecutableFile), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT); myConsoleCharset = new ComboBox(new CollectionComboBoxModel(new ArrayList<>(Charset.availableCharsets().keySet())));