Search in sources :

Example 11 with ButtonGroup

use of javax.swing.ButtonGroup in project nhin-d by DirectProject.

the class CAPanel method initUI.

protected void initUI() {
    setLayout(new BorderLayout());
    //setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
    setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new EmptyBorder(5, 5, 5, 5)));
    createCA = new JRadioButton("Create New CA");
    loadCA = new JRadioButton("Load CA");
    ButtonGroup group = new ButtonGroup();
    group.add(createCA);
    group.add(loadCA);
    createCA.setSelected(true);
    JPanel radioPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    radioPanel.add(createCA);
    radioPanel.add(loadCA);
    JPanel fieldsPanel = new JPanel();
    fieldsPanel.setLayout(new GridLayout(3, 3, 10, 10));
    cnField = new TextEntryField("CN:");
    fieldsPanel.add(cnField);
    countryField = new TextEntryField("Country:");
    fieldsPanel.add(countryField);
    stateField = new TextEntryField("State:");
    fieldsPanel.add(stateField);
    locField = new TextEntryField("Location:");
    fieldsPanel.add(locField);
    orgField = new TextEntryField("Org:");
    fieldsPanel.add(orgField);
    emailField = new TextEntryField("Email:");
    fieldsPanel.add(emailField);
    expField = new SpinEntryField("Experiation (Days):", 365);
    fieldsPanel.add(expField);
    keyStr = new DropDownEntry("Key Strength:", new Object[] { 1024, 2048, 4096 });
    fieldsPanel.add(keyStr);
    passField = new PasswordField("Password:");
    fieldsPanel.add(passField);
    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(radioPanel, BorderLayout.NORTH);
    topPanel.add(fieldsPanel, BorderLayout.CENTER);
    add(topPanel, BorderLayout.NORTH);
    new FlowLayout(FlowLayout.LEFT);
    certFileField = new FileField("Certificate Authority File:", "");
    keyFileField = new FileField("Private Key File:", "");
    JPanel filePanel = new JPanel(new GridLayout(1, 2));
    filePanel.add(certFileField);
    filePanel.add(keyFileField);
    loadCert = new JButton("Load");
    loadCert.setVisible(false);
    createCert = new JButton("Create");
    clear = new JButton("Clear");
    clear.setVisible(false);
    clear = new JButton("Clear");
    genCert = new JButton("Create Leaf Cert");
    genCert.setVisible(false);
    signCSR = new JButton("Sign CSR");
    signCSR.setVisible(false);
    addToAltSubjects = new JCheckBox("Add Email To Alt Subject Names");
    addToAltSubjects.setVisible(false);
    addToAltSubjects.setSelected(true);
    allowedToSign = new JCheckBox("Allowed To Sign Certificates");
    allowedToSign.setVisible(false);
    keyEnc = new JCheckBox("Key Encipherment Use");
    keyEnc.setVisible(false);
    keyEnc.setSelected(true);
    digitalSig = new JCheckBox("Digital Signature Use");
    digitalSig.setVisible(false);
    keyEnc.setSelected(true);
    JPanel addAltPanel = new JPanel(new GridLayout(2, 2));
    addAltPanel.setPreferredSize(new Dimension(450, addAltPanel.getPreferredSize().height));
    //addAltPanel.add(addToAltSubjects);
    addAltPanel.add(allowedToSign);
    addAltPanel.add(keyEnc);
    addAltPanel.add(digitalSig);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(addAltPanel);
    buttonPanel.add(loadCert);
    buttonPanel.add(createCert);
    buttonPanel.add(clear);
    buttonPanel.add(genCert);
    buttonPanel.add(signCSR);
    JPanel combineAltAndButtonPanel = new JPanel(new BorderLayout());
    //combineAltAndButtonPanel.add(addAltPanel, BorderLayout.WEST);
    combineAltAndButtonPanel.add(buttonPanel, BorderLayout.EAST);
    JPanel bottomPannel = new JPanel(new BorderLayout());
    bottomPannel.add(filePanel, BorderLayout.NORTH);
    bottomPannel.add(combineAltAndButtonPanel, BorderLayout.SOUTH);
    this.add(bottomPannel, BorderLayout.SOUTH);
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) FlowLayout(java.awt.FlowLayout) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) SoftBevelBorder(javax.swing.border.SoftBevelBorder) CompoundBorder(javax.swing.border.CompoundBorder) JPasswordField(javax.swing.JPasswordField) EmptyBorder(javax.swing.border.EmptyBorder)

