public void setData(TraceDataSet dataSet) { this.dataSet = dataSet; this.errorsOnly = false; this.traceLabel = null; this.minTraceTime = 0; btnFilterErrors.setSelected(false); txtMinTime.setText(""); tbmTraces.setDataSet(dataSet, null); List<String> traceNames = new ArrayList<String>(); for (ViewerTraceRecord rec : dataSet.getRecords()) { String traceName = rec.getTraceName(); if (traceName != null && !traceNames.contains(traceName)) { traceNames.add(traceName); } } Collections.sort(traceNames); cmbTraceType.removeAllItems(); cmbTraceType.addItem("*"); for (String traceName : traceNames) { cmbTraceType.addItem(traceName); } }
public EditorOptionsPanel() { if (SystemInfo.isMac) { myCbEnableWheelFontChange.setText( ApplicationBundle.message("checkbox.enable.ctrl.mousewheel.changes.font.size.macos")); } myStripTrailingSpacesCombo.addItem(STRIP_CHANGED); myStripTrailingSpacesCombo.addItem(STRIP_ALL); myStripTrailingSpacesCombo.addItem(STRIP_NONE); myHighlightSettingsPanel.setLayout(new BorderLayout()); myHighlightSettingsPanel.add(myErrorHighlightingPanel.getPanel(), BorderLayout.CENTER); myRichCopyColorSchemeComboBox.setRenderer( new ListCellRendererWrapper<String>() { @Override public void customize( JList list, String value, int index, boolean selected, boolean hasFocus) { final String textToUse; if (RichCopySettings.ACTIVE_GLOBAL_SCHEME_MARKER.equals(value)) { textToUse = ACTIVE_COLOR_SCHEME; } else { textToUse = value; } setText(textToUse); } }); myConfigurable = new MyConfigurable(); initQuickDocProcessing(); initSoftWrapsSettingsProcessing(); }
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; }
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); } }; }
public LicenseDialog(Component parent) { setTitle("Licensing information"); pnlButtons.add(bttnOk); cbLang.addItem("English"); cbLang.addItem("Eesti"); FlowLayout fl = new FlowLayout(); fl.setAlignment(FlowLayout.LEFT); pnlHeader.setLayout(fl); pnlHeader.add(lblLang); pnlHeader.add(cbLang); pnlMain.setLayout(new BorderLayout()); pnlMain.add(pnlHeader, BorderLayout.NORTH); pnlMain.add(scrollPane, BorderLayout.CENTER); pnlMain.add(pnlButtons, BorderLayout.SOUTH); taLicenseText.setText(getLicenseText()); taLicenseText.setCaretPosition(0); taLicenseText.setLineWrap(true); taLicenseText.setEditable(false); taLicenseText.setWrapStyleWord(true); getContentPane().add(pnlMain); setPreferredSize(new Dimension(500, 600)); setLocationRelativeTo(parent); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); bttnOk.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { if (evt.getSource() == bttnOk) { dispose(); } } // end actionPerformed }); // end bttnOk Action Listener cbLang.addItemListener( new ItemListener() { public void itemStateChanged(final ItemEvent event) { if (event.getSource() == cbLang && event.getStateChange() == ItemEvent.SELECTED && cbLang.getItemCount() > 0) { taLicenseText.setText(getLicenseText()); taLicenseText.setCaretPosition(0); } } }); // end cbLang item listener pack(); setVisible(true); } // PortPropertiesDialog
public void fillFields(final Subscription subscription, Project project) { this.subscription = subscription; subscriptionComboBox.addItem(subscription.getName()); regionOrAffinityGroupComboBox.addItem("<Loading...>"); ProgressManager.getInstance() .run( new Task.Backgroundable(project, "Loading regions...", false) { @Override public void run(ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); try { final java.util.List<AffinityGroup> affinityGroups = AzureSDKManagerImpl.getManager() .getAffinityGroups(subscription.getId().toString()); final java.util.List<Location> locations = AzureSDKManagerImpl.getManager() .getLocations(subscription.getId().toString()); ApplicationManager.getApplication() .invokeLater( new Runnable() { @Override public void run() { final Vector<Object> vector = new Vector<Object>(); vector.add("Regions"); vector.addAll(locations); if (affinityGroups.size() > 0) { vector.add("Affinity Groups"); vector.addAll(affinityGroups); } regionOrAffinityGroupComboBox.removeAllItems(); regionOrAffinityGroupComboBox.setModel( new DefaultComboBoxModel(vector) { public void setSelectedItem(Object o) { if (!(o instanceof String)) { super.setSelectedItem(o); } } }); regionOrAffinityGroupComboBox.setSelectedIndex(1); } }); } catch (AzureCmdException e) { UIHelper.showException("Error getting regions", e); } } }); }
protected void createButtons(JPanel panel) { panel.add(new Filler(24, 20)); JComboBox drawingChoice = new JComboBox(); drawingChoice.addItem(fgUntitled); String param = getParameter("DRAWINGS"); if (param == null) { param = ""; } StringTokenizer st = new StringTokenizer(param); while (st.hasMoreTokens()) { drawingChoice.addItem(st.nextToken()); } if (drawingChoice.getItemCount() > 1) { panel.add(drawingChoice); } else { panel.add(new JLabel(fgUntitled)); } drawingChoice.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { loadDrawing((String) e.getItem()); } } }); panel.add(new Filler(6, 20)); JButton button; button = new CommandButton(new DeleteCommand("Delete", this)); panel.add(button); button = new CommandButton(new DuplicateCommand("Duplicate", this)); panel.add(button); button = new CommandButton(new GroupCommand("Group", this)); panel.add(button); button = new CommandButton(new UngroupCommand("Ungroup", this)); panel.add(button); button = new JButton("Help"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { showHelp(); } }); panel.add(button); fUpdateButton = new JButton("Simple Update"); fUpdateButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { if (fSimpleUpdate) { setBufferedDisplayUpdate(); } else { setSimpleDisplayUpdate(); } } }); }
public GlobalCvsSettingsPanel() { myPServerPanel.setLayout(new BorderLayout()); myPServerPanel.add(myPServerSettingsPanel.getPanel(), BorderLayout.CENTER); Charset[] availableCharsets = CharsetToolkit.getAvailableCharsets(); myCharset.addItem(CvsApplicationLevelConfiguration.DEFAULT); for (Charset charset : availableCharsets) { myCharset.addItem(charset.name()); } }
// WTF: this does not update packs!! // only updating info for selected pack. pulldown menus and info area! void updatePacks() { for (int i = 0; i < packPanels.size(); i++) { if (selectedPack == i && getIndex() >= 0) { ModPack pack = ModPack.getPackArray().get(getIndex()); if (pack != null) { String mods = ""; if (pack.getMods() != null) { mods += "<p>This pack contains the following mods by default:</p><ul>"; for (String name : pack.getMods()) { mods += "<li>" + name + "</li>"; } mods += "</ul>"; } packPanels.get(i).setBackground(UIManager.getColor("control").darker().darker()); packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); File tempDir = new File( OSUtils.getCacheStorageLocation(), "ModPacks" + File.separator + pack.getDir()); packInfo.setText( "<html><img src='file:///" + tempDir.getPath() + File.separator + pack.getImageName() + "' width=400 height=200></img> <br>" + pack.getInfo() + mods); packInfo.setCaretPosition(0); if (ModPack.getSelectedPack(isFTB()).getServerUrl().equals("") || ModPack.getSelectedPack(isFTB()).getServerUrl() == null) { server.setEnabled(false); } else { server.setEnabled(true); } String tempVer = Settings.getSettings().getPackVer(pack.getDir()); version.removeActionListener(al); version.removeAllItems(); version.addItem("Recommended"); if (pack.getOldVersions() != null) { for (String s : pack.getOldVersions()) { version.addItem(s); } version.setSelectedItem(tempVer); } version.addActionListener(al); } } else { packPanels.get(i).setBackground(UIManager.getColor("control")); packPanels.get(i).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } } }
public HeaderPanel(String heading) { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setBackground(background); JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT); Font labelFont = new Font("Dialog", Font.BOLD, 18); panelLabel.setFont(labelFont); this.add(panelLabel); this.add(Box.createHorizontalGlue()); refresh = new JButton("Refresh"); refresh.addActionListener(this); this.add(refresh); this.add(Box.createHorizontalStrut(5)); root = new JComboBox(); Dimension d = root.getPreferredSize(); d.width = 90; root.setPreferredSize(d); root.setMaximumSize(d); File[] roots = directoryPane.getRoots(); for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath()); this.add(root); root.setSelectedIndex(directoryPane.getCurrentRootIndex()); root.addActionListener(this); this.add(Box.createHorizontalStrut(17)); }
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 TableCellRenderFrame() { setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); TableModel model = new PlanetTableModel(); JTable table = new JTable(model); table.setRowSelectionAllowed(false); // set up renderers and editors table.setDefaultRenderer(Color.class, new ColorTableCellRenderer()); table.setDefaultEditor(Color.class, new ColorTableCellEditor()); JComboBox<Integer> moonCombo = new JComboBox<>(); for (int i = 0; i <= 20; i++) moonCombo.addItem(i); TableColumnModel columnModel = table.getColumnModel(); TableColumn moonColumn = columnModel.getColumn(PlanetTableModel.MOONS_COLUMN); moonColumn.setCellEditor(new DefaultCellEditor(moonCombo)); moonColumn.setHeaderRenderer(table.getDefaultRenderer(ImageIcon.class)); moonColumn.setHeaderValue(new ImageIcon(getClass().getResource("Moons.gif"))); // show table table.setRowHeight(100); add(new JScrollPane(table), BorderLayout.CENTER); }
public GlobalControls() { setLayout(new GridBagLayout()); setBorder(new TitledBorder(new EtchedBorder(), "Global Controls")); aliasCB = createCheckBox("Anti-Aliasing", true, 0); renderCB = createCheckBox("Rendering Quality", false, 1); textureCB = createCheckBox("Texture", false, 2); compositeCB = createCheckBox("AlphaComposite", false, 3); screenCombo = new JComboBox(); screenCombo.setPreferredSize(new Dimension(120, 18)); screenCombo.setLightWeightPopupEnabled(true); screenCombo.setFont(font); for (int i = 0; i < screenNames.length; i++) { screenCombo.addItem(screenNames[i]); } screenCombo.addItemListener(this); Java2Demo.addToGridBag(this, screenCombo, 0, 4, 1, 1, 0.0, 0.0); toolBarCB = createCheckBox("Tools", false, 5); slider = new JSlider(JSlider.HORIZONTAL, 0, 200, 30); slider.addChangeListener(this); TitledBorder tb = new TitledBorder(new EtchedBorder()); tb.setTitleFont(font); tb.setTitle("Anim delay = 30 ms"); slider.setBorder(tb); slider.setMinimumSize(new Dimension(80, 46)); Java2Demo.addToGridBag(this, slider, 0, 6, 1, 1, 1.0, 1.0); texturechooser = new TextureChooser(0); Java2Demo.addToGridBag(this, texturechooser, 0, 7, 1, 1, 1.0, 1.0); }
public AddNewUser() { super("Add New User", true, false, true, true); msg = new JOptionPane(); rand = new RandomPassword(); ec = new EasyCrypt(); db = new ExecDb(); AddNewUserLayout customLayout = new AddNewUserLayout(); getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12)); getContentPane().setLayout(customLayout); accType = new JComboBox(); accType.addItem("Student"); accType.addItem("Teacher"); accType.addItem("Officer"); getContentPane().add(accType); accTxt = new JTextField(""); getContentPane().add(accTxt); label_1 = new JLabel("Add new user account", JLabel.CENTER); getContentPane().add(label_1); label_2 = new JLabel("Account Type : "); getContentPane().add(label_2); label_3 = new JLabel("Account ID : "); getContentPane().add(label_3); button_1 = new JButton("ADD"); getContentPane().add(button_1); button_2 = new JButton("CLOSE"); getContentPane().add(button_2); passTxt = new JTextField(""); passTxt.setEditable(false); getContentPane().add(passTxt); label_4 = new JLabel("Random Password : "); getContentPane().add(label_4); setSize(getPreferredSize()); accType.addItemListener(this); button_1.addActionListener(this); button_2.addActionListener(this); }
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 DemoControls(ImageOps demo) { super(demo.name); this.demo = demo; setBackground(Color.gray); add(imgCombo = new JComboBox()); imgCombo.setFont(font); for (int i = 0; i < ImageOps.imgName.length; i++) { imgCombo.addItem(ImageOps.imgName[i]); } imgCombo.addActionListener(this); add(opsCombo = new JComboBox()); opsCombo.setFont(font); for (int i = 0; i < ImageOps.opsName.length; i++) { opsCombo.addItem(ImageOps.opsName[i]); } opsCombo.addActionListener(this); }
public JComboBoxDemo() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setBounds(100, 100, 250, 100); JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); this.setContentPane(contentPane); contentPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JLabel label = new JLabel("证件类型:"); contentPane.add(label); JComboBox<String> comboBox = new JComboBox<String>(); comboBox.addItem("2015"); comboBox.addItem("2014"); comboBox.addItem("2013"); contentPane.add(comboBox); this.setVisible(true); }
private void affectLibelle() { setTitle(ConcoursJeunes.ajrLibelle.getResourceString("criterion.titre")); jlCode.setText(ConcoursJeunes.ajrLibelle.getResourceString("criterion.code")); jlLibelle.setText(ConcoursJeunes.ajrLibelle.getResourceString("criterion.libelle")); jlSortOrder.setText(ConcoursJeunes.ajrLibelle.getResourceString("criterion.ordretri")); jcbSortOrder.removeAllItems(); jcbSortOrder.addItem(ConcoursJeunes.ajrLibelle.getResourceString("criterion.ordretri.asc")); jcbSortOrder.addItem(ConcoursJeunes.ajrLibelle.getResourceString("criterion.ordretri.desc")); jcbPlacementCriterion.setText( ConcoursJeunes.ajrLibelle.getResourceString("criterion.placement")); jcbClassementCriterion.setText( ConcoursJeunes.ajrLibelle.getResourceString("criterion.classement")); jbValider.setText(ConcoursJeunes.ajrLibelle.getResourceString("bouton.valider")); jbAnnuler.setText(ConcoursJeunes.ajrLibelle.getResourceString("bouton.annuler")); }
@SuppressWarnings("UseJBColor") // Colors are used for the graphics generator, not the plugin UI public RasterAssetSetStep( TemplateWizardState state, @Nullable Project project, @Nullable Module module, @Nullable Icon sidePanelIcon, UpdateListener updateListener, @Nullable VirtualFile invocationTarget) { super(state, project, module, sidePanelIcon, updateListener, invocationTarget); // Speed the scrolling of myScrollPane myScrollPane.getVerticalScrollBar().setUnitIncrement(16); register(ATTR_TEXT, myText); register(ATTR_SCALING, myCropRadioButton, Scaling.CROP); register(ATTR_SCALING, myCenterRadioButton, Scaling.CENTER); register(ATTR_SHAPE, myCircleRadioButton, GraphicGenerator.Shape.CIRCLE); register(ATTR_SHAPE, myNoneRadioButton, GraphicGenerator.Shape.NONE); register(ATTR_SHAPE, mySquareRadioButton, GraphicGenerator.Shape.SQUARE); register(ATTR_SHAPE, myVerticalRadioButton, GraphicGenerator.Shape.VRECT); register(ATTR_SHAPE, myHorizontalRadioButton, GraphicGenerator.Shape.HRECT); register(ATTR_DOGEAR, myDogEarEffectCheckBox); register(ATTR_PADDING, myPaddingSlider); register(ATTR_TRIM, myTrimBlankSpace); register(ATTR_FONT, myFontFamily); register(ATTR_SOURCE_TYPE, myImageRadioButton, AssetStudioAssetGenerator.SourceType.IMAGE); register(ATTR_SOURCE_TYPE, myClipartRadioButton, AssetStudioAssetGenerator.SourceType.CLIPART); register(ATTR_SOURCE_TYPE, myTextRadioButton, AssetStudioAssetGenerator.SourceType.TEXT); register(ATTR_FOREGROUND_COLOR, myForegroundColor); register(ATTR_BACKGROUND_COLOR, myBackgroundColor); register(ATTR_ASSET_TYPE, myAssetTypeComboBox); register(ATTR_ASSET_THEME, myChooseThemeComboBox); register(ATTR_ASSET_NAME, myResourceNameField); myImageFile.addBrowseFolderListener( null, null, null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); myForegroundColor.setSelectedColor(Color.BLUE); myBackgroundColor.setSelectedColor(Color.WHITE); for (String font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) { myFontFamily.addItem(new ComboBoxItem(font, font, 1, 1)); if (font.equals(myTemplateState.get(ATTR_FONT))) { myFontFamily.setSelectedIndex(myFontFamily.getItemCount() - 1); } } myChooseClipart.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayClipartDialog(); } }); populateComboBox(myAssetTypeComboBox, AssetType.class); populateComboBox(myChooseThemeComboBox, ActionBarIconGenerator.Theme.class); }
public EditorOptionsPanel() { if (SystemInfo.isMac) { myCbEnableWheelFontChange.setText( ApplicationBundle.message("checkbox.enable.ctrl.mousewheel.changes.font.size.macos")); } myStripTrailingSpacesCombo.addItem(STRIP_CHANGED); myStripTrailingSpacesCombo.addItem(STRIP_ALL); myStripTrailingSpacesCombo.addItem(STRIP_NONE); ActionListener explainer = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { explainTrailingSpaces(getStripTrailingSpacesValue()); } }; myStripTrailingSpacesCombo.addActionListener(explainer); myCbVirtualSpace.addActionListener(explainer); myHighlightSettingsPanel.setLayout(new BorderLayout()); myHighlightSettingsPanel.add(myErrorHighlightingPanel.getPanel(), BorderLayout.CENTER); myCbRenameLocalVariablesInplace.setVisible( OptionsApplicabilityFilter.isApplicable(OptionId.RENAME_IN_PLACE)); myRichCopyColorSchemeComboBox.setRenderer( new ListCellRendererWrapper<String>() { @Override public void customize( JList list, String value, int index, boolean selected, boolean hasFocus) { final String textToUse; if (RichCopySettings.ACTIVE_GLOBAL_SCHEME_MARKER.equals(value)) { textToUse = ACTIVE_COLOR_SCHEME; } else { textToUse = value; } setText(textToUse); } }); myConfigurable = new MyConfigurable(); initQuickDocProcessing(); initSoftWrapsSettingsProcessing(); initVcsSettingsProcessing(); }
private void setcbr() { try { ResultSet rst = DBConnection.getDBConnection() .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery( "SELECT * FROM Passenger where Booked_status='Booked' and Pay_Status='Not_Paid'"); System.out.println("Hello"); while (rst.next()) { combo1.addItem(rst.getString(1)); combo2.addItem(rst.getString(2)); } } catch (Exception n) { n.printStackTrace(); } }
{ for (myjava.gui.syntax.Painter painter : myjava.gui.syntax.Painter.getPainters()) { painterComboBox.addItem(painter); EntryListPanel panel = new EntryListPanel(painter); listPanelSet.add(panel); centerPanel.add(panel, painter.getName()); } componentSet.addAll(Arrays.asList(matchBracket, painterComboBox, centerPanel)); }
/** * creates a new channel, if the channel exists it is removed (this method doubles as a * removeChannel) * * @param name the name of the channel */ public void newChannel(String name, boolean pass) { if (channels.containsKey(name)) { channels.remove(name); cboChannels.removeItem(name); } else { channels.put(name, new Boolean(pass)); cboChannels.addItem(name); } }
/** {@inheritDoc} */ public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { BranchDescriptor d = myBranches.get(row); myComboBox.removeAllItems(); for (String s : d.referencesToSelect) { myComboBox.addItem(s); } myComboBox.setSelectedItem(d.referenceToCheckout); return myPanel; }
private void updateParams(EDPCellData data) { paramComboBox.removeAllItems(); paramKeys = data.getPlugin().getPrintfDescrs(!m_isCrawlRuleEditor); if (!m_isCrawlRuleEditor) { paramComboBox.addItem(STRING_LITERAL); } for (Iterator it = paramKeys.values().iterator(); it.hasNext(); ) { ConfigParamDescr descr = (ConfigParamDescr) it.next(); int type = descr.getType(); if (!m_isCrawlRuleEditor && (type == ConfigParamDescr.TYPE_SET || type == ConfigParamDescr.TYPE_RANGE)) continue; paramComboBox.addItem(descr); } paramComboBox.setEnabled(true); paramComboBox.setSelectedIndex(0); paramComboBox.setToolTipText("Select a parameter to insert into the format string"); insertButton.setEnabled(true); }
private void prepareTextComboBox(final Object propertyValue) { // _textComboBox wird in der letzten Zeile editierbar gemacht, und es wird // der übergebene Wert in diese Zeile eingetragen und selektiert, wenn er nicht // einem der anderen Einträge entspricht. if (propertyValue != null) { String propertyValueAsString = (String) propertyValue; final int size = _textComboBox.getModel().getSize(); boolean propertyValueFound = false; for (int i = 0; i < size - 1; i++) { if (propertyValueAsString.equals((String) _textComboBox.getItemAt(i))) { propertyValueFound = true; _textComboBox.setSelectedIndex(i); break; } } if (!propertyValueFound) { _textComboBox.removeItemAt(size - 1); _textComboBox.addItem(propertyValueAsString); _textComboBox.setSelectedIndex(size - 1); } } ItemListener textComboBoxItemListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (_textComboBox.getSelectedIndex() == DOTPointPainter.DYNAMIC_TEXT_ITEMS.length - 1) { _textComboBox.setEditable(true); } else { _textComboBox.setEditable(false); } } } }; _textComboBox.addItemListener(textComboBoxItemListener); ActionListener editorActionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { final int length = DOTPointPainter.DYNAMIC_TEXT_ITEMS.length; final int index = length - 1; final ComboBoxEditor editor = _textComboBox.getEditor(); String editedItem = (String) editor.getItem(); _textComboBox.insertItemAt(editedItem, index); final DefaultComboBoxModel model = (DefaultComboBoxModel) _textComboBox.getModel(); if (model.getSize() > length) { // Sieht komisch aus, aber der direkte Weg ging nicht. model.removeElementAt(length); } } }; _textComboBox.getEditor().addActionListener(editorActionListener); }
public EmpMain() { String[] col = {"사번", "이름", "직위", "입사일", "부서번호"}; String[][] row = new String[0][5]; model = new DefaultTableModel(row, col) { public boolean isCellEditable(int r, int c) { return false; } }; table = new JTable(model); JScrollPane js = new JScrollPane(table); la = new JLabel("사원목록"); la.setFont(new Font("나눔스퀘어", Font.BOLD, 30)); table.setFont(new Font("나눔스퀘어", Font.PLAIN, 12)); JPanel p = new JPanel(); p.add(la); la1 = new JLabel("Search"); tf = new JTextField(10); box = new JComboBox(); box.addItem("이름"); box.addItem("입사일"); box.addItem("부서"); b1 = new JButton("찾기"); b2 = new JButton("목록"); JPanel p1 = new JPanel(); p1.add(la1); p1.add(box); p1.add(tf); p1.add(b1); p1.add(b2); add("South", p1); add("Center", js); add("North", p); setSize(640, 480); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); getData(); table.addMouseListener(this); b1.addActionListener(this); b2.addActionListener(this); }
// Вид формы при изменении сотрудника public void sotrDiaUpdate(Sotrudnik s) { label_id_hidden.setText(Integer.toString(s.getId_sotrudnika())); textField_familiya.setText(s.getFamiliya()); textField_imya.setText(s.getImya()); textField_otchestvo.setText(s.getOtchestvo()); textField_phone.setText(s.getPhone()); textField_date.setText(s.getData_priema().toString()); comboBox_doljnost.removeAllItems(); comboBox_kvalification.removeAllItems(); try { DBClass db = new DBClass(); ArrayList<Doljnost> d = db.doljnostFromDB(); DBClass db2 = new DBClass(); Doljnost dd = db2.doljnostFromDB(s); for (int i = 0; i < d.size(); i++) { comboBox_doljnost.addItem(d.get(i)); Doljnost ddd = (Doljnost) comboBox_doljnost.getItemAt(i); if (dd.getNazvanie_doljnosti().equals(ddd.getNazvanie_doljnosti())) dd = ddd; } comboBox_doljnost.setSelectedItem(dd); DBClass db3 = new DBClass(); ArrayList<Kvalification> k = db3.kvalificationFromDB(); DBClass db4 = new DBClass(); Kvalification kk = db4.kvalificationFromDB(s); for (int i = 0; i < k.size(); i++) { comboBox_kvalification.addItem(k.get(i)); Kvalification kkk = (Kvalification) comboBox_kvalification.getItemAt(i); if (kk.getNazvanie_kvalification().equals(kkk.getNazvanie_kvalification())) kk = kkk; } comboBox_kvalification.setSelectedItem(kk); } catch (ClassNotFoundException e) { e.printStackTrace(); JOptionPane.showMessageDialog(panelException, e.getMessage()); } catch (SQLException ee) { ee.printStackTrace(); JOptionPane.showMessageDialog(panelException, ee.getMessage()); } }
private void fillFieldCars(JComboBox<String> cars) { String previousCar = null; for (Car car : shop.getCars()) { String carName = car.getManufacturer() + " " + car.getModel(); if (!carName.equals(previousCar)) { cars.addItem(carName); } previousCar = carName; } }
/** * Establishes combo box editor for 'from onramp' column. * * @param clmn */ private void setUpToOnrampColumn() { JComboBox combo = new JComboBox(); Vector<AbstractNetworkElement> nes = ((AbstractControllerComplex) controller).getMyMonitor().getSuccessors(); for (int i = 0; i < nes.size(); i++) if ((nes.get(i).getType() & TypesHWC.MASK_LINK) > 0) combo.addItem(nes.get(i)); TableColumn clmn = zonetab.getColumnModel().getColumn(3); clmn.setCellEditor(new DefaultCellEditor(combo)); clmn.setCellRenderer(new DefaultTableCellRenderer()); return; }