Example usage for javax.swing JComboBox JComboBox

List of usage examples for javax.swing JComboBox JComboBox

Introduction

In this page you can find the example usage for javax.swing JComboBox JComboBox.

Prototype

public JComboBox() 

Source Link

Document

Creates a JComboBox with a default data model.

Usage

From source file:gtu._work.ui.RetryByPassUI.java

private void initGUI() {
    try {/*from   ww  w.j av  a 2  s .  c  om*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                FlowLayout jPanel1Layout = new FlowLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("?", null, jPanel1, null);
                {
                    DefaultComboBoxModel countryComboBoxModel = new DefaultComboBoxModel();
                    for (CountyEnum e : CountyEnum.values()) {
                        countryComboBoxModel.addElement(e.countyLabel);
                    }
                    countryComboBox = new JComboBox();
                    jPanel1.add(countryComboBox);
                    countryComboBox.setModel(countryComboBoxModel);
                }
                {
                    ComboBoxModel passRetryComboBoxModel = new DefaultComboBoxModel(
                            new String[] { "byPass", "reTry", "status" });
                    passRetryComboBox = new JComboBox();
                    jPanel1.add(passRetryComboBox);
                    passRetryComboBox.setModel(passRetryComboBoxModel);
                }
                {
                    sendBtn = new JButton();
                    jPanel1.add(sendBtn);
                    sendBtn.setText("\u9001\u51fa");
                    sendBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            //TODO add your code for sendBtn.actionPerformed
                            new Thread(new Runnable() {
                                @Override
                                public void run() {
                                    readMessageId();
                                }
                            }).start();
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("messageId", null, jPanel2, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel2.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(604, 375));
                    {
                        messageIdArea = new JTextArea();
                        jScrollPane1.setViewportView(messageIdArea);
                    }
                }
            }
            {
                jPanel3 = new JPanel();
                BorderLayout jPanel3Layout = new BorderLayout();
                jPanel3.setLayout(jPanel3Layout);
                jTabbedPane1.addTab("?", null, jPanel3, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel3.add(jScrollPane2, BorderLayout.CENTER);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(604, 375));
                    {
                        executeLogArea = new JTextArea();
                        jScrollPane2.setViewportView(executeLogArea);
                    }
                }
            }
        }
        pack();
        this.setSize(617, 429);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:cz.lidinsky.editor.TableCellEditor.java

/**
 *  Initialize all of the components//  www. j a  va2  s  .  co  m
 */
public TableCellEditor() {
    // color chooser
    button = new JButton();
    button.setActionCommand("edit");
    button.addActionListener(this);
    button.setBorderPainted(false);
    button.addFocusListener(this);
    colorChooser = new JColorChooser();
    colorChooser.addChooserPanel(new AliasChooser());
    colorChooser.addFocusListener(this);
    dialog = JColorChooser.createDialog(button, "Pick a Color", true, colorChooser, this, null);
    // text editor
    textField = new JTextField();
    textField.addFocusListener(this);
    // combo chooser
    comboBox = new JComboBox();
    comboBox.addFocusListener(this);
    // check box
    checkBox = new JCheckBox();
    checkBox.addFocusListener(this);
}

From source file:net.aepik.alasca.gui.util.LoadFileFrame.java

/**
 * Build new LoadFileFrame object./*www .java2  s . c  om*/
 */
public LoadFileFrame(JFrame f, SchemaManager m) {
    super(f, "Ouvrir un fichier Schema", true);
    this.setSize(400, 380);
    this.setResizable(false);
    this.setLocationRelativeTo(f);
    this.mainFrame = f;
    this.manager = m;
    this.filename = new JTextField();
    this.syntaxes = new JComboBox();
    this.boutonOpenFile = new JButton("...");
    this.boutonOk = new JButton("Charger");
    this.boutonAnnuler = new JButton("Annuler");
    this.errorMessage = "";
    initFrame();
}

From source file:au.org.ala.delta.intkey.ui.WebSearchDialog.java

/**
 * Create the dialog.//from  w ww. j  av a2s .c  o m
 */
public WebSearchDialog(Dialog owner) {

    super(owner);
    setName("WebSearchDialog");
    ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(WebSearchDialog.class);
    resourceMap.injectFields(this);
    ActionMap actionMap = Application.getInstance().getContext().getActionMap(WebSearchDialog.class, this);

    setTitle(websearchTitle);
    setBounds(100, 100, 450, 250);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    {
        lblSearchFor = new JLabel(searchForLabel);
    }

    txtSearch = new JTextField();
    txtSearch.setColumns(10);

    final JLabel lblUsing = new JLabel(usingLabel);

    cmbSearchEngine = new JComboBox();
    GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
    gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblSearchFor, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
                            .addComponent(cmbSearchEngine, 0, 404, Short.MAX_VALUE)
                            .addComponent(txtSearch, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
                            .addComponent(lblUsing, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_contentPanel
            .setVerticalGroup(
                    gl_contentPanel.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_contentPanel.createSequentialGroup().addContainerGap()
                                    .addComponent(lblSearchFor).addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(txtSearch, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addGap(27).addComponent(lblUsing)
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(cmbSearchEngine, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(41, Short.MAX_VALUE)));
    contentPanel.setLayout(gl_contentPanel);
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("[OK]");
            okButton.setAction(actionMap.get("WebSearchDialog_search"));
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("[Cancel]");
            cancelButton.setAction(actionMap.get("WebSearchDialog_cancel"));
            buttonPane.add(cancelButton);
        }
    }

    LocalConfigFiles files = new LocalConfigFiles("intkey");
    File f = files.getWebsearchIndexFile();
    if (f.exists()) {
        loadSearchEngines(f, cmbSearchEngine);
    }

    cmbSearchEngine.requestFocus();
}

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./*w w  w  . j  a v  a2s.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.anrisoftware.prefdialog.fields.historycombobox.HistoryComboBoxField.java

/**
 * @see ComboBoxFieldFactory#create(Object, String)
 *///from w ww  .  j  av a2 s  .com
@AssistedInject
HistoryComboBoxField(HistoryComboBoxFactory historyComboBoxFactory, @Assisted Object parentObject,
        @Assisted String fieldName) {
    super(ANNOTATION_CLASS, new JComboBox<Object>(), parentObject, fieldName);
    this.boxFactory = historyComboBoxFactory;
    this.history = new ArrayList<Object>();
    this.defaultItems = new ArrayList<Object>();
    this.historyListener = new ListDataListener() {

        @Override
        public void intervalRemoved(ListDataEvent e) {
            removeHistory(e.getIndex0(), e.getIndex1());
        }

        @Override
        public void intervalAdded(ListDataEvent e) {
            insertHistory(e.getIndex0(), e.getIndex1());
        }

        @Override
        public void contentsChanged(ListDataEvent e) {
            replaceHistory(e.getIndex0(), e.getIndex1());
        }
    };
}

From source file:ca.sfu.federation.viewer.propertysheet.CoordinateSystemPropertySheet.java

/** 
 * CoordinateSystemPropertySheet constructor
 *///from   w  w w  .j  a va  2  s  .co m
public CoordinateSystemPropertySheet() {
    lblINamedObject = new JLabel();
    lblName = new JLabel();
    lblDescription = new JLabel();
    jtfClass = new JTextField();
    jtfName = new JTextField();
    jtfCanonicalName = new JTextField();
    lblCanonicalName = new JLabel();
    lblClass = new JLabel();
    jtfDescription = new JTextField();
    lblParentContext = new JLabel();
    jtfParentContext = new JTextField();
    lblX = new JLabel();
    lblY = new JLabel();
    lblZ = new JLabel();
    jtfX = new JTextField();
    jtfY = new JTextField();
    jtfZ = new JTextField();
    lblUpdateMethod = new JLabel();
    jcbUpdateMethod = new JComboBox();
    jScrollPane1 = new JScrollPane();

    lblINamedObject.setFont(new java.awt.Font("Tahoma", 0, 14));
    lblINamedObject.setText("jLabel1");
    lblName.setText("Name");
    lblDescription.setText("Description");
    lblCanonicalName.setText("Canonical Name");
    lblClass.setText("Class");
    lblParentContext.setText("Parent Context");
    lblX.setText("X Coordinate");
    lblY.setText("Y Coordinate");
    lblZ.setText("Z Coordinate");
    lblUpdateMethod.setText("Update Method");

    jtfParentContext.setEditable(false);
    jtfClass.setEditable(false);
    jtfCanonicalName.setEditable(false);

    jScrollPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING,
                            layout.createSequentialGroup().addContainerGap()
                                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                    301, Short.MAX_VALUE)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, lblINamedObject)
                                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout
                                                    .createSequentialGroup().add(layout
                                                            .createParallelGroup(
                                                                    org.jdesktop.layout.GroupLayout.LEADING)
                                                            .add(lblCanonicalName).add(lblClass).add(
                                                                    lblName)
                                                            .add(lblDescription).add(lblX).add(lblZ).add(lblY)
                                                            .add(lblUpdateMethod).add(lblParentContext))
                                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                                    .add(layout
                                                            .createParallelGroup(
                                                                    org.jdesktop.layout.GroupLayout.LEADING)
                                                            .add(jcbUpdateMethod, 0, 221, Short.MAX_VALUE)
                                                            .add(jtfName,
                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                    221, Short.MAX_VALUE)
                                                            .add(jtfClass,
                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                    221, Short.MAX_VALUE)
                                                            .add(jtfDescription,
                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                    221, Short.MAX_VALUE)
                                                            .add(org.jdesktop.layout.GroupLayout.TRAILING,
                                                                    layout.createSequentialGroup()
                                                                            .addPreferredGap(
                                                                                    org.jdesktop.layout.LayoutStyle.RELATED)
                                                                            .add(jtfCanonicalName,
                                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                                    221, Short.MAX_VALUE))
                                                            .add(jtfParentContext,
                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                    221, Short.MAX_VALUE)
                                                            .add(jtfX,
                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                    221, Short.MAX_VALUE)
                                                            .add(jtfY,
                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                    221, Short.MAX_VALUE)
                                                            .add(jtfZ,
                                                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                                                    221, Short.MAX_VALUE))))
                                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup().addContainerGap().add(lblINamedObject)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jtfClass, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(lblClass))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jtfName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(lblName))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(lblCanonicalName)
                            .add(jtfCanonicalName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(lblDescription).add(jtfDescription,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jtfParentContext, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(lblParentContext))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(lblX).add(
                            jtfX, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                            org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jtfY, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(lblY))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jtfZ, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(lblZ))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jcbUpdateMethod, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                                    org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                    org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(lblUpdateMethod))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE)
                    .addContainerGap()));

    // disable non editable fields
    this.jtfCanonicalName.setEditable(false);
    this.jtfClass.setEditable(false);
    this.jtfParentContext.setEditable(false);

    // set field values
    this.setValues();

    // add action listener
    jtfName.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jtfNameActionListener(evt);
        }
    });
    jtfDescription.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jtfDescriptionActionListener(evt);
        }
    });
    jtfX.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jtfXActionListener(evt);
        }
    });
    jtfY.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jtfYActionListener(evt);
        }
    });
    jtfZ.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jtfZActionListener(evt);
        }
    });
    jcbUpdateMethod.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jcbUpdateMethodActionListener(evt);
        }
    });
}