Example 12 with ButtonGroup

use of javax.swing.ButtonGroup in project adempiere by adempiere.

the class VBOMDrop method actionPerformed.

//	getPreferredSize
/**************************************************************************
	 *	Action Listener
	 *  @param e event
	 */
public void actionPerformed(ActionEvent e) {
    log.config(e.getActionCommand());
    Object source = e.getSource();
    //	Toggle Qty Enabled
    if (source instanceof JCheckBox || source instanceof JRadioButton) {
        cmd_selection(source);
        //	need to de-select the others in group	
        if (source instanceof JRadioButton) {
            //	find Button Group
            Iterator it = m_buttonGroups.values().iterator();
            while (it.hasNext()) {
                ButtonGroup group = (ButtonGroup) it.next();
                Enumeration en = group.getElements();
                while (en.hasMoreElements()) {
                    //	We found the group
                    if (source == en.nextElement()) {
                        Enumeration info = group.getElements();
                        while (info.hasMoreElements()) {
                            Object infoObj = info.nextElement();
                            if (source != infoObj)
                                cmd_selection(infoObj);
                        }
                    }
                }
            }
        }
    } else //	Product / Qty
    if (source == productField || source == productQty) {
        m_qty = (BigDecimal) productQty.getValue();
        KeyNamePair pp = (KeyNamePair) productField.getSelectedItem();
        m_product = MProduct.get(Env.getCtx(), pp.getKey());
        createMainPanel();
        sizeIt();
    } else //	Order
    if (source == orderField) {
        KeyNamePair pp = (KeyNamePair) orderField.getSelectedItem();
        boolean valid = (pp != null && pp.getKey() > 0);
        //
        if (invoiceField != null)
            invoiceField.setReadWrite(!valid);
        if (projectField != null)
            projectField.setReadWrite(!valid);
    } else //	Invoice
    if (source == invoiceField) {
        KeyNamePair pp = (KeyNamePair) invoiceField.getSelectedItem();
        boolean valid = (pp != null && pp.getKey() > 0);
        //
        if (orderField != null)
            orderField.setReadWrite(!valid);
        if (projectField != null)
            projectField.setReadWrite(!valid);
    } else //	Project
    if (source == projectField) {
        KeyNamePair pp = (KeyNamePair) projectField.getSelectedItem();
        boolean valid = (pp != null && pp.getKey() > 0);
        //
        if (orderField != null)
            orderField.setReadWrite(!valid);
        if (invoiceField != null)
            invoiceField.setReadWrite(!valid);
    } else //	OK
    if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
        if (cmd_save())
            dispose();
    } else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
        dispose();
    //	Enable OK
    boolean OK = m_product != null;
    if (OK) {
        KeyNamePair pp = null;
        if (orderField != null)
            pp = (KeyNamePair) orderField.getSelectedItem();
        if ((pp == null || pp.getKey() <= 0) && invoiceField != null)
            pp = (KeyNamePair) invoiceField.getSelectedItem();
        if ((pp == null || pp.getKey() <= 0) && projectField != null)
            pp = (KeyNamePair) projectField.getSelectedItem();
        OK = (pp != null && pp.getKey() > 0);
    }
    confirmPanel.getOKButton().setEnabled(OK);
}
Also used : JCheckBox(javax.swing.JCheckBox) JRadioButton(javax.swing.JRadioButton) Enumeration(java.util.Enumeration) ButtonGroup(javax.swing.ButtonGroup) Iterator(java.util.Iterator) KeyNamePair(org.compiere.util.KeyNamePair) BigDecimal(java.math.BigDecimal)

Example 13 with ButtonGroup

use of javax.swing.ButtonGroup in project adempiere by adempiere.

the class VBOMDrop method addDisplay.

