List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel
public DefaultComboBoxModel(Vector<E> v)
From source file:dbmods.InsertTemplateName.java
private void addServer() { //START >> jServerList ComboBoxModel<String> jServerListModel = new DefaultComboBoxModel<String>(SERVER); jServerList = new JComboBox<String>(); getContentPane().add(jServerList);//from w w w . ja v a 2s . co m jServerList.setModel(jServerListModel); jServerList.setBounds(5, 5, 78, 23); //END << jServerList }
From source file:com.microsoftopentechnologies.intellij.forms.TableForm.java
public TableForm() { final TableForm form = this; this.setResizable(false); this.setModal(true); this.setTitle("Create new table"); this.setContentPane(mainPanel); createButton.setEnabled(false);/* w w w .j ava2s. c o m*/ tableNameTextField.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent keyEvent) { super.keyTyped(keyEvent); createButton.setEnabled(!tableNameTextField.getText().isEmpty()); } }); final PermissionItem[] tablePermissions = PermissionItem.getTablePermissions(); insertPermisssionComboBox.setModel(new DefaultComboBoxModel(tablePermissions)); deletePermissionComboBox.setModel(new DefaultComboBoxModel(tablePermissions)); updatePermissionComboBox.setModel(new DefaultComboBoxModel(tablePermissions)); readPermissionComboBox.setModel(new DefaultComboBoxModel(tablePermissions)); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { form.setVisible(false); form.dispose(); } }); createButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { try { TablePermissions tablePermissions = new TablePermissions(); tablePermissions.setDelete( ((PermissionItem) deletePermissionComboBox.getSelectedItem()).getType()); tablePermissions.setUpdate( ((PermissionItem) updatePermissionComboBox.getSelectedItem()).getType()); tablePermissions .setRead(((PermissionItem) readPermissionComboBox.getSelectedItem()).getType()); tablePermissions.setInsert( ((PermissionItem) insertPermisssionComboBox.getSelectedItem()).getType()); final String tableName = tableNameTextField.getText().trim(); if (!tableName.matches("^[A-Za-z][A-Za-z0-9_]+")) { JOptionPane.showMessageDialog(form, "Invalid table name. Table name must start with a letter, \n" + "contain only letters, numbers, and underscores.", "Error creating the table", JOptionPane.ERROR_MESSAGE); return; } int tableNameIndex = -1; if (existingTableNames != null) { tableNameIndex = Iterables.indexOf(existingTableNames, new Predicate<String>() { @Override public boolean apply(String name) { return tableName.equalsIgnoreCase(name); } }); } if (tableNameIndex != -1) { JOptionPane.showMessageDialog(form, "Invalid table name. A table with that name already exists in this service.", "Error creating the table", JOptionPane.ERROR_MESSAGE); return; } form.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (editingTable == null) { AzureRestAPIManager.getManager().createTable(subscriptionId, serviceName, tableName, tablePermissions); } else { AzureRestAPIManager.getManager().updateTable(subscriptionId, serviceName, tableName, tablePermissions); } if (afterSave != null) afterSave.run(); form.setVisible(false); form.dispose(); form.setCursor(Cursor.getDefaultCursor()); } catch (Throwable e) { form.setCursor(Cursor.getDefaultCursor()); UIHelper.showException("Error creating table", e); } } }); } }); }
From source file:Data.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from w w w . j ava 2 s. c om*/ * @throws ClassNotFoundException * @throws IOException * @throws SQLException */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() throws ClassNotFoundException, IOException, SQLException { Connection dataFridge = getDbConnection(); Statement stmt = dataFridge.createStatement(); GridBagConstraints gridBagConstraints; panelPrincipal = new JPanel(); panelCenter = new JPanel(); panelHeader = new JPanel(); btnHome = new JButton(); dataList = new JComboBox(); btnOk = new JButton(); panelData = new JScrollPane(); panelRealTime = new JPanel(); tempRealTime = new JLabel(); humRealTime = new JLabel(); // Set unit temperature switch (param.tempUnitList.getSelectedIndex()) { case 0: tempUnit = "C"; break; case 1: tempUnit = "F"; break; default: break; } setPreferredSize(new Dimension(512, 400)); setLayout(null); panelPrincipal.setPreferredSize(new Dimension(512, 400)); panelPrincipal.setLayout(new BorderLayout()); panelHeader.setPreferredSize(new Dimension(512, 40)); panelHeader.setLayout(new GridBagLayout()); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream("home.png"); Image iconeHome = ImageIO.read(input); btnHome.setIcon(new ImageIcon(iconeHome)); btnHome.setPreferredSize(new Dimension(40, 40)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.LINE_START; gridBagConstraints.insets = new Insets(0, 0, 0, 50); panelHeader.add(btnHome, gridBagConstraints); dataList.setModel( new DefaultComboBoxModel(new String[] { "Donnes en temps rel", "Graphique des temperatures" })); dataList.setPreferredSize(new Dimension(250, 40)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.LINE_END; gridBagConstraints.insets = new Insets(0, 0, 0, 10); panelHeader.add(dataList, gridBagConstraints); btnOk.setFont(new Font("Tahoma", 0, 10)); // NOI18N btnOk.setText("OK"); btnOk.setPreferredSize(new Dimension(60, 40)); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnOKActionPerformed(evt); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.LINE_START; gridBagConstraints.insets = new Insets(0, 5, 0, 70); panelHeader.add(btnOk, gridBagConstraints); panelPrincipal.add(panelHeader, BorderLayout.NORTH); panelCenter.setLayout(new BorderLayout()); JFreeChart chart = createChart(createDataset(stmt)); panelChart = new ChartPanel(chart); panelChart.setVisible(true); panelData = new JScrollPane(getTbleData(stmt)); tempRealTime.setFont(new java.awt.Font("Meiryo UI", 1, 18)); // NOI18N humRealTime.setFont(new java.awt.Font("Meiryo UI", 1, 18)); // NOI18N panelRealTime.setLayout(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(18, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.LINE_START; panelRealTime.add(tempRealTime, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(0, 0, 10, 0); gridBagConstraints.anchor = GridBagConstraints.LINE_START; panelRealTime.add(humRealTime, gridBagConstraints); panelCenter.add(panelRealTime, BorderLayout.NORTH); panelCenter.add(panelData, BorderLayout.CENTER); panelPrincipal.add(panelCenter, BorderLayout.CENTER); add(panelPrincipal); panelPrincipal.setBounds(0, 0, 512, 340); stmt.close(); dataFridge.close(); }
From source file:com.mirth.connect.client.ui.components.rsta.FindReplaceDialog.java
private void setProperties() { FindReplaceProperties findReplaceProperties = MirthRSyntaxTextArea.getRSTAPreferences() .getFindReplaceProperties(); List<String> findHistory = findReplaceProperties.getFindHistory(); findComboBox.setModel(new DefaultComboBoxModel(findHistory.toArray(new String[findHistory.size()]))); if (StringUtils.isNotEmpty(textArea.getSelectedText())) { findComboBox.setSelectedItem(textArea.getSelectedText()); }//from ww w. j a v a 2 s .c om List<String> replaceHistory = findReplaceProperties.getReplaceHistory(); replaceComboBox .setModel(new DefaultComboBoxModel(replaceHistory.toArray(new String[replaceHistory.size()]))); if (findReplaceProperties.isForward()) { directionForwardRadio.setSelected(true); } else { directionBackwardRadio.setSelected(true); } wrapSearchCheckBox.setSelected(findReplaceProperties.isWrapSearch()); matchCaseCheckBox.setSelected(findReplaceProperties.isMatchCase()); regularExpressionCheckBox.setSelected(findReplaceProperties.isRegularExpression()); wholeWordCheckBox.setSelected(findReplaceProperties.isWholeWord()); if (!textArea.isEditable()) { replaceLabel.setEnabled(false); replaceComboBox.setEnabled(false); replaceButton.setEnabled(false); replaceAllButton.setEnabled(false); } }
From source file:eu.ggnet.dwoss.redtape.position.PositionUpdateCask.java
/** * Creates new form PositionUpdateCask./*from ww w .ja v a 2 s . c o m*/ */ public PositionUpdateCask() { initComponents(); ((JSpinner.DefaultEditor) postDecimalSpinner.getEditor()).getTextField().setEditable(false); // ((JSpinner.DefaultEditor)preDecimalSpinner.getEditor()).getTextField().setEditable(false); PostLedger postLedger = lookup(MandatorSupporter.class).loadPostLedger(); List bookingAccounts = new ArrayList(); bookingAccounts.add(postLedger.get(SERVICE).orElse(-1)); bookingAccounts.addAll(postLedger.getPossible(SERVICE).orElse(Collections.EMPTY_LIST)); bookingAccountBox.setModel(new DefaultComboBoxModel(bookingAccounts.toArray())); }
From source file:gtu._work.ui.LoadJspCheckTagUI.java
private void initGUI() { try {/*from w ww .j a v a2s. c om*/ BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setTitle("\u8b80\u53d6Jsp\u8cc7\u8a0a"); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(475, 328)); { jTree1 = new JTree(); jScrollPane1.setViewportView(jTree1); jTree1.setModel(null); jTree1.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { jTree1MouseClicked(evt); } }); jTree1.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent evt) { jTree1ValueChanged(evt); } }); } } } { jPanel2 = new JPanel(); jTabbedPane1.addTab("jPanel2", null, jPanel2, null); { subFileNameText = new JTextField(); jPanel2.add(subFileNameText); subFileNameText.setPreferredSize(new java.awt.Dimension(95, 24)); subFileNameText.setText("xhtml"); } { ComboBoxModel jComboBox1Model = new DefaultComboBoxModel( new String[] { "??", "?" }); modifyFileBox = new JComboBox(); jPanel2.add(modifyFileBox); modifyFileBox.setModel(jComboBox1Model); } { exportReportToogleBtn = new JToggleButton(); jPanel2.add(exportReportToogleBtn); exportReportToogleBtn.setText("\u662f\u5426\u532f\u51fa\u5831\u8868"); exportReportToogleBtn.setPreferredSize(new java.awt.Dimension(120, 24)); exportReportToogleBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JCommonUtil.setJToggleButtonText(exportReportToogleBtn, new String[] { "", "?" }); } }); } { projectSrcPathBtn = new JButton(); jPanel2.add(projectSrcPathBtn); projectSrcPathBtn.setText("\u8a2d\u5b9a\u5c08\u6848\u76ee\u8def\u4e26\u6383\u63cf"); projectSrcPathBtn.setPreferredSize(new java.awt.Dimension(233, 95)); projectSrcPathBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton1ActionPerformed(evt); } }); } } } this.setSize(496, 395); } catch (Exception e) { e.printStackTrace(); } }
From source file:DatabaseBrowser.java
protected void populateTableBox() { try {//from w ww . java 2 s .c om String[] types = { "TABLE" }; String catalog = connection.getCatalog(); String schema = (String) (schemaBox.getSelectedItem()); DatabaseMetaData dmd = connection.getMetaData(); ResultSet rset = dmd.getTables(catalog, schema, null, types); Vector values = new Vector(); while (rset.next()) { values.addElement(rset.getString(3)); } rset.close(); tableBox.setModel(new DefaultComboBoxModel(values)); tableBox.setEnabled(values.size() > 0); } catch (Exception e) { tableBox.setEnabled(false); } }
From source file:net.sf.maltcms.chromaui.jmztab.ui.validation.MzTabValidationElement.java
private ComboBoxModel<MZTabErrorType.Level> getErrorLevelModel() { if (dcbm == null) { dcbm = new DefaultComboBoxModel<>(Level.values()); }/*from w w w . ja v a2 s .c o m*/ return dcbm; }
From source file:EHRAppointment.ChartPanelDraw.java
private JComboBox createTrace() { //Create mouse trace final JComboBox trace = new JComboBox(); final String[] traceCmds = { "Enable Trace", "Disable Trace" }; trace.setModel(new DefaultComboBoxModel(traceCmds)); trace.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (traceCmds[0].equals(trace.getSelectedItem())) { chartPanel.setHorizontalAxisTrace(true); chartPanel.setVerticalAxisTrace(true); chartPanel.repaint();// w w w. j a v a 2 s . co m } else { chartPanel.setHorizontalAxisTrace(false); chartPanel.setVerticalAxisTrace(false); chartPanel.repaint(); } } }); return trace; }
From source file:de.cebitec.readXplorer.differentialExpression.plot.DeSeq2GraphicsTopComponent.java
/** * TopComponent, which displays all graphics available for a DESeq analysis. * * @param analysisHandler The analysis handler containing the results * @param usedTool The tool used for the analysis (has to be DESeq in this * case)/*from w w w. j a v a 2 s. c o m*/ */ public DeSeq2GraphicsTopComponent(DeAnalysisHandler handler) { analysisHandler = handler; this.result = handler.getResults().get(0); cbm = new DefaultComboBoxModel(DeSeq2AnalysisHandler.Plot.getValues()); initComponents(); setupGraphics(); iSymbol.setVisible(false); iSymbol.setToolTipText(org.openide.util.NbBundle.getMessage(DeSeq2GraphicsTopComponent.class, "GraphicsTopComponent.iSymbol.toolTipText")); }