From source file:com.floreantpos.config.ui.AddPrinterDialog.java

@Override
public void initUI() {
    setLayout(new BorderLayout(5, 5));
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new MigLayout("", "[][grow][]", "[][][][][grow]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    titlePanel = new TitlePanel();
    titlePanel.setTitle("Printer Type:");//$NON-NLS-1$
    add(titlePanel, BorderLayout.NORTH);

    JLabel lblName = new JLabel("Virtual Printer Name : "); //$NON-NLS-1$
    centerPanel.add(lblName, "cell 0 0,alignx trailing"); //$NON-NLS-1$

    tfName = new FixedLengthTextField(20);

    cbVirtualPrinter = new JComboBox();
    List<VirtualPrinter> virtualPrinters = VirtualPrinterDAO.getInstance().findAll();
    cbVirtualPrinter//  w  w w  . j a  va 2 s.c  o m
            .setModel(new DefaultComboBoxModel<VirtualPrinter>(virtualPrinters.toArray(new VirtualPrinter[0])));
    //centerPanel.add(cbVirtualPrinter, "cell 1 0,growx"); //$NON-NLS-1$

    centerPanel.add(tfName, "cell 1 0,growx"); //$NON-NLS-1$

    JButton btnNew = new JButton(Messages.getString("AddPrinterDialog.7")); //$NON-NLS-1$
    btnNew.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doAddNewVirtualPrinter();
        }
    });
    //centerPanel.add(btnNew, "cell 2 0"); //$NON-NLS-1$

    JLabel lblDevice = new JLabel(Messages.getString("AddPrinterDialog.9")); //$NON-NLS-1$
    centerPanel.add(lblDevice, "cell 0 1,alignx trailing"); //$NON-NLS-1$

    cbDevice = new JComboBox();
    List printerServices = new ArrayList<>();
    printerServices.add(DO_NOT_PRINT);
    PrintService[] lookupPrintServices = PrintServiceLookup.lookupPrintServices(null, null);
    //cbDevice.setModel(new DefaultComboBoxModel(PrintServiceLookup.lookupPrintServices(null, null)));
    cbDevice.addItem(null);
    for (int i = 0; i < lookupPrintServices.length; i++) {
        printerServices.add(lookupPrintServices[i]);
    }
    cbDevice.setModel(new ComboBoxModel(printerServices));

    cbDevice.setRenderer(new PrintServiceComboRenderer());
    centerPanel.add(cbDevice, "cell 1 1,growx"); //$NON-NLS-1$

    chckbxDefault = new JCheckBox(Messages.getString("AddPrinterDialog.12")); //$NON-NLS-1$
    centerPanel.add(chckbxDefault, "cell 1 2"); //$NON-NLS-1$

    JSeparator separator = new JSeparator();
    centerPanel.add(separator, "cell 0 3 3 1,growx,gapy 50px"); //$NON-NLS-1$

    add(centerPanel, BorderLayout.CENTER);

    JPanel panel = new JPanel();

    JButton btnOk = new JButton(Messages.getString("AddPrinterDialog.16")); //$NON-NLS-1$
    btnOk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doAddPrinter();
        }
    });
    panel.add(btnOk);

    JButton btnCancel = new JButton(Messages.getString("AddPrinterDialog.17")); //$NON-NLS-1$
    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setCanceled(true);
            dispose();
        }
    });
    panel.add(btnCancel);
    add(panel, BorderLayout.SOUTH); //$NON-NLS-1$
}