//	addBOMLine
/**
	 * 	Add Line to Display
	 *	@param parentM_Product_ID parent product
	 *	@param M_Product_ID product
	 *	@param bomType bom type
	 *	@param name name
	 *	@param lineQty qty
	 */
private void addDisplay(int parentM_Product_ID, int M_Product_ID, String bomType, String name, String feature, BigDecimal lineQty) {
    log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",feature=" + feature + ",Qty=" + lineQty);
    //
    boolean selected = true;
    if (MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType)) {
        String title = "";
        JCheckBox cb = new JCheckBox(title);
        cb.setSelected(true);
        cb.setEnabled(false);
        //	cb.addActionListener(this);		//	will not change
        m_selectionList.add(cb);
        this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
    } else if (MPPProductBOMLine.COMPONENTTYPE_Option.equals(bomType)) {
        //String title = Msg.getMsg(Env.getCtx(), "Optional");
        JCheckBox cb = new JCheckBox(feature);
        cb.setSelected(false);
        selected = false;
        cb.addActionListener(this);
        m_selectionList.add(cb);
        this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
    } else if (MPPProductBOMLine.COMPONENTTYPE_Variant.equals(bomType)) {
        //String title = Msg.getMsg(Env.getCtx(), "Variant") + " " + bomType;
        JRadioButton b = new JRadioButton(feature);
        String groupName = feature + "_" + String.valueOf(parentM_Product_ID) + "_" + bomType;
        ButtonGroup group = (ButtonGroup) m_buttonGroups.get(groupName);
        if (group == null) {
            log.fine("ButtonGroup=" + groupName);
            group = new ButtonGroup();
            m_buttonGroups.put(groupName, group);
            group.add(b);
            //	select first one
            b.setSelected(true);
        } else {
            group.add(b);
            b.setSelected(false);
            selected = false;
        }
        b.addActionListener(this);
        m_selectionList.add(b);
        this.add(b, new ALayoutConstraint(m_bomLine++, 0));
    }
    //	Add to List & display
    m_productList.add(new Integer(M_Product_ID));
    VNumber qty = new VNumber("Qty", true, false, true, DisplayType.Quantity, name);
    qty.setValue(lineQty);
    qty.setReadWrite(selected);
    m_qtyList.add(qty);
    CLabel label = new CLabel(name);
    label.setLabelFor(qty);
    this.add(label);
    this.add(qty);
}
Also used : JCheckBox(javax.swing.JCheckBox) CLabel(org.compiere.swing.CLabel) JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) VNumber(org.compiere.grid.ed.VNumber)

Example 14 with ButtonGroup

use of javax.swing.ButtonGroup in project adempiere by adempiere.

the class VProductConfigurationBOM method actionPerformed.

//	getPreferredSize
/**************************************************************************
	 *	Action Listener
	 *  @param e event
	 */
