/** * Method performed when button clicked. * * @param event event that triggers action, here clicking of the button. */ public void actionPerformed(ActionEvent event) { if (choiceBox.getSelectedItem().equals(CUSTOM)) { JFileChooser chooser = new JFileChooser(System.getProperty("user.home")); int returnVal = chooser.showOpenDialog(settingsPanel); if (returnVal == JFileChooser.APPROVE_OPTION) { specifiedOntology = CUSTOM; openFile = chooser.getSelectedFile(); choiceBox.setEditable(true); choiceBox.setSelectedItem(openFile.toString()); choiceBox.setEditable(false); def = false; if (((String) choiceBox.getSelectedItem()).endsWith(".obo")) { settingsPanel.getNamespacePanel().choiceBox.setEnabled(true); } else { settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } } if (returnVal == JFileChooser.CANCEL_OPTION) { choiceBox.setSelectedItem(NONE); specifiedOntology = NONE; def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } } else if (choiceBox.getSelectedItem().equals(NONE)) { specifiedOntology = NONE; def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } else { specifiedOntology = (String) choiceBox.getSelectedItem(); def = true; settingsPanel.getNamespacePanel().choiceBox.setEnabled(false); } }
/** * return the String id of the chosen server name * * @return the server name */ public String getServer() { Object selected = serverSelector.getSelectedItem(); if (selected == null) { return null; } AddeServer server; if (selected instanceof AddeServer) { server = (AddeServer) selected; return server.getName(); } String serverName = selected.toString(); server = getIdv().getIdvChooserManager().addAddeServer(serverName); addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType()); Object selectedGroup = groupSelector.getSelectedItem(); AddeServer.Group group = null; if (selectedGroup != null) { group = getIdv() .getIdvChooserManager() .addAddeServerGroup(server, selectedGroup.toString(), getGroupType()); } boolean old = ignoreStateChangedEvents; ignoreStateChangedEvents = true; GuiUtils.setListData(serverSelector, addeServers); serverSelector.setSelectedItem(server); setGroups(); if (group != null) { groupSelector.setSelectedItem(group); } ignoreStateChangedEvents = old; return server.getName(); }
public void display(ResultSet rs) { try { boolean recordNumber = rs.next(); if (recordNumber) { payNo = rs.getString(1); pasNo = rs.getString(2); pasName = rs.getString(3); mode = rs.getString(4); dt = rs.getString(5); amount = rs.getString(6); rev = rs.getString(7); text1.setText(payNo); combo1.setSelectedItem(pasNo); combo2.setSelectedItem(pasName); combo4.setSelectedItem(mode); p_date.setText(dt); combo8.setSelectedItem(amount); combo3.setSelectedItem(rev); } else { JOptionPane.showMessageDialog( null, "Record Not found", "ERROR", JOptionPane.DEFAULT_OPTION); } } catch (SQLException sqlex) { sqlex.printStackTrace(); } }
public void VaciarCampos() { jtxtCodigo.setText(""); jcbOrigen.setSelectedItem("MedellÃn"); jcbDestino.setSelectedItem("Bogotá"); jtxtPrecio.setText(""); jcbEstado.setSelectedItem("Activo"); }
protected void load() { nameField.setText(data.name); costField.setValue(data.cost); colorBox.setSelectedItem(data.color); charField.setValue(data.text); weightField.setValue(data.weight); spellBox.setSelectedItem(data.spell); }
/** {@inheritDoc} */ @Override protected void updateValue() { Object value = getValue(currentKey); if (value != null && !value.equals(EMPTY)) { multiConfValuesBox.setSelectedItem(value); } else { multiConfValuesBox.setSelectedItem(EMPTY); // clear } }
/** * Set calendar to this week's Monday; set year and week combo boxes to the currently set date; * set the date labels appropriately; and, refresh the review table. */ private void updateYearWeekDates() { yearWeekCalendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); yearWeekCalendar.set(Calendar.HOUR_OF_DAY, 0); yearWeekCalendar.set(Calendar.MINUTE, 0); yearWeekCalendar.set(Calendar.SECOND, 0); yearWeekCalendar.set(Calendar.MILLISECOND, 0); yearCB.setSelectedItem(yearWeekCalendar.get(Calendar.YEAR)); weekCB.setSelectedItem(yearWeekCalendar.get(Calendar.WEEK_OF_YEAR)); fromDate.setDate(yearWeekCalendar); yearWeekCalendar.add(Calendar.DAY_OF_MONTH, 7); toDate.setDate(yearWeekCalendar); yearWeekCalendar.add(Calendar.DAY_OF_MONTH, -7); refreshReviewTable(); }
@Override public void keyPressed(KeyEvent evt) { if (evt.isConsumed()) return; Component comp = getFocusOwner(); if (evt.getKeyCode() == KeyEvent.VK_ENTER && enterEnabled) { while (comp != null) { if (comp instanceof JComboBox) { JComboBox<?> combo = (JComboBox<?>) comp; if (combo.isEditable()) { Object selected = combo.getEditor().getItem(); if (selected != null) combo.setSelectedItem(selected); } if (combo.isPopupVisible()) { evt.consume(); combo.setPopupVisible(false); } return; } // TODO: add other classes that need custom key handling here. comp = comp.getParent(); } evt.consume(); ok(); } else if (evt.getKeyCode() == KeyEvent.VK_ESCAPE || isCloseBufferShortcut(evt)) { evt.consume(); if (comp instanceof JComboBox) { JComboBox<?> combo = (JComboBox<?>) comp; if (combo.isPopupVisible()) combo.setPopupVisible(false); else cancel(); } else cancel(); } }
@Override protected JComponent createNorthPanel() { JBLabel descriptionLabel = new JBLabel("<html>" + makeDescription() + "</html>"); final JComboBox repositorySelector = new JComboBox(ArrayUtil.toObjectArray(myRepositories, GitRepository.class)); repositorySelector.setRenderer(new GitRepositoryComboboxListCellRenderer(repositorySelector)); repositorySelector.setSelectedItem(myInitialRepository); repositorySelector.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { List<GitCommit> commits = myCommits.get((GitRepository) repositorySelector.getSelectedItem()); myCommitListWithDiffPanel.setCommits(new ArrayList<GitCommit>(commits)); } }); JPanel repoSelectorPanel = new JPanel(new BorderLayout()); JBLabel label = new JBLabel("Repository: "); label.setLabelFor(repoSelectorPanel); repoSelectorPanel.add(label, BorderLayout.WEST); repoSelectorPanel.add(repositorySelector); if (myRepositories.size() < 2) { repoSelectorPanel.setVisible(false); } JPanel northPanel = new JPanel(new BorderLayout()); northPanel.add(descriptionLabel); northPanel.add(repoSelectorPanel, BorderLayout.SOUTH); return northPanel; }
public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int rowIndex, int vColIndex) { box.setSelectedItem(value); return box; }
public void updateFrom(CvsApplicationLevelConfiguration config) { myPServerSettingsPanel.updateFrom(config); myCharset.setSelectedItem(config.ENCODING); myUseGZIPCompression.setSelected(config.USE_GZIP); myLogOutput.setSelected(config.DO_OUTPUT); mySendEnvironment.setSelected(config.SEND_ENVIRONMENT_VARIABLES_TO_SERVER); }
/** * _more_ * * @param values _more_ * @return _more_ */ public JComboBox getFileCountWidget(int[] values) { if (fileCountWidget == null) { TwoFacedObject selected = null; Vector items = new Vector(); for (int i = 0; i < values.length; i++) { String label; if (values[i] == Integer.MAX_VALUE) { label = "All Files"; } else if (values[i] == 0) { label = "Use Selected File"; } else if (values[i] == 1) { label = "Use Most Recent File"; } else { label = "Use Most Recent " + values[i] + " Files"; } TwoFacedObject tfo = new TwoFacedObject(label, new Integer(values[i])); if (values[i] == fileCount) { selected = tfo; } items.add(tfo); } fileCountWidget = new JComboBox(items); if (selected == null) { selected = new TwoFacedObject("Use Most Recent " + fileCount + " Files", new Integer(fileCount)); } fileCountWidget.setSelectedItem(selected); } return fileCountWidget; }
/** * Get the image group from the gui. * * @return The iamge group. */ protected String getGroup() { Object selected = groupSelector.getSelectedItem(); if (selected == null) { return null; } if (selected instanceof AddeServer.Group) { AddeServer.Group group = (AddeServer.Group) selected; return group.getName(); } String groupName = selected.toString().trim(); if ((groupName.length() > 0)) { // Force the get in case they typed a server name getServer(); AddeServer server = getAddeServer(); if (server != null) { AddeServer.Group group = getIdv().getIdvChooserManager().addAddeServerGroup(server, groupName, getGroupType()); if (!group.getActive()) { getIdv().getIdvChooserManager().activateAddeServerGroup(server, group); } // Now put the list of groups back in to the selector setGroups(); groupSelector.setSelectedItem(group); } } return groupName; }
public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { ((JComboBox) editorComponent).removeAllItems(); if (options.containTrait(table.getValueAt(row, 0).toString())) { if (column == 5) { for (Object ob : options.getPartitionTraitsSubstitutionModels()) { ((JComboBox) editorComponent).addItem(ob); } } else if (column == 6) { for (Object ob : options.getPartitionTraitsClockModels()) { ((JComboBox) editorComponent).addItem(ob); } } } else { if (column == 5) { for (Object ob : options.getPartitionNonTraitsSubstitutionModels()) { ((JComboBox) editorComponent).addItem(ob); } } else if (column == 6) { for (Object ob : options.getPartitionNonTraitsClockModels()) { ((JComboBox) editorComponent).addItem(ob); } } } // if (((JComboBox) editorComponent).contains(value)) // todo need validate whether // value in the editorComponent ((JComboBox) editorComponent).setSelectedItem(value); delegate.setValue(value); return editorComponent; }
@Override public JComponent createOptionsPanel() { final JFormattedTextField valueField = prepareNumberEditor("m_limit"); final JComboBox comboBox = new ComboBox( new Object[] {Scope.NONE, Scope.PRIVATE, Scope.PACKAGE_LOCAL, Scope.PROTECTED}); comboBox.setRenderer( new ListCellRendererWrapper() { @Override public void customize( JList list, Object value, int index, boolean selected, boolean hasFocus) { if (value instanceof Scope) setText(((Scope) value).getText()); } }); comboBox.setSelectedItem(ignoreScope); comboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ignoreScope = (Scope) comboBox.getSelectedItem(); } }); comboBox.setPrototypeDisplayValue(Scope.PROTECTED); final FormBuilder formBuilder = FormBuilder.createFormBuilder(); formBuilder.addLabeledComponent(getConfigurationLabel(), valueField); formBuilder.addLabeledComponent( InspectionGadgetsBundle.message("constructor.visibility.option"), comboBox); final JPanel panel = new JPanel(new BorderLayout()); panel.add(formBuilder.getPanel(), BorderLayout.NORTH); return panel; }
private void setupAttributes() { Color frameColor = (Color) AttributeFigure.getDefaultAttribute("FrameColor"); Color fillColor = (Color) AttributeFigure.getDefaultAttribute("FillColor"); Color textColor = (Color) AttributeFigure.getDefaultAttribute("TextColor"); Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute("ArrowMode"); String fontName = (String) AttributeFigure.getDefaultAttribute("FontName"); FigureEnumeration k = view().selectionElements(); while (k.hasMoreElements()) { Figure f = k.nextFigure(); frameColor = (Color) f.getAttribute("FrameColor"); fillColor = (Color) f.getAttribute("FillColor"); textColor = (Color) f.getAttribute("TextColor"); arrowMode = (Integer) f.getAttribute("ArrowMode"); fontName = (String) f.getAttribute("FontName"); } fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor)); fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor)); // fTextColor.select(ColorMap.colorIndex(textColor)); if (arrowMode != null) { fArrowChoice.setSelectedIndex(arrowMode.intValue()); } if (fontName != null) { fFontChoice.setSelectedItem(fontName); } }
private void setupAttributes() { Color frameColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FRAME_COLOR); Color fillColor = (Color) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FILL_COLOR); Integer arrowMode = (Integer) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.ARROW_MODE); String fontName = (String) AttributeFigure.getDefaultAttribute(FigureAttributeConstant.FONT_NAME); FigureEnumeration fe = view().selection(); while (fe.hasNextFigure()) { Figure f = fe.nextFigure(); frameColor = (Color) f.getAttribute(FigureAttributeConstant.FRAME_COLOR); fillColor = (Color) f.getAttribute(FigureAttributeConstant.FILL_COLOR); arrowMode = (Integer) f.getAttribute(FigureAttributeConstant.ARROW_MODE); fontName = (String) f.getAttribute(FigureAttributeConstant.FONT_NAME); } fFrameColor.setSelectedIndex(ColorMap.colorIndex(frameColor)); fFillColor.setSelectedIndex(ColorMap.colorIndex(fillColor)); if (arrowMode != null) { fArrowChoice.setSelectedIndex(arrowMode.intValue()); } if (fontName != null) { fFontChoice.setSelectedItem(fontName); } }
private void setUpBrowserCombobox() { for (BrowsersConfiguration.BrowserFamily family : BrowsersConfiguration.getInstance().getActiveBrowsers()) { browserComboBox.addItem(family); } browserComboBox.setRenderer( new ListCellRendererWrapper<BrowsersConfiguration.BrowserFamily>(browserComboBox) { @Override public void customize( JList list, BrowsersConfiguration.BrowserFamily family, int index, boolean selected, boolean hasFocus) { if (family != null) { setText(family.getName()); setIcon(family.getIcon()); } } }); if (browserComboBox.getItemCount() < 2) { browserComboBox.setVisible(false); browserComboBox.setVisible(false); } else { browserComboBox.setSelectedItem(0); } }
public DataSourceQueryChooserDialog( Collection dataSourceQueryChoosers, Frame frame, String title, boolean modal) { super(frame, title, modal); init(dataSourceQueryChoosers); try { jbInit(); pack(); } catch (Exception ex) { ex.printStackTrace(); } addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { okCancelPanel.setOKPressed(false); } }); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { // User may have hit OK, got a validation-error dialog, then hit the // X button. [Jon Aquino] okCancelPanel.setOKPressed(false); } }); // Set the selected item to trigger the event that sets the panel. [Jon Aquino] formatComboBox.setSelectedItem(formatComboBox.getItemAt(0)); }
private AppEngineSupportConfigurable(FrameworkSupportModel model) { super(AppEngineSupportProvider.this, model); mySdkEditor = new AppEngineSdkEditor(model.getProject()); mySdkPanel.add( LabeledComponent.create(mySdkEditor.getMainComponent(), "Google App Engine SDK:"), BorderLayout.CENTER); PersistenceApiComboboxUtil.setComboboxModel(myPersistenceApiComboBox, true); if (model.isFrameworkSelected(JPA_PROVIDER_ID)) { myPersistenceApiComboBox.setSelectedItem(PersistenceApi.JPA.getDisplayName()); } model.addFrameworkListener(this); myErrorLabel = new HyperlinkLabel(); myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning); myErrorLabel.setVisible(false); myErrorLabel.setHyperlinkTarget(AppEngineSdkUtil.APP_ENGINE_DOWNLOAD_URL); myErrorPanel.add(BorderLayout.CENTER, myErrorLabel); final Component component = mySdkEditor.getComboBox().getEditor().getEditorComponent(); if (component instanceof JTextComponent) { ((JTextComponent) component) .getDocument() .addDocumentListener( new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { checkSdk(); } }); } checkSdk(); }
public void setIndexer(LibrariesIndexer indexer) { this.indexer = indexer; DropdownItem<DownloadableContribution> previouslySelectedCategory = (DropdownItem<DownloadableContribution>) categoryChooser.getSelectedItem(); DropdownItem<DownloadableContribution> previouslySelectedType = (DropdownItem<DownloadableContribution>) typeChooser.getSelectedItem(); categoryChooser.removeActionListener(categoryChooserActionListener); typeChooser.removeActionListener(typeChooserActionListener); // TODO: Remove setIndexer and make getContribModel // return a FilteredAbstractTableModel getContribModel().setIndexer(indexer); categoryFilter = null; categoryChooser.removeAllItems(); // Load categories categoryChooser.addItem(new DropdownAllItem()); Collection<String> categories = indexer.getIndex().getCategories(); for (String category : categories) { categoryChooser.addItem(new DropdownLibraryOfCategoryItem(category)); } categoryChooser.setEnabled(categoryChooser.getItemCount() > 1); categoryChooser.addActionListener(categoryChooserActionListener); if (previouslySelectedCategory != null) { categoryChooser.setSelectedItem(previouslySelectedCategory); } else { categoryChooser.setSelectedIndex(0); } typeFilter = null; typeChooser.removeAllItems(); typeChooser.addItem(new DropdownAllItem()); typeChooser.addItem(new DropdownInstalledLibraryItem(indexer.getIndex())); java.util.List<String> types = new LinkedList<String>(indexer.getIndex().getTypes()); Collections.sort(types, new LibraryTypeComparator()); for (String type : types) { typeChooser.addItem(new DropdownLibraryOfTypeItem(type)); } typeChooser.setEnabled(typeChooser.getItemCount() > 1); typeChooser.addActionListener(typeChooserActionListener); if (previouslySelectedType != null) { typeChooser.setSelectedItem(previouslySelectedType); } else { typeChooser.setSelectedIndex(0); } filterField.setEnabled(contribModel.getRowCount() > 0); // Create LibrariesInstaller tied with the provided index installer = new LibraryInstaller(indexer, platform) { @Override public void onProgress(Progress progress) { setProgress(progress); } }; }
protected JComboBox createCombo(String strText, JPanel pnlDisplay) { JComboBox cmbMode = new JComboBox(m_aStrMode); if (!strText.equalsIgnoreCase(m_aStrMode[0]) && !strText.equalsIgnoreCase(m_aStrMode[1])) strText = m_aStrMode[0]; cmbMode.setSelectedItem(strText); pnlDisplay.add(cmbMode); return cmbMode; }
public void updateSimulationPanel(PartitionDataList dataList) { setDataList(dataList); // TODO: DOES NOT WORK outputFormatModel.setSelectedItem(dataList.outputFormat); outputFormat.setSelectedItem(dataList.outputFormat); } // END: updateSimulationPanel
public void initParameters() { OperatorUIUtils.initParamList(bandList, getBandNames()); selectEigenvaluesBy.setSelectedItem(paramMap.get("selectEigenvaluesBy")); eigenvalueThreshold.setText(String.valueOf(paramMap.get("eigenvalueThreshold"))); setNumberOfEigenvalues(); }
private static JComboBox<String> createSpeedCombo() { JComboBox<String> combo = new JComboBox<>(); String defaultSpeed = getConfig().getRoot().getProperty(Launcher.SPEED_KEY, "115200"); for (int speed : new int[] {9600, 14400, 19200, 38400, 57600, 115200, 460800, 921600}) combo.addItem(Integer.toString(speed)); combo.setSelectedItem(defaultSpeed); return combo; }
public void setup(String type, int channel, int cc, int min, int max) { // setType(type); typeList.setSelectedItem(type); this.channel.setValue(channel); this.cc.setValue(cc); this.min.setValue(min); this.max.setValue(max); }
private void extraInit() { addSynapses(); jTextFieldDelay.setText(mySynProps.getDelayGenerator().toShortString()); jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString()); jTextFieldThreshold.setText(mySynProps.getThreshold() + ""); jComboBoxSynapseType.setSelectedItem(mySynProps.getSynapseType()); }
public void selectRemote(@NotNull String remoteName) { for (GitRemote remote : myRemotes) { if (remote.getName().equals(remoteName)) { myRemoteCombobox.setSelectedItem(remote); return; } } myRemoteCombobox.setSelectedIndex(0); }
@Override protected Object retrieveComponentValue(boolean clearOnExit) { Object selectedItem = multiConfValuesBox.getSelectedItem(); if (clearOnExit) { multiConfValuesBox.setSelectedItem(EMPTY); } return selectedItem; }
private void setValue(final JComponent component) { final String primitiveFormName = _primitiveForm.getName(); if (_dotDefinitionDialogFrame.isPropertyStatic(primitiveFormName, _property)) { Object object = _dotDefinitionDialogFrame.getValueOfStaticProperty(primitiveFormName, _property); if (component instanceof JComboBox) { final String currentValue; if (object instanceof Color) { currentValue = ColorManager.getInstance().getColorName((Color) object); } else if (object instanceof Integer) { Integer i = (Integer) object; if (i.equals(Font.PLAIN)) { currentValue = STANDARD_FONT; } else if (i.equals(Font.BOLD)) { currentValue = BOLD_FONT; } else if (i.equals(Font.ITALIC)) { currentValue = ITALIC_FONT; } else { currentValue = "Unbekannter Font"; } } else { currentValue = (String) object; } JComboBox comboBox = (JComboBox) component; comboBox.setSelectedItem(currentValue); } else if (component instanceof JSpinner) { JSpinner spinner = (JSpinner) component; if (object instanceof Integer) { spinner.setValue((Integer) object); } else { spinner.setValue((Double) object); } } } else { if (component instanceof JComboBox) { JComboBox comboBox = (JComboBox) component; comboBox.setSelectedItem(DOTPoint.getDefaultValue(_property)); } else if (component instanceof JSpinner) { JSpinner spinner = (JSpinner) component; spinner.setValue(DOTPoint.getDefaultValue(_property)); } } }