From source file:edu.harvard.mcz.imagecapture.TemplatePickerDialog.java

protected void init(ICImage image) {
    setBounds(100, 100, 450, 300);/*  www.j av  a  2 s.  c  o  m*/
    StringBuffer title = new StringBuffer();
    title.append("Change Template");
    if (image != null) {
        title.append(" for ").append(image.getFilename());
    }
    this.setTitle(title.toString());
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        lblTemplate = new JLabel("Template");
        lblTemplate.setHorizontalAlignment(SwingConstants.CENTER);
        contentPanel.add(lblTemplate, BorderLayout.NORTH);
    }
    {
        comboBoxTemplatePicker = new JComboBox<String>();
        comboBoxTemplatePicker.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                PositionTemplate defaultTemplate;
                try {
                    defaultTemplate = new PositionTemplate((String) comboBoxTemplatePicker.getSelectedItem());

                    File fileToCheck = new File(ImageCaptureProperties
                            .assemblePathWithBase(imageToTemplate.getPath(), imageToTemplate.getFilename()));

                    BufferedImage imagefile = ImageIO.read(fileToCheck);

                    int x = defaultTemplate.getBarcodeULPosition().width;
                    int y = defaultTemplate.getBarcodeULPosition().height;
                    int w = defaultTemplate.getBarcodeSize().width;
                    int h = defaultTemplate.getBarcodeSize().height;
                    setBarcodeImage(imagefile.getSubimage(x, y, w, h));

                } catch (NullPointerException e1) {
                    log.error(e1.getMessage());
                } catch (NoSuchTemplateException e1) {
                    log.error(e1.getMessage());
                } catch (IOException e1) {
                    log.error(e1.getMessage());
                }
            }

        });
        contentPanel.add(comboBoxTemplatePicker, BorderLayout.SOUTH);
    }
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 0));
        {
            lblFileName = new JLabel("FileName");
            panel.add(lblFileName, BorderLayout.NORTH);
        }
        {
            labelBarcodeImage = new JLabel("Catalog Number Barcode");
            labelBarcodeImage.setIcon(new ImageIcon(TemplatePickerDialog.class
                    .getResource("/edu/harvard/mcz/imagecapture/resources/gnome-mime-image.png")));
            panel.add(labelBarcodeImage, BorderLayout.CENTER);
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.setActionCommand("OK");
            okButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    // TODO Auto-generated method stub
                    ICImageLifeCycle ils = new ICImageLifeCycle();
                    try {
                        String newTemplateID = (String) comboBoxTemplatePicker.getSelectedItem();
                        if (newTemplateID != null) {
                            imageToTemplate.setTemplateId(newTemplateID);
                            ils.attachDirty(imageToTemplate);
                            setVisible(false);
                        }
                    } catch (SaveFailedException e1) {
                        log.error(e1.getMessage(), e1);
                    }
                }

            });
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.setActionCommand("Cancel");
            cancelButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }

            });
            buttonPane.add(cancelButton);
        }
    }
    if (image != null) {
        try {
            boolean result = setupForImage(image);
        } catch (UnreadableFileException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:medsavant.enrichment.app.RegionListAggregatePanel.java

public RegionListAggregatePanel(String page) {
    super(page);/* w  w  w.  jav  a2 s  .c  o m*/
    setLayout(new BorderLayout());

    variantCounts = new TreeMap<GenomicRegion, Integer>();
    patientCounts = new TreeMap<GenomicRegion, Integer>();

    regionSetCombo = new JComboBox();

    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    progress = new JProgressBar();
    progress.setStringPainted(true);

    JPanel banner = new JPanel();
    banner.setLayout(new BoxLayout(banner, BoxLayout.X_AXIS));

    banner.setBackground(new Color(245, 245, 245));
    banner.setBorder(BorderFactory.createTitledBorder("Region List"));

    banner.add(regionSetCombo);
    banner.add(ViewUtil.getMediumSeparator());
    banner.add(Box.createHorizontalGlue());
    banner.add(progress);

    add(banner, BorderLayout.NORTH);
    add(mainPanel, BorderLayout.CENTER);

    createSearchableTable();

    regionSetCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            fetchRegions((RegionSet) regionSetCombo.getSelectedItem());
        }
    });

    new MedSavantWorker<List<RegionSet>>(pageName) {
        @Override
        protected List<RegionSet> doInBackground() throws Exception {
            return RegionController.getInstance().getRegionSets();
        }

        @Override
        protected void showProgress(double fraction) {
        }

        @Override
        protected void showSuccess(List<RegionSet> result) {
            if (!result.isEmpty()) {
                updateRegionSetCombo(result);
            }
        }
    }.execute();
}