public void actionPerformed(ActionEvent e) {
    log.config(e.getActionCommand());
    Object source = e.getSource();
    //	Toggle Qty Enabled
    if (source instanceof JCheckBox || source instanceof JRadioButton) {
        cmd_selection(source);
        //	need to de-select the others in group	
        if (source instanceof JRadioButton) {
            //	find Button Group
            Iterator it = m_buttonGroups.values().iterator();
            while (it.hasNext()) {
                ButtonGroup group = (ButtonGroup) it.next();
                Enumeration en = group.getElements();
                while (en.hasMoreElements()) {
                    //	We found the group
                    if (source == en.nextElement()) {
                        Enumeration info = group.getElements();
                        while (info.hasMoreElements()) {
                            Object infoObj = info.nextElement();
                            if (source != infoObj)
                                cmd_selection(infoObj);
                        }
                    }
                }
            }
        }
    } else //	Product / Qty
    if (source == productField || source == productQty) {
        m_qty = (BigDecimal) productQty.getValue();
        KeyNamePair pp = (KeyNamePair) productField.getSelectedItem();
        m_product = MProduct.get(Env.getCtx(), pp.getKey());
        createMainPanel();
        sizeIt();
    } else //	Order
    if (source == orderField) {
        KeyNamePair pp = (KeyNamePair) orderField.getSelectedItem();
        boolean valid = (pp != null && pp.getKey() > 0);
        //
        if (invoiceField != null)
            invoiceField.setReadWrite(!valid);
        if (projectField != null)
            projectField.setReadWrite(!valid);
    } else //	Invoice
    if (source == invoiceField) {
        KeyNamePair pp = (KeyNamePair) invoiceField.getSelectedItem();
        boolean valid = (pp != null && pp.getKey() > 0);
        //
        if (orderField != null)
            orderField.setReadWrite(!valid);
        if (projectField != null)
            projectField.setReadWrite(!valid);
    } else //	Project
    if (source == projectField) {
        KeyNamePair pp = (KeyNamePair) projectField.getSelectedItem();
        boolean valid = (pp != null && pp.getKey() > 0);
        //
        if (orderField != null)
            orderField.setReadWrite(!valid);
        if (invoiceField != null)
            invoiceField.setReadWrite(!valid);
    } else //	OK
    if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
        if (cmd_save())
            dispose();
    } else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
        dispose();
    //	Enable OK
    boolean OK = m_product != null;
    if (OK) {
        KeyNamePair pp = null;
        if (orderField != null)
            pp = (KeyNamePair) orderField.getSelectedItem();
        if ((pp == null || pp.getKey() <= 0) && invoiceField != null)
            pp = (KeyNamePair) invoiceField.getSelectedItem();
        if ((pp == null || pp.getKey() <= 0) && projectField != null)
            pp = (KeyNamePair) projectField.getSelectedItem();
        OK = (pp != null && pp.getKey() > 0);
    }
    confirmPanel.getOKButton().setEnabled(OK);
}
Also used : JCheckBox(javax.swing.JCheckBox) JRadioButton(javax.swing.JRadioButton) Enumeration(java.util.Enumeration) ButtonGroup(javax.swing.ButtonGroup) Iterator(java.util.Iterator) org.eevolution.form.bom.nodeUserObject(org.eevolution.form.bom.nodeUserObject) KeyNamePair(org.compiere.util.KeyNamePair) BigDecimal(java.math.BigDecimal)

Example 15 with ButtonGroup

use of javax.swing.ButtonGroup in project libgdx by libgdx.

the class Hiero method initializeComponents.

