Java Code Examples for javax.swing.JComboBox#addItem()
The following examples show how to use
javax.swing.JComboBox#addItem() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigTable.java From knife with MIT License | 6 votes |
public void setupTypeColumn() { //call this function must after table data loaded !!!! JComboBox<String> comboBox = new JComboBox<String>(); comboBox.addItem(ConfigEntry.Action_Add_Or_Replace_Header); comboBox.addItem(ConfigEntry.Action_Append_To_header_value); comboBox.addItem(ConfigEntry.Action_Remove_From_Headers); comboBox.addItem(ConfigEntry.Config_Basic_Variable); comboBox.addItem(ConfigEntry.Config_Custom_Payload); comboBox.addItem(ConfigEntry.Config_Custom_Payload_Base64); comboBox.addItem(ConfigEntry.Config_Chunked_Variable); comboBox.addItem(ConfigEntry.Config_Proxy_Variable); TableColumnModel typeColumn = this.getColumnModel(); typeColumn.getColumn(2).setCellEditor(new DefaultCellEditor(comboBox)); JCheckBox jc1 = new JCheckBox(); typeColumn.getColumn(3).setCellEditor(new DefaultCellEditor(jc1)); // //Set up tool tips for the sport cells. // DefaultTableCellRenderer renderer = // new DefaultTableCellRenderer(); // renderer.setToolTipText("Click for combo box"); // typeColumn.setCellRenderer(renderer); }
Example 2
Source File: SwingDialog.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public SwingDialog(){ setDefaultCloseOperation(DISPOSE_ON_CLOSE); setSize(new Dimension(250, 250)); final JComboBox<String> combo = new JComboBox<String>(); for (int i = 0; i< 101; i++){ combo.addItem("text" + i); } final JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(20, 0,0,0)); panel.setLayout(new FlowLayout()); panel.setPreferredSize(new Dimension(100, 300)); panel.add(combo); panel.add(createJFXPanel()); panel.add(createJFXPanel0()); final JScrollPane scroll = new JScrollPane(panel); getContentPane().add(scroll); }
Example 3
Source File: SBOLDescriptorPanel2.java From iBioSim with Apache License 2.0 | 6 votes |
public void constructPanel(Set<String> sbolFilePaths) { idText = new JTextField("", 40); nameText = new JTextField("", 40); descriptionText = new JTextField("", 40); saveFilePaths = new LinkedList<String>(sbolFilePaths); saveFilePaths.add("Save to New File"); saveFileIDBox = new JComboBox(); for (String saveFilePath : saveFilePaths) { saveFileIDBox.addItem(GlobalConstants.getFilename(saveFilePath)); } add(new JLabel("SBOL ComponentDefinition ID:")); add(idText); add(new JLabel("SBOL ComponentDefinition Name:")); add(nameText); add(new JLabel("SBOL ComponentDefinition Description:")); add(descriptionText); }
Example 4
Source File: MySpecies.java From iBioSim with Apache License 2.0 | 6 votes |
public static JComboBox createUnitsChoices(BioModel bioModel) { JComboBox specUnits = new JComboBox(); specUnits.addItem("( none )"); for (int i = 0; i < bioModel.getSBMLDocument().getModel().getUnitDefinitionCount(); i++) { UnitDefinition unit = bioModel.getSBMLDocument().getModel().getUnitDefinition(i); if ((unit.getUnitCount() == 1) && (unit.getUnit(0).isMole() || unit.getUnit(0).isItem() || unit.getUnit(0).isGram() || unit.getUnit(0).isKilogram()) && (unit.getUnit(0).getExponent() == 1)) { if (!(bioModel.getSBMLDocument().getLevel() < 3 && unit.getId().equals("substance"))) { specUnits.addItem(unit.getId()); } } } if (bioModel.getSBMLDocument().getLevel() < 3) { specUnits.addItem("substance"); } String[] unitIds = { "dimensionless", "gram", "item", "kilogram", "mole" }; for (int i = 0; i < unitIds.length; i++) { specUnits.addItem(unitIds[i]); } return specUnits; }
Example 5
Source File: MarketEUR.java From btdex with GNU General Public License v3.0 | 6 votes |
@Override public JComponent getFieldEditor(String key, boolean editable, HashMap<String, String> fields) { if(key.equals(METHOD)) { JComboBox<String> combo = new JComboBox<String>(); combo.addItem(SEPA); combo.addItem(SEPA_INSTANT); combo.setSelectedIndex(0); combo.setEnabled(editable); String value = fields.get(key); if(value.equals(SEPA_INSTANT)) combo.setSelectedIndex(1); return combo; } return super.getFieldEditor(key, editable, fields); }
Example 6
Source File: ComboBoxDemo.java From beautyeye with Apache License 2.0 | 6 votes |
/** * Fill combo box. * * @param cb the cb */ void fillComboBox(JComboBox cb) { cb.addItem(getString("ComboBoxDemo.brent")); cb.addItem(getString("ComboBoxDemo.georges")); cb.addItem(getString("ComboBoxDemo.hans")); cb.addItem(getString("ComboBoxDemo.howard")); cb.addItem(getString("ComboBoxDemo.james")); cb.addItem(getString("ComboBoxDemo.jeff")); cb.addItem(getString("ComboBoxDemo.jon")); cb.addItem(getString("ComboBoxDemo.lara")); cb.addItem(getString("ComboBoxDemo.larry")); cb.addItem(getString("ComboBoxDemo.lisa")); cb.addItem(getString("ComboBoxDemo.michael")); cb.addItem(getString("ComboBoxDemo.philip")); cb.addItem(getString("ComboBoxDemo.scott")); }
Example 7
Source File: FlashingPreferenceDialog.java From Spark with Apache License 2.0 | 6 votes |
public FlashingPreferenceDialog() { JPanel flashingPanel = new JPanel(); flashingEnabled = new JCheckBox(); flashingType = new JComboBox(); JLabel lTyps = new JLabel(); flashingPanel.setLayout(new GridBagLayout()); flashingEnabled.addActionListener( e -> updateUI(flashingEnabled.isSelected()) ); flashingType.addItem(FlashingResources.getString("flashing.type.continuous")); flashingType.addItem(FlashingResources.getString("flashing.type.temporary")); flashingPanel.add(flashingEnabled, new GridBagConstraints(0, 0, 3, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); flashingPanel.add(lTyps, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); flashingPanel.add(flashingType, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); flashingPanel.setBorder(BorderFactory.createTitledBorder(FlashingResources.getString("title.flashing"))); // Setup MNEMORICS ResourceUtils.resButton(flashingEnabled, FlashingResources.getString("flashing.enable")); ResourceUtils.resLabel(lTyps, flashingType, FlashingResources.getString("flashing.type")); setLayout(new VerticalFlowLayout()); add( flashingPanel ); }
Example 8
Source File: MetalworksPrefs.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public JPanel buildConnectingPanel() { JPanel connectPanel = new JPanel(); connectPanel.setLayout(new ColumnLayout()); JPanel protoPanel = new JPanel(); JLabel protoLabel = new JLabel("Protocol"); JComboBox protocol = new JComboBox(); protocol.addItem("SMTP"); protocol.addItem("IMAP"); protocol.addItem("Other..."); protoPanel.add(protoLabel); protoPanel.add(protocol); JPanel attachmentPanel = new JPanel(); JLabel attachmentLabel = new JLabel("Attachments"); JComboBox attach = new JComboBox(); attach.addItem("Download Always"); attach.addItem("Ask size > 1 Meg"); attach.addItem("Ask size > 5 Meg"); attach.addItem("Ask Always"); attachmentPanel.add(attachmentLabel); attachmentPanel.add(attach); JCheckBox autoConn = new JCheckBox("Auto Connect"); JCheckBox compress = new JCheckBox("Use Compression"); autoConn.setSelected(true); connectPanel.add(protoPanel); connectPanel.add(attachmentPanel); connectPanel.add(autoConn); connectPanel.add(compress); return connectPanel; }
Example 9
Source File: MetalworksPrefs.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public JPanel buildConnectingPanel() { JPanel connectPanel = new JPanel(); connectPanel.setLayout(new ColumnLayout()); JPanel protoPanel = new JPanel(); JLabel protoLabel = new JLabel("Protocol"); JComboBox protocol = new JComboBox(); protocol.addItem("SMTP"); protocol.addItem("IMAP"); protocol.addItem("Other..."); protoPanel.add(protoLabel); protoPanel.add(protocol); JPanel attachmentPanel = new JPanel(); JLabel attachmentLabel = new JLabel("Attachments"); JComboBox attach = new JComboBox(); attach.addItem("Download Always"); attach.addItem("Ask size > 1 Meg"); attach.addItem("Ask size > 5 Meg"); attach.addItem("Ask Always"); attachmentPanel.add(attachmentLabel); attachmentPanel.add(attach); JCheckBox autoConn = new JCheckBox("Auto Connect"); JCheckBox compress = new JCheckBox("Use Compression"); autoConn.setSelected(true); connectPanel.add(protoPanel); connectPanel.add(attachmentPanel); connectPanel.add(autoConn); connectPanel.add(compress); return connectPanel; }
Example 10
Source File: VariationPerParameterTableController.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
public void populateTypeComboBox(JComboBox comboBox) { ArrayList<VariationFunctionContext> typeList; typeList = this.variationFunctionContextList; for (VariationFunctionContext context : typeList) { comboBox.addItem(context); } comboBox.setSelectedItem(this.defaultVariationFunctionContext); }
Example 11
Source File: SwingShowTooltipViewer.java From birt with Eclipse Public License 1.0 | 5 votes |
ControlPanel( SwingShowTooltipViewer siv ) { this.siv = siv; setLayout( new GridLayout( 0, 1, 0, 0 ) ); JPanel jp = new JPanel( ); jp.setLayout( new FlowLayout( FlowLayout.LEFT, 3, 3 ) ); jp.add( new JLabel( "Choose:" ) );//$NON-NLS-1$ jcbModels = new JComboBox( ); jcbModels.addItem( "Area Chart" ); jcbModels.addItem( "Bar Chart" ); jcbModels.addItem( "Line Chart" ); jcbModels.addItem( "Meter Chart" ); jcbModels.addItem( "Pie Chart" ); jcbModels.addItem( "Scatter Chart" ); jcbModels.addItem( "Stock Chart" ); jcbModels.addItem( "Bar Chart_combine" ); jcbModels.setSelectedIndex( 0 ); jp.add( jcbModels ); jbUpdate = new JButton( "Update" );//$NON-NLS-1$ jbUpdate.addActionListener( this ); jp.add( jbUpdate ); add( jp ); }
Example 12
Source File: MetalworksPrefs.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public JPanel buildConnectingPanel() { JPanel connectPanel = new JPanel(); connectPanel.setLayout(new ColumnLayout()); JPanel protoPanel = new JPanel(); JLabel protoLabel = new JLabel("Protocol"); JComboBox protocol = new JComboBox(); protocol.addItem("SMTP"); protocol.addItem("IMAP"); protocol.addItem("Other..."); protoPanel.add(protoLabel); protoPanel.add(protocol); JPanel attachmentPanel = new JPanel(); JLabel attachmentLabel = new JLabel("Attachments"); JComboBox attach = new JComboBox(); attach.addItem("Download Always"); attach.addItem("Ask size > 1 Meg"); attach.addItem("Ask size > 5 Meg"); attach.addItem("Ask Always"); attachmentPanel.add(attachmentLabel); attachmentPanel.add(attach); JCheckBox autoConn = new JCheckBox("Auto Connect"); JCheckBox compress = new JCheckBox("Use Compression"); autoConn.setSelected(true); connectPanel.add(protoPanel); connectPanel.add(attachmentPanel); connectPanel.add(autoConn); connectPanel.add(compress); return connectPanel; }
Example 13
Source File: TargetMappingPanel.java From netbeans with Apache License 2.0 | 5 votes |
private void initAntTargetEditor(List<String> targets) { JComboBox combo = new JComboBox(); combo.setEditable(true); for (String target : targets) { combo.addItem(target); } customTargets.setDefaultEditor(JComboBox.class, new DefaultCellEditor(combo)); }
Example 14
Source File: FormatChartsViewer.java From birt with Eclipse Public License 1.0 | 5 votes |
ControlPanel( FormatChartsViewer fcv ) { this.fcv = fcv; setLayout( new GridLayout( 0, 1, 0, 0 ) ); JPanel jp = new JPanel( ); jp.setLayout( new FlowLayout( FlowLayout.LEFT, 3, 3 ) ); JLabel choose=new JLabel( "Choose:" );//$NON-NLS-1$ choose.setDisplayedMnemonic( 'c' ); jp.add( choose ); jcbModels = new JComboBox( ); jcbModels.addItem( "Axis Format" );//$NON-NLS-1$ jcbModels.addItem( "Colored By Category" );//$NON-NLS-1$ jcbModels.addItem( "Legend & Title Format" );//$NON-NLS-1$ jcbModels.addItem( "Percentage Values" );//$NON-NLS-1$ jcbModels.addItem( "Plot Format" );//$NON-NLS-1$ jcbModels.addItem( "Series Format" );//$NON-NLS-1$ choose.setLabelFor( jcbModels ); jcbModels.setSelectedIndex( 0 ); jp.add( jcbModels ); jbUpdate = new JButton( "Update" );//$NON-NLS-1$ jbUpdate.setMnemonic( 'u' ); jbUpdate.setToolTipText( "Update" );//$NON-NLS-1$ jbUpdate.addActionListener( this ); jp.add( jbUpdate ); add( jp ); }
Example 15
Source File: DataChartsViewer.java From birt with Eclipse Public License 1.0 | 5 votes |
ControlPanel( DataChartsViewer dcv ) { this.dcv = dcv; setLayout( new GridLayout( 0, 1, 0, 0 ) ); JPanel jp = new JPanel( ); jp.setLayout( new FlowLayout( FlowLayout.LEFT, 3, 3 ) ); JLabel choose=new JLabel( "Choose:" );//$NON-NLS-1$ choose.setDisplayedMnemonic( 'c' ); jp.add( choose ); jcbModels = new JComboBox( ); jcbModels.addItem( "Min Slice" );//$NON-NLS-1$ jcbModels.addItem( "Multiple Y Axis" );//$NON-NLS-1$ jcbModels.addItem( "Multiple Y Series" );//$NON-NLS-1$ jcbModels.addItem( "Big number Y Series" );//$NON-NLS-1$ jcbModels.setSelectedIndex( 0 ); choose.setLabelFor( jcbModels ); jp.add( jcbModels ); jbUpdate = new JButton( "Update" );//$NON-NLS-1$ jbUpdate.setMnemonic( 'u' ); jbUpdate.setToolTipText( "Update" );//$NON-NLS-1$ jbUpdate.addActionListener( this ); jp.add( jbUpdate ); add( jp ); }
Example 16
Source File: KeyConfigure.java From tn5250j with GNU General Public License v2.0 | 4 votes |
private JPanel createFunctionsPanel() { functions = new JList(lm); // add list selection listener to our functions list so that we // can display the mapped key(s) to the function when a new // function is selected. functions.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { setKeyDescription(functions.getSelectedIndex()); } } }); loadList(LangTool.getString("key.labelKeys")); functions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane functionsScroll = new JScrollPane(functions); JPanel fp = new JPanel(); JComboBox whichKeys = new JComboBox(); whichKeys.addItem(LangTool.getString("key.labelKeys")); whichKeys.addItem(LangTool.getString("key.labelMacros")); whichKeys.addItem(LangTool.getString("key.labelSpecial")); whichKeys.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); loadList((String)cb.getSelectedItem()); } }); fp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelDesc"))); fp.setLayout(new BoxLayout(fp,BoxLayout.Y_AXIS)); fp.add(whichKeys); fp.add(functionsScroll); return fp; }
Example 17
Source File: SiteRateModelEditor.java From beast-mcmc with GNU Lesser General Public License v2.1 | 4 votes |
public SiteRateModelEditor(PartitionDataList dataList, int row) throws NumberFormatException, BadLocationException { this.dataList = dataList; this.row = row; siteParameterFields = new RealNumberField[PartitionData.siteRateModelParameterNames.length]; window = new JDialog(owner, "Setup site rate model for partition " + (row + 1)); optionPanel = new OptionsPanel(12, 12, SwingConstants.CENTER); siteCombo = new JComboBox(); siteCombo.setOpaque(false); for (String siteModel : PartitionData.siteRateModels) { siteCombo.addItem(siteModel); }// END: fill loop siteCombo.addItemListener(new ListenSiteCombo()); for (int i = 0; i < PartitionData.siteRateModelParameterNames.length; i++) { switch (i) { case 0: // GammaCategories siteParameterFields[i] = new RealNumberField(1.0, Double.valueOf(Integer.MAX_VALUE)); break; case 1: // Alpha siteParameterFields[i] = new RealNumberField(0.0, Double.MAX_VALUE); break; case 2: // Invariant sites proportion siteParameterFields[i] = new RealNumberField(0.0, 1.0); break; default: siteParameterFields[i] = new RealNumberField(); }//END: parameter switch siteParameterFields[i].setColumns(8); siteParameterFields[i].setValue(dataList.get(0).siteRateModelParameterValues[i]); }// END: fill loop setSiteArguments(); // Buttons JPanel buttonsHolder = new JPanel(); buttonsHolder.setOpaque(false); cancel = new JButton("Cancel", Utils.createImageIcon(Utils.CLOSE_ICON)); cancel.addActionListener(new ListenCancel()); buttonsHolder.add(cancel); done = new JButton("Done", Utils.createImageIcon(Utils.CHECK_ICON)); done.addActionListener(new ListenOk()); buttonsHolder.add(done); // Window owner = Utils.getActiveFrame(); window.setLocationRelativeTo(owner); window.getContentPane().setLayout(new BorderLayout()); window.getContentPane().add(optionPanel, BorderLayout.CENTER); window.getContentPane().add(buttonsHolder, BorderLayout.SOUTH); window.pack(); //return to the previously chosen index on start siteCombo.setSelectedIndex(dataList.get(row).siteRateModelIndex); }
Example 18
Source File: Boot.java From MakeLobbiesGreatAgain with MIT License | 4 votes |
public static void getLocalAddr() throws InterruptedException, PcapNativeException, UnknownHostException, SocketException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { if (Settings.getDouble("autoload", 0) == 1) { addr = InetAddress.getByName(Settings.get("addr", "")); return; } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); final JFrame frame = new JFrame("Network Device"); frame.setFocusableWindowState(true); final JLabel ipLab = new JLabel("Select LAN IP obtained from Network Settings:", JLabel.LEFT); final JComboBox<String> lanIP = new JComboBox<String>(); final JLabel lanLabel = new JLabel("If your device IP isn't in the dropdown, provide it below."); final JTextField lanText = new JTextField(Settings.get("addr", "")); ArrayList<InetAddress> inets = new ArrayList<InetAddress>(); for (PcapNetworkInterface i : Pcaps.findAllDevs()) { for (PcapAddress x : i.getAddresses()) { InetAddress xAddr = x.getAddress(); if (xAddr != null && x.getNetmask() != null && !xAddr.toString().equals("/0.0.0.0")) { NetworkInterface inf = NetworkInterface.getByInetAddress(x.getAddress()); if (inf != null && inf.isUp() && !inf.isVirtual()) { inets.add(xAddr); lanIP.addItem((lanIP.getItemCount() + 1) + " - " + inf.getDisplayName() + " ::: " + xAddr.getHostAddress()); System.out.println("Found: " + lanIP.getItemCount() + " - " + inf.getDisplayName() + " ::: " + xAddr.getHostAddress()); } } } } if (lanIP.getItemCount() == 0) { JOptionPane.showMessageDialog(null, "Unable to locate devices.\nPlease try running the program in Admin Mode.\nIf this does not work, you may need to reboot your computer.", "Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } lanIP.setFocusable(false); final JButton start = new JButton("Start"); start.addActionListener(e -> { try { if (lanText.getText().length() >= 7 && !lanText.getText().equals("0.0.0.0")) { // 7 is because the minimum field is 0.0.0.0 addr = InetAddress.getByName(lanText.getText()); System.out.println("Using IP from textfield: " + lanText.getText()); } else { addr = inets.get(lanIP.getSelectedIndex()); System.out.println("Using device from dropdown: " + lanIP.getSelectedItem()); } Settings.set("addr", addr.getHostAddress().replaceAll("/", "")); frame.setVisible(false); frame.dispose(); } catch (UnknownHostException e1) { e1.printStackTrace(); } }); frame.setLayout(new GridLayout(5, 1)); frame.add(ipLab); frame.add(lanIP); frame.add(lanLabel); frame.add(lanText); frame.add(start); frame.setAlwaysOnTop(true); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); while (frame.isVisible()) Thread.sleep(10); }
Example 19
Source File: VisualSettings.java From stendhal with GNU General Public License v2.0 | 4 votes |
/** * Create the transparency mode selector row. * * @return component holding the selector and the related label */ private JComponent createTransparencySelector() { JComponent row = SBoxLayout.createContainer(SBoxLayout.HORIZONTAL, SBoxLayout.COMMON_PADDING); JLabel label = new JLabel("Transparency mode:"); row.add(label); final JComboBox<String> selector = new JComboBox<>(); final String[][] data = { {"Automatic (default)", "auto", "The appropriate mode is decided automatically based on the system speed."}, {"Full translucency", "translucent", "Use semitransparent images where available. This is slow on some systems."}, {"Simple transparency", "bitmask", "Use simple transparency where parts of the image are either fully transparent or fully opaque.<p>Use this setting on old computers, if the game is unresponsive otherwise."} }; // Convenience mapping for getting the data rows from either short or // long names final Map<String, String[]> desc2data = new HashMap<String, String[]>(); Map<String, String[]> key2data = new HashMap<String, String[]>(); for (String[] s : data) { // fill the selector... selector.addItem(s[0]); // ...and prepare the convenience mappings in the same step desc2data.put(s[0], s); key2data.put(s[1], s); } // Find out the current option final WtWindowManager wm = WtWindowManager.getInstance(); String currentKey = wm.getProperty(TRANSPARENCY_PROPERTY, "auto"); String[] currentData = key2data.get(currentKey); if (currentData == null) { // invalid value; force the default currentData = key2data.get("auto"); } selector.setSelectedItem(currentData[0]); selector.setRenderer(new TooltippedRenderer(data)); selector.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object selected = selector.getSelectedItem(); String[] selectedData = desc2data.get(selected); wm.setProperty(TRANSPARENCY_PROPERTY, selectedData[1]); ClientSingletonRepository.getUserInterface().addEventLine(new EventLine("", "The new transparency mode will be used the next time you start the game client.", NotificationType.CLIENT)); } }); row.add(selector); StringBuilder toolTip = new StringBuilder("<html>The transparency mode used for the graphics. The available options are:<dl>"); for (String[] optionData : data) { toolTip.append("<dt><b>"); toolTip.append(optionData[0]); toolTip.append("</b></dt>"); toolTip.append("<dd>"); toolTip.append(optionData[2]); toolTip.append("</dd>"); } toolTip.append("</dl></html>"); row.setToolTipText(toolTip.toString()); selector.setToolTipText(toolTip.toString()); return row; }
Example 20
Source File: ConnectPanel.java From netbeans with Apache License 2.0 | 4 votes |
private void addConnectors(int defaultIndex) { //assert connectorsLoaded.get(); if (connectors.isEmpty()) { // no attaching connectors available => print message only add (new JLabel ( NbBundle.getMessage (ConnectPanel.class, "CTL_No_Connector") )); return; } if (connectors.size () > 1) { // more than one attaching connector available => // init cbConnectors & selext default connector cbConnectors = new JComboBox (); cbConnectors.getAccessibleContext ().setAccessibleDescription ( NbBundle.getMessage (ConnectPanel.class, "ACSD_CTL_Connector") ); int i, k = connectors.size (); for (i = 0; i < k; i++) { Connector connector = connectors.get (i); int jj = connector.name ().lastIndexOf ('.'); String s = (jj < 0) ? connector.name () : connector.name ().substring (jj + 1); cbConnectors.addItem ( s + " (" + connector.description () + ")" ); } cbConnectors.setActionCommand ("SwitchMe!"); cbConnectors.addActionListener (this); } cbConnectors.setSelectedIndex (defaultIndex); selectedConnector = connectors.get(defaultIndex); setCursor(standardCursor); synchronized (connectorsLoaded) { connectorsLoaded.set(true); connectorsLoaded.notifyAll(); } }