private void initializeComponents() {
    getContentPane().setLayout(new GridBagLayout());
    JPanel leftSidePanel = new JPanel();
    leftSidePanel.setLayout(new GridBagLayout());
    getContentPane().add(leftSidePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    {
        JPanel fontPanel = new JPanel();
        leftSidePanel.add(fontPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
        fontPanel.setLayout(new GridBagLayout());
        fontPanel.setBorder(BorderFactory.createTitledBorder("Font"));
        {
            fontSizeSpinner = new JSpinner(new SpinnerNumberModel(32, 0, 256, 1));
            fontPanel.add(fontSizeSpinner, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 10), 0, 0));
            ((JSpinner.DefaultEditor) fontSizeSpinner.getEditor()).getTextField().setColumns(2);
        }
        {
            JScrollPane fontScroll = new JScrollPane();
            fontPanel.add(fontScroll, new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
            {
                fontListModel = new DefaultComboBoxModel(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
                fontList = new JList();
                fontScroll.setViewportView(fontList);
                fontList.setModel(fontListModel);
                fontList.setVisibleRowCount(6);
                fontList.setSelectedIndex(0);
                fontScroll.setMinimumSize(new Dimension(220, fontList.getPreferredScrollableViewportSize().height));
            }
        }
        {
            systemFontRadio = new JRadioButton("System:", true);
            fontPanel.add(systemFontRadio, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0));
            systemFontRadio.setMargin(new Insets(0, 0, 0, 0));
        }
        {
            fontFileRadio = new JRadioButton("File:");
            fontPanel.add(fontFileRadio, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            fontFileRadio.setMargin(new Insets(0, 0, 0, 0));
        }
        {
            fontFileText = new JTextField();
            fontPanel.add(fontFileText, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0));
        }
        {
            fontPanel.add(new JLabel("Size:"), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
        }
        {
            unicodePanel = new JPanel(new GridBagLayout());
            fontPanel.add(unicodePanel, new GridBagConstraints(2, 3, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 5), 0, 0));
            {
                boldCheckBox = new JCheckBox("Bold");
                unicodePanel.add(boldCheckBox, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            {
                italicCheckBox = new JCheckBox("Italic");
                unicodePanel.add(italicCheckBox, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
        }
        {
            bitmapPanel = new JPanel(new GridBagLayout());
            fontPanel.add(bitmapPanel, new GridBagConstraints(2, 3, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
            {
                bitmapPanel.add(new JLabel("Gamma:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            {
                gammaSpinner = new JSpinner(new SpinnerNumberModel(1.8f, 0, 30, 0.01));
                ((JSpinner.DefaultEditor) gammaSpinner.getEditor()).getTextField().setColumns(2);
                bitmapPanel.add(gammaSpinner, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 5, 10), 0, 0));
            }
            {
                monoCheckBox = new JCheckBox("Mono");
                bitmapPanel.add(monoCheckBox, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
        }
        {
            browseButton = new JButton("...");
            fontPanel.add(browseButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            browseButton.setMargin(new Insets(0, 0, 0, 0));
        }
        {
            fontPanel.add(new JLabel("Rendering:"), new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
        }
        {
            JPanel renderingPanel = new JPanel(new GridBagLayout());
            fontPanel.add(renderingPanel, new GridBagConstraints(1, 4, 3, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
            {
                freeTypeRadio = new JRadioButton("FreeType");
                renderingPanel.add(freeTypeRadio, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            {
                javaRadio = new JRadioButton("Java");
                renderingPanel.add(javaRadio, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            {
                nativeRadio = new JRadioButton("Native");
                renderingPanel.add(nativeRadio, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
        }
        ButtonGroup buttonGroup = new ButtonGroup();
        buttonGroup.add(systemFontRadio);
        buttonGroup.add(fontFileRadio);
        buttonGroup = new ButtonGroup();
        buttonGroup.add(freeTypeRadio);
        buttonGroup.add(javaRadio);
        buttonGroup.add(nativeRadio);
        freeTypeRadio.setSelected(true);
    }
    {
        JPanel samplePanel = new JPanel();
        leftSidePanel.add(samplePanel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
        samplePanel.setLayout(new GridBagLayout());
        samplePanel.setBorder(BorderFactory.createTitledBorder("Sample Text"));
        {
            JScrollPane textScroll = new JScrollPane();
            samplePanel.add(textScroll, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
            {
                sampleTextPane = new JTextPane();
                textScroll.setViewportView(sampleTextPane);
            }
        }
        {
            sampleNeheButton = new JButton();
            sampleNeheButton.setText("NEHE");
            samplePanel.add(sampleNeheButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
        }
        {
            sampleAsciiButton = new JButton();
            sampleAsciiButton.setText("ASCII");
            samplePanel.add(sampleAsciiButton, new GridBagConstraints(3, 1, 1, 1, 0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
        }
        {
            sampleExtendedButton = new JButton();
            sampleExtendedButton.setText("Extended");
            samplePanel.add(sampleExtendedButton, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
        }
    }
    {
        JPanel renderingPanel = new JPanel();
        leftSidePanel.add(renderingPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
        renderingPanel.setBorder(BorderFactory.createTitledBorder("Rendering"));
        renderingPanel.setLayout(new GridBagLayout());
        {
            JPanel wrapperPanel = new JPanel();
            renderingPanel.add(wrapperPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
            wrapperPanel.setLayout(new BorderLayout());
            wrapperPanel.setBackground(java.awt.Color.white);
            {
                gamePanel = new JPanel();
                wrapperPanel.add(gamePanel);
                gamePanel.setLayout(new BorderLayout());
                gamePanel.setBackground(java.awt.Color.white);
            }
        }
        {
            glyphCachePanel = new JPanel() {

                private int maxWidth;

                public Dimension getPreferredSize() {
                    // Keep glyphCachePanel width from ever going down so the CanvasGameContainer doesn't change sizes and flicker.
                    Dimension size = super.getPreferredSize();
                    maxWidth = Math.max(maxWidth, size.width);
                    size.width = maxWidth;
                    return size;
                }
            };
            glyphCachePanel.setVisible(false);
            renderingPanel.add(glyphCachePanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
            glyphCachePanel.setLayout(new GridBagLayout());
            {
                glyphCachePanel.add(new JLabel("Glyphs:"), new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            }
            {
                glyphCachePanel.add(new JLabel("Pages:"), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            }
            {
                glyphCachePanel.add(new JLabel("Page width:"), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            }
            {
                glyphCachePanel.add(new JLabel("Page height:"), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            }
            {
                glyphPageWidthCombo = new JComboBox(new DefaultComboBoxModel(new Integer[] { new Integer(32), new Integer(64), new Integer(128), new Integer(256), new Integer(512), new Integer(1024), new Integer(2048) }));
                glyphCachePanel.add(glyphPageWidthCombo, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
                glyphPageWidthCombo.setSelectedIndex(4);
            }
            {
                glyphPageHeightCombo = new JComboBox(new DefaultComboBoxModel(new Integer[] { new Integer(32), new Integer(64), new Integer(128), new Integer(256), new Integer(512), new Integer(1024), new Integer(2048) }));
                glyphCachePanel.add(glyphPageHeightCombo, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
                glyphPageHeightCombo.setSelectedIndex(4);
            }
            {
                resetCacheButton = new JButton("Reset Cache");
                glyphCachePanel.add(resetCacheButton, new GridBagConstraints(0, 6, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            }
            {
                glyphPagesTotalLabel = new JLabel("1");
                glyphCachePanel.add(glyphPagesTotalLabel, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            {
                glyphsTotalLabel = new JLabel("0");
                glyphCachePanel.add(glyphsTotalLabel, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            {
                glyphPageComboModel = new DefaultComboBoxModel();
                glyphPageCombo = new JComboBox();
                glyphCachePanel.add(glyphPageCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
                glyphPageCombo.setModel(glyphPageComboModel);
            }
            {
                glyphCachePanel.add(new JLabel("View:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            }
        }
        {
            JPanel radioButtonsPanel = new JPanel();
            renderingPanel.add(radioButtonsPanel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
            radioButtonsPanel.setLayout(new GridBagLayout());
            {
                sampleTextRadio = new JRadioButton("Sample text");
                radioButtonsPanel.add(sampleTextRadio, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
                sampleTextRadio.setSelected(true);
            }
            {
                glyphCacheRadio = new JRadioButton("Glyph cache");
                radioButtonsPanel.add(glyphCacheRadio, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            {
                radioButtonsPanel.add(new JLabel("Background:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
            }
            {
                backgroundColorLabel = new JLabel();
                radioButtonsPanel.add(backgroundColorLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0));
            }
            ButtonGroup buttonGroup = new ButtonGroup();
            buttonGroup.add(glyphCacheRadio);
            buttonGroup.add(sampleTextRadio);
        }
    }
    JPanel rightSidePanel = new JPanel();
    rightSidePanel.setLayout(new GridBagLayout());
    getContentPane().add(rightSidePanel, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    {
        JPanel paddingPanel = new JPanel();
        paddingPanel.setLayout(new GridBagLayout());
        rightSidePanel.add(paddingPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
        paddingPanel.setBorder(BorderFactory.createTitledBorder("Padding"));
        {
            padTopSpinner = new JSpinner(new SpinnerNumberModel(1, 0, 999, 1));
            paddingPanel.add(padTopSpinner, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
            ((JSpinner.DefaultEditor) padTopSpinner.getEditor()).getTextField().setColumns(2);
        }
        {
            padRightSpinner = new JSpinner(new SpinnerNumberModel(1, 0, 999, 1));
            paddingPanel.add(padRightSpinner, new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
            ((JSpinner.DefaultEditor) padRightSpinner.getEditor()).getTextField().setColumns(2);
        }
        {
            padLeftSpinner = new JSpinner(new SpinnerNumberModel(1, 0, 999, 1));
            paddingPanel.add(padLeftSpinner, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0));
            ((JSpinner.DefaultEditor) padLeftSpinner.getEditor()).getTextField().setColumns(2);
        }
        {
            padBottomSpinner = new JSpinner(new SpinnerNumberModel(1, 0, 999, 1));
            paddingPanel.add(padBottomSpinner, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
            ((JSpinner.DefaultEditor) padBottomSpinner.getEditor()).getTextField().setColumns(2);
        }
        {
            JPanel advancePanel = new JPanel();
            FlowLayout advancePanelLayout = new FlowLayout();
            advancePanel.setLayout(advancePanelLayout);
            paddingPanel.add(advancePanel, new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
            {
                advancePanel.add(new JLabel("X:"));
            }
            {
                padAdvanceXSpinner = new JSpinner(new SpinnerNumberModel(-2, -999, 999, 1));
                advancePanel.add(padAdvanceXSpinner);
                ((JSpinner.DefaultEditor) padAdvanceXSpinner.getEditor()).getTextField().setColumns(2);
            }
            {
                advancePanel.add(new JLabel("Y:"));
            }
            {
                padAdvanceYSpinner = new JSpinner(new SpinnerNumberModel(-2, -999, 999, 1));
                advancePanel.add(padAdvanceYSpinner);
                ((JSpinner.DefaultEditor) padAdvanceYSpinner.getEditor()).getTextField().setColumns(2);
            }
        }
    }
    {
        effectsPanel = new JPanel();
        effectsPanel.setLayout(new GridBagLayout());
        rightSidePanel.add(effectsPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
        effectsPanel.setBorder(BorderFactory.createTitledBorder("Effects"));
        effectsPanel.setMinimumSize(new Dimension(210, 1));
        {
            effectsScroll = new JScrollPane();
            effectsPanel.add(effectsScroll, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
            {
                effectsListModel = new DefaultComboBoxModel();
                effectsList = new JList();
                effectsScroll.setViewportView(effectsList);
                effectsList.setModel(effectsListModel);
                effectsList.setVisibleRowCount(7);
                effectsScroll.setMinimumSize(effectsList.getPreferredScrollableViewportSize());
            }
        }
        {
            addEffectButton = new JButton("Add");
            effectsPanel.add(addEffectButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 6, 5), 0, 0));
            addEffectButton.setEnabled(false);
        }
        {
            appliedEffectsScroll = new JScrollPane();
            effectsPanel.add(appliedEffectsScroll, new GridBagConstraints(1, 3, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));
            appliedEffectsScroll.setBorder(new EmptyBorder(0, 0, 0, 0));
            appliedEffectsScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            {
                JPanel panel = new JPanel();
                panel.setLayout(new GridBagLayout());
                appliedEffectsScroll.setViewportView(panel);
                {
                    appliedEffectsPanel = new JPanel();
                    appliedEffectsPanel.setLayout(new GridBagLayout());
                    panel.add(appliedEffectsPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
                    appliedEffectsPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, java.awt.Color.black));
                }
            }
        }
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JCheckBox(javax.swing.JCheckBox) JTextPane(javax.swing.JTextPane) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) JSpinner(javax.swing.JSpinner) EmptyBorder(javax.swing.border.EmptyBorder) JList(javax.swing.JList)

Aggregations

ButtonGroup (javax.swing.ButtonGroup)339 JPanel (javax.swing.JPanel)202 JRadioButton (javax.swing.JRadioButton)186 JLabel (javax.swing.JLabel)148 ActionEvent (java.awt.event.ActionEvent)134 ActionListener (java.awt.event.ActionListener)118 BoxLayout (javax.swing.BoxLayout)83 GridBagLayout (java.awt.GridBagLayout)81 JButton (javax.swing.JButton)75 JTextField (javax.swing.JTextField)70 JMenu (javax.swing.JMenu)69 GridBagConstraints (java.awt.GridBagConstraints)67 BorderLayout (java.awt.BorderLayout)64 Insets (java.awt.Insets)64 Dimension (java.awt.Dimension)58 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)57 FlowLayout (java.awt.FlowLayout)53 JMenuItem (javax.swing.JMenuItem)50 JCheckBox (javax.swing.JCheckBox)47 JScrollPane (javax.swing.JScrollPane)47