Example usage for javax.swing JCheckBox JCheckBox

List of usage examples for javax.swing JCheckBox JCheckBox

Introduction

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

Prototype

public JCheckBox() 

Source Link

Document

Creates an initially unselected check box button with no text, no icon.

Usage

From source file:de.xplib.xdbm.ui.Application.java

/**
 * Sets global user interface options.//from   ww w . j  a va  2s.  co m
 */
private void configureUI() {

    Options.setDefaultIconSize(new Dimension(18, 18));

    // Set font options      
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings.isUseSystemFonts());
    Options.setGlobalFontSizeHints(settings.getFontSizeHints());
    Options.setUseNarrowButtons(settings.isUseNarrowButtons());
    Options.setPopupDropShadowEnabled(settings.isPopupDropShadowEnabled().booleanValue());

    // Global options
    Options.setTabIconsEnabled(settings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled());

    // Swing Settings
    LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setMyCurrentTheme(settings.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(settings.isPlasticHighContrastFocusEnabled());
    } else if (selectedLaf.getClass() == MetalLookAndFeel.class) {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }

    // Work around caching in MetalRadioButtonUI
    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);

    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        System.out.println("Can't change L&F: " + e);
    }
}

From source file:net.sf.profiler4j.console.ClassListPanel.java

/**
 * This method initializes onlyInstrumentedCheckBox
 * //from   ww  w. j a  v  a  2s .c o  m
 * @return javax.swing.JCheckBox
 */
private JCheckBox getOnlyInstrumentedCheckBox() {
    if (onlyInstrumentedCheckBox == null) {
        onlyInstrumentedCheckBox = new JCheckBox();
        onlyInstrumentedCheckBox.setText("Only Instrumented");
        onlyInstrumentedCheckBox.setSelected(false);
        onlyInstrumentedCheckBox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent e) {
                refreshClassList();
            }
        });
    }
    return onlyInstrumentedCheckBox;
}

From source file:davmail.ui.SettingsFrame.java

protected JPanel getProxyPanel() {
    JPanel proxyPanel = new JPanel(new GridLayout(7, 2));
    proxyPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_PROXY")));

    boolean useSystemProxies = Settings.getBooleanProperty("davmail.useSystemProxies", Boolean.FALSE);
    boolean enableProxy = Settings.getBooleanProperty("davmail.enableProxy");
    useSystemProxiesField = new JCheckBox();
    useSystemProxiesField.setSelected(useSystemProxies);
    enableProxyField = new JCheckBox();
    enableProxyField.setSelected(enableProxy);
    httpProxyField = new JTextField(Settings.getProperty("davmail.proxyHost"), 15);
    httpProxyPortField = new JTextField(Settings.getProperty("davmail.proxyPort"), 4);
    httpProxyUserField = new JTextField(Settings.getProperty("davmail.proxyUser"), 10);
    httpProxyPasswordField = new JPasswordField(Settings.getProperty("davmail.proxyPassword"), 10);
    noProxyForField = new JTextField(Settings.getProperty("davmail.noProxyFor"), 15);

    enableProxyField.setEnabled(!useSystemProxies);
    httpProxyField.setEnabled(enableProxy);
    httpProxyPortField.setEnabled(enableProxy);
    httpProxyUserField.setEnabled(enableProxy || useSystemProxies);
    httpProxyPasswordField.setEnabled(enableProxy || useSystemProxies);
    noProxyForField.setEnabled(enableProxy || useSystemProxies);

    useSystemProxiesField.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            boolean newUseSystemProxies = useSystemProxiesField.isSelected();
            boolean newEnableProxy = enableProxyField.isSelected();
            enableProxyField.setEnabled(!newUseSystemProxies);
            httpProxyField.setEnabled(!newUseSystemProxies && newEnableProxy);
            httpProxyPortField.setEnabled(!newUseSystemProxies && newEnableProxy);
            httpProxyUserField.setEnabled(newUseSystemProxies || newEnableProxy);
            httpProxyPasswordField.setEnabled(newUseSystemProxies || newEnableProxy);
            noProxyForField.setEnabled(newUseSystemProxies || newEnableProxy);
        }//  ww  w. j  a v a 2 s. c o m
    });
    enableProxyField.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            boolean newEnableProxy = enableProxyField.isSelected();
            httpProxyField.setEnabled(newEnableProxy);
            httpProxyPortField.setEnabled(newEnableProxy);
            httpProxyUserField.setEnabled(newEnableProxy);
            httpProxyPasswordField.setEnabled(newEnableProxy);
            noProxyForField.setEnabled(newEnableProxy);
        }
    });

    addSettingComponent(proxyPanel, BundleMessage.format("UI_USE_SYSTEM_PROXIES"), useSystemProxiesField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_ENABLE_PROXY"), enableProxyField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_SERVER"), httpProxyField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_PORT"), httpProxyPortField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_USER"), httpProxyUserField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_PASSWORD"), httpProxyPasswordField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_NO_PROXY"), noProxyForField);
    updateMaximumSize(proxyPanel);
    return proxyPanel;
}

From source file:brainflow.app.toplevel.BrainFlow.java

private ButtonFactory createToolBarButtonFactory() {
    return new ButtonFactory() {
        @Override//  w  w  w  . j ava  2  s  .c  o  m
        public JButton createButton() {
            JideButton button = new JideButton();
            button.setButtonStyle(JideButton.TOOLBAR_STYLE);
            button.setText("");
            return button;
        }

        @Override
        public AbstractButton createToggleButton() {
            return new JideToggleButton();

        }

        @Override
        public JCheckBox createCheckBox() {
            return new JCheckBox();
        }

        @Override
        public JRadioButton createRadioButton() {
            return new JRadioButton();
        }
    };

}

From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectCreate.java

/**
 * This method initializes jCheckBoxClonedFrom   
 *    /*from  www.ja  v a  2  s .  co  m*/
 * @return javax.swing.JCheckBox   
 */
private JCheckBox getJCheckBoxClonedFrom() {
    if (jCheckBoxClonedFrom == null) {
        jCheckBoxClonedFrom = new JCheckBox();
        jCheckBoxClonedFrom.setText("Cloned From:");
        jCheckBoxClonedFrom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                log.debug("jCheckBoxClonedFrom.actionPerformed()");
                eventHandler.handleEvent(EventHandler.OPT_CLONED_FROM);
            }
        });
    }
    return jCheckBoxClonedFrom;
}

From source file:com.atlassian.theplugin.idea.config.serverconfig.GenericServerConfigForm.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from w  w w  .j  av  a2s.  c  o m
 */
private void $$$setupUI$$$() {
    rootComponent = new JPanel();
    rootComponent.setLayout(new GridBagLayout());
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(7, 3, new Insets(0, 0, 0, 0), -1, -1));
    GridBagConstraints gbc;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    rootComponent.add(panel1, gbc);
    serverName = new JTextField();
    serverName.setText("");
    panel1.add(serverName,
            new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setHorizontalAlignment(4);
    label1.setHorizontalTextPosition(4);
    label1.setText("Server Name:");
    label1.setDisplayedMnemonic('S');
    label1.setDisplayedMnemonicIndex(0);
    panel1.add(label1,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(80, -1),
                    new Dimension(92, 16), null, 0, false));
    serverUrl = new JTextField();
    panel1.add(serverUrl,
            new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    username = new JTextField();
    panel1.add(username,
            new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    password = new JPasswordField();
    panel1.add(password,
            new GridConstraints(4, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setHorizontalAlignment(4);
    label2.setText("Server URL:");
    label2.setDisplayedMnemonic('U');
    label2.setDisplayedMnemonicIndex(7);
    panel1.add(label2,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(80, -1),
                    new Dimension(92, 16), null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setHorizontalAlignment(4);
    label3.setText("Username:");
    label3.setDisplayedMnemonic('N');
    label3.setDisplayedMnemonicIndex(4);
    panel1.add(label3,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(92, 16), null, 0, false));
    final JLabel label4 = new JLabel();
    label4.setHorizontalAlignment(4);
    label4.setText("Password:");
    label4.setDisplayedMnemonic('P');
    label4.setDisplayedMnemonicIndex(0);
    panel1.add(label4,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(92, 16), null, 0, false));
    testConnection = new JButton();
    testConnection.setText("Test Connection");
    testConnection.setMnemonic('T');
    testConnection.setDisplayedMnemonicIndex(0);
    panel1.add(testConnection,
            new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_NORTHEAST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    //      chkPasswordRemember = new JCheckBox();
    //      chkPasswordRemember.setSelected(true);
    //      chkPasswordRemember.setText("Remember Password");
    //      chkPasswordRemember.setMnemonic('R');
    //      chkPasswordRemember.setDisplayedMnemonicIndex(0);
    //      panel1.add(chkPasswordRemember, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
    //            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED,
    //            null, null, null, 0, false));
    cbEnabled = new JCheckBox();
    cbEnabled.setEnabled(false);
    cbEnabled.setHorizontalTextPosition(11);
    cbEnabled.setText("Server Enabled");
    cbEnabled.setMnemonic('E');
    cbEnabled.setDisplayedMnemonicIndex(7);
    panel1.add(cbEnabled,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(115, 25), null, 0, false));
    useDefault = new JCheckBox();
    useDefault.setText("Use Default Credentials");
    panel1.add(useDefault,
            new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel spacer1 = new JPanel();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.VERTICAL;
    rootComponent.add(spacer1, gbc);
    label1.setLabelFor(serverName);
    label2.setLabelFor(serverUrl);
    label3.setLabelFor(username);
    label4.setLabelFor(password);
}

From source file:coolmap.canvas.datarenderer.renderer.impl.NumberToColor.java

public NumberToColor() {
    setName("Number to Color");
    setDescription("Use color to represent numeric values");

    //initialize UI
    configUI.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;//from   w ww .ja va2s  .  c o  m
    c.gridy = 0;
    c.ipadx = 5;
    c.ipady = 5;
    c.insets = new Insets(5, 5, 5, 5);
    c.gridwidth = 2;
    //        c.weightx = 0.8;

    editor = new GradientEditorPanel();
    configUI.add(editor, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    //        JButton button = new JButton("Apply");
    //        configUI.add(button, c);
    //        button.setToolTipText("Apply preset gradient");
    //
    //        button.addActionListener(new ActionListener() {
    //
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //
    //                try {
    //                    GradientItem item = (GradientItem) presetColorComboBox.getSelectedItem();
    //
    //                    editor.clearColors();
    //
    //                    Color c[] = item.getColors();
    //                    float p[] = item.getPositions();
    //
    //                    editor.setStart(c[0]);
    //                    editor.setEnd(c[c.length - 1]);
    //
    //                    if (c.length > 2) {
    //                        for (int i = 1; i < c.length - 1; i++) {
    //                            editor.addColor(c[i], p[i]);
    //                        }
    //                    }
    //
    //                } catch (Exception ex) {
    //                    editor.clearColors();
    //                    editor.setStart(DEFAULT_MIN_COLOR);
    //                    editor.setEnd(DEFAULT_MAX_COLOR);
    //                }
    //
    //                updateRenderer();
    //            }
    //        });
    configUI.add(new JLabel("Preset palette:"), c);

    c.gridx = 1;
    c.gridwidth = 1;
    presetColorComboBox = new JComboBox();

    presetColorComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {

            try {
                GradientItem item = (GradientItem) presetColorComboBox.getSelectedItem();
                presetColorComboBox.setToolTipText(item.getToolTip());

                editor.clearColors();

                Color c[] = item.getColors();
                float p[] = item.getPositions();

                editor.setStart(c[0]);
                editor.setEnd(c[c.length - 1]);

                if (c.length > 2) {
                    for (int i = 1; i < c.length - 1; i++) {
                        editor.addColor(c[i], p[i]);
                    }
                }

                try {
                    Double[] ranges = item.getRanges();
                    if (ranges != null) {
                        minValueField.setText(ranges[0].toString());
                        maxValueField.setText(ranges[1].toString());
                        editor.setMinValue(ranges[0].floatValue());
                        editor.setMaxValue(ranges[1].floatValue());
                    }
                } catch (Exception ex) {
                    minValueField.setText("-1");
                    maxValueField.setText("1");
                    editor.setMinValue(-1);
                    editor.setMaxValue(1);
                }

            } catch (Exception ex) {
                editor.clearColors();
                editor.setStart(DEFAULT_MIN_COLOR);
                editor.setEnd(DEFAULT_MAX_COLOR);
            }
        }
    });

    //       
    configUI.add(presetColorComboBox, c);
    presetColorComboBox.setRenderer(new GradientComboItemRenderer());

    presetColorComboBox
            .addItem(new GradientItem(new Color[] { DEFAULT_MIN_COLOR, Color.BLACK, DEFAULT_MAX_COLOR },
                    new float[] { 0f, 0.5f, 1f }, "TBP", "Teal - Black - Pink"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.GREEN, Color.RED }, new float[] { 0f, 1f },
            "GR", "Green - Red"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.GREEN, Color.BLACK, Color.RED },
            new float[] { 0f, 0.5f, 1f }, "RBG", "Red - Black - Green"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.ORANGE, Color.BLUE },
            new float[] { 0f, 1f }, "OB", "Orange - Blue"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.ORANGE, Color.BLACK, Color.BLUE },
            new float[] { 0f, 0.5f, 1f }, "OBB", "Orange - Black - Blue"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.BLACK, Color.GREEN },
            new float[] { 0f, 1f }, "BG", "Black - Green"));

    presetColorComboBox
            .addItem(new GradientItem(new Color[] { Color.RED, UI.colorAKABENI, Color.BLACK, Color.BLACK },
                    new float[] { 0f, 0.05f, 0.051f, 1f }, "P.05", 0d, 1d, "P-value @ 0.05, Red to Black"));

    presetColorComboBox.setToolTipText(((GradientItem) presetColorComboBox.getSelectedItem()).getToolTip());

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    //        button = new JButton("Apply");
    //        
    //        button.setToolTipText("Apply preset data ranges");
    //        button.addActionListener(new ActionListener() {
    //
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //                try {
    //                    MinMaxItem item = (MinMaxItem) (presetRangeComboBox.getSelectedItem());
    //                    minValueField.setText(item.getMinMax().lowerEndpoint().toString());
    //                    maxValueField.setText(item.getMinMax().upperEndpoint().toString());
    //                } catch (Exception ex) {
    //                    minValueField.setText("-1");
    //                    maxValueField.setText("1");
    //                }
    //
    //                updateRenderer();
    //            }
    //        });
    //        configUI.add(button, c);
    configUI.add(new JLabel("Preset range:"), c);

    c.gridx = 1;
    c.gridwidth = 1;
    presetRangeComboBox = new JComboBox();
    configUI.add(presetRangeComboBox, c);
    presetRangeComboBox.addItem(new DataMinMaxItem());
    presetRangeComboBox.addItem(new DefinedMinMaxItem(-1, 1));
    presetRangeComboBox.addItem(new DefinedMinMaxItem(0, 1));
    presetRangeComboBox.addItem(new DefinedMinMaxItem(-1, 0));
    presetRangeComboBox.addItem(new DefinedMinMaxItem(0, 100));

    presetRangeComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                MinMaxItem item = (MinMaxItem) (presetRangeComboBox.getSelectedItem());
                minValueField.setText(item.getMinMax().lowerEndpoint().toString());
                maxValueField.setText(item.getMinMax().upperEndpoint().toString());
            } catch (Exception ex) {
                minValueField.setText("-1");
                maxValueField.setText("1");
            }
        }
    });

    ////////////////////////////////////////////////////////////////////////////////
    //        c.weightx = 0.2;
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(new JLabel("Min value: "), c);
    c.gridx = 1;
    //        c.weightx = 0.3;
    configUI.add(minValueField, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(new JLabel("Max value: "), c);
    c.gridx = 1;
    configUI.add(maxValueField, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    JLabel label = Tools.createJLabel("Draw Sub-heatmap:", null,
            "Draw sub-heatmaps for collapsed ontology nodes", null);
    configUI.add(label, c);

    c.gridx = 1;
    drawSubMap = new JCheckBox();
    configUI.add(drawSubMap, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 3;

    JButton button = new JButton("Update", UI.getImageIcon("refresh"));
    configUI.add(button, c);
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //hit button, redraw!

            updateRenderer();
        }
    });

    //        editor.applyButton.addActionListener(new ActionListener() {
    //
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //                updateRenderer();
    //            }
    //        });
    toolTipLabel = new JLabel();
    toolTipLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    toolTipLabel.setBackground(UI.colorGrey3);
    toolTipLabel.setOpaque(true);
    toolTipLabel.setForeground(UI.colorBlack2);
    toolTipLabel.setFont(UI.fontPlain.deriveFont(12f));
}

From source file:org.pf.midea.MainUI.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    menuMain = new JMenuBar();
    menuFile = new JMenu();
    menuItemQuit = new JMenuItem();
    menuTools = new JMenu();
    menuConstellations = new JMenu();
    menuItemASK = new JMenuItem();
    menuItemFSK = new JMenuItem();
    menuItemBPSK = new JMenuItem();
    menuItemQPSK = new JMenuItem();
    menuItem8PSK = new JMenuItem();
    menuItem16PSK = new JMenuItem();
    menuItem32PSK = new JMenuItem();
    menuItem16QAM = new JMenuItem();
    menuItem32QAM = new JMenuItem();
    menuItem64QAM = new JMenuItem();
    menuItem256QAM = new JMenuItem();
    menuHelp = new JMenu();
    menuItemAbout = new JMenuItem();
    labelSource = new JLabel();
    SourceCell[] sourceCells = { new SourceCell(PlanStates.SourceType.ST_TEST),
            new SourceCell(PlanStates.SourceType.ST_RANDOM) };
    chooserSource = new JComboBox(sourceCells);
    chooserSource.setRenderer(new SourceCellRenderer());
    buttonAddToPlan = new JButton();
    panelPlan = new JPanel();
    scrollPane1 = new JScrollPane();
    listPlan = new JList();
    labelCode = new JLabel();
    CodeCell[] codeCells = { new CodeCell(PlanStates.CodeType.CT_NONE),
            new CodeCell(PlanStates.CodeType.CT_HAMMING74), new CodeCell(PlanStates.CodeType.CT_CYCLIC),
            new CodeCell(PlanStates.CodeType.CT_BCH155) };
    chooserCode = new JComboBox(codeCells);
    chooserCode.setRenderer(new CodeCellRenderer());
    labelModulation = new JLabel();
    ModulationCell[] modulationCells = { new ModulationCell(PlanStates.ModulationType.MT_ASK),
            new ModulationCell(PlanStates.ModulationType.MT_FSK),
            new ModulationCell(PlanStates.ModulationType.MT_BPSK),
            new ModulationCell(PlanStates.ModulationType.MT_QPSK),
            new ModulationCell(PlanStates.ModulationType.MT_8PSK),
            new ModulationCell(PlanStates.ModulationType.MT_16PSK),
            new ModulationCell(PlanStates.ModulationType.MT_32PSK),
            new ModulationCell(PlanStates.ModulationType.MT_16QAM),
            new ModulationCell(PlanStates.ModulationType.MT_32QAM),
            new ModulationCell(PlanStates.ModulationType.MT_64QAM),
            new ModulationCell(PlanStates.ModulationType.MT_256QAM) };
    chooserModulation = new JComboBox(modulationCells);
    chooserModulation.setRenderer(new ModulationCellRenderer());
    labelChannel = new JLabel();
    ChannelCell[] channelCells = { new ChannelCell(PlanStates.ChannelType.CHT_AWGN),
            new ChannelCell(PlanStates.ChannelType.CHT_RAYLEIGH) };
    chooserChannel = new JComboBox(channelCells);
    chooserChannel.setRenderer(new ChannelCellRenderer());
    buttonClearPlan = new JButton();
    labelErrors = new JLabel();
    ErrorsCell[] errorCells = { new ErrorsCell(PlanStates.ErrorsType.ET_SER),
            new ErrorsCell(PlanStates.ErrorsType.ET_BER) };
    chooserErrors = new JComboBox(errorCells);
    chooserErrors.setRenderer(new ErrorsCellRenderer());
    labelLineWidth = new JLabel();
    spinnerLineWidth = new JSpinner();
    buttonRemoveFromPlan = new JButton();
    labelLineColor = new JLabel();
    ColorCell[] colorCells = { new ColorCell(null), new ColorCell(Color.black), new ColorCell(Color.red),
            new ColorCell(Color.green), new ColorCell(Color.blue) };
    chooserLineColor = new JComboBox(colorCells);
    chooserLineColor.setRenderer(new ColorCellRenderer());
    labelHSquare = new JLabel();
    spinnerHSquareLow = new JSpinner();
    labelEllipsis = new JLabel();
    spinnerHSquareHigh = new JSpinner();
    panelInner1 = new JPanel();
    labelHSquareStep = new JLabel();
    spinnerHSquareStep = new JSpinner();
    labelMeasurementUnit = new JLabel();
    radioButtonMeasurementUnitTimes = new JRadioButton();
    radioButtonMeasurementUnitdB = new JRadioButton();
    buttonRunSimulation = new JButton();
    labelIterations = new JLabel();
    spinnerIterations = new JSpinner();
    checkBoxShowLineNumbers = new JCheckBox();
    tabbedPaneResults = new JTabbedPane();
    panelChart = new JPanel();
    panelNumeric = new JPanel();
    scrollPane2 = new JScrollPane();
    textAreaNumeric = new JTextArea();
    progressBar = new JProgressBar();

    //======== this ========
    setLayout(new FormLayout("3*(default, $lcgap), 36dlu, $lcgap, 122dlu:grow",
            "[21px,default], 9*($lgap, default), $lgap, default:grow, $lgap, default"));

    //======== menuMain ========
    {/*from  w w  w .j  a v a2s.  com*/

        //======== menuFile ========
        {
            menuFile.setText("\u0424\u0430\u0439\u043b");

            //---- menuItemQuit ----
            menuItemQuit.setText("\u0412\u0438\u0439\u0442\u0438");
            menuItemQuit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_MASK));
            menuItemQuit.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItemQuitActionPerformed(e);
                }
            });
            menuFile.add(menuItemQuit);
        }
        menuMain.add(menuFile);

        //======== menuTools ========
        {
            menuTools.setText("\u0406\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438");

            //======== menuConstellations ========
            {
                menuConstellations.setText(
                        "\u0421\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u0456 \u0441\u0443\u0437\u0456\u0440\u2019\u044f");

                //---- menuItemASK ----
                menuItemASK.setText("\u0410\u041c\u043d\u2026");
                menuItemASK.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItemASKActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItemASK);

                //---- menuItemFSK ----
                menuItemFSK.setText("\u0427\u041c\u043d\u2026");
                menuItemFSK.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItemFSKActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItemFSK);

                //---- menuItemBPSK ----
                menuItemBPSK.setText("\u0424\u041c\u043d\u2026");
                menuItemBPSK.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItemBPSKActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItemBPSK);

                //---- menuItemQPSK ----
                menuItemQPSK.setText("\u0424\u041c-4\u2026");
                menuItemQPSK.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItemQPSKActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItemQPSK);

                //---- menuItem8PSK ----
                menuItem8PSK.setText("\u0424\u041c-8\u2026");
                menuItem8PSK.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem8PSKActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItem8PSK);

                //---- menuItem16PSK ----
                menuItem16PSK.setText("\u0424\u041c-16\u2026");
                menuItem16PSK.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem16PSKActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItem16PSK);

                //---- menuItem32PSK ----
                menuItem32PSK.setText("\u0424\u041c-32\u2026");
                menuItem32PSK.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem32PSKActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItem32PSK);

                //---- menuItem16QAM ----
                menuItem16QAM.setText("\u041a\u0410\u041c-16\u2026");
                menuItem16QAM.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem16QAMActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItem16QAM);

                //---- menuItem32QAM ----
                menuItem32QAM.setText("\u041a\u0410\u041c-32\u2026");
                menuItem32QAM.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem32QAMActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItem32QAM);

                //---- menuItem64QAM ----
                menuItem64QAM.setText("\u041a\u0410\u041c-64\u2026");
                menuItem64QAM.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem64QAMActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItem64QAM);

                //---- menuItem256QAM ----
                menuItem256QAM.setText("\u041a\u0410\u041c-256\u2026");
                menuItem256QAM.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem256QAMActionPerformed(e);
                    }
                });
                menuConstellations.add(menuItem256QAM);
            }
            menuTools.add(menuConstellations);
        }
        menuMain.add(menuTools);

        //======== menuHelp ========
        {
            menuHelp.setText("\u0414\u043e\u0432\u0456\u0434\u043a\u0430");

            //---- menuItemAbout ----
            menuItemAbout.setText("\u041f\u0440\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0443\u2026");
            menuItemAbout.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItemAboutActionPerformed(e);
                }
            });
            menuHelp.add(menuItemAbout);
        }
        menuMain.add(menuHelp);
    }
    add(menuMain, CC.xywh(1, 1, 9, 1, CC.FILL, CC.FILL));

    //---- labelSource ----
    labelSource.setText("\u0414\u0436\u0435\u0440\u0435\u043b\u043e:");
    add(labelSource, CC.xy(1, 3));
    add(chooserSource, CC.xy(3, 3));

    //---- buttonAddToPlan ----
    buttonAddToPlan.setText("\u2192");
    buttonAddToPlan.setToolTipText(
            "\u0414\u043e\u0434\u0430\u0442\u0438 \u0434\u043e \u043f\u043b\u0430\u043d\u0443 \u0435\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0443");
    buttonAddToPlan.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            buttonAddToPlanActionPerformed(e);
        }
    });
    add(buttonAddToPlan, CC.xywh(5, 3, 1, 5));

    //======== panelPlan ========
    {
        panelPlan.setLayout(new GridLayout());

        //======== scrollPane1 ========
        {
            scrollPane1.setViewportView(listPlan);
        }
        panelPlan.add(scrollPane1);
    }
    add(panelPlan, CC.xywh(7, 3, 3, 13));

    //---- labelCode ----
    labelCode.setText("\u041a\u043e\u0434:");
    add(labelCode, CC.xy(1, 5));
    add(chooserCode, CC.xy(3, 5));

    //---- labelModulation ----
    labelModulation.setText("\u041c\u043e\u0434\u0443\u043b\u044f\u0446\u0456\u044f:");
    add(labelModulation, CC.xy(1, 7));
    add(chooserModulation, CC.xy(3, 7));

    //---- labelChannel ----
    labelChannel.setText("\u041a\u0430\u043d\u0430\u043b:");
    add(labelChannel, CC.xy(1, 9));
    add(chooserChannel, CC.xy(3, 9));

    //---- buttonClearPlan ----
    buttonClearPlan.setText("X");
    buttonClearPlan.setToolTipText(
            "\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u0438 \u043f\u043b\u0430\u043d \u0435\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0443");
    buttonClearPlan.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            buttonClearPlanActionPerformed(e);
        }
    });
    add(buttonClearPlan, CC.xy(5, 9));

    //---- labelErrors ----
    labelErrors.setText("\u041f\u043e\u043c\u0438\u043b\u043a\u0438:");
    add(labelErrors, CC.xy(1, 11));
    add(chooserErrors, CC.xy(3, 11));

    //---- labelLineWidth ----
    labelLineWidth.setText("\u0422\u043e\u0432\u0449\u0438\u043d\u0430 \u043b\u0456\u043d\u0456\u0457:");
    add(labelLineWidth, CC.xy(1, 13));

    //---- spinnerLineWidth ----
    spinnerLineWidth.setModel(new SpinnerNumberModel(2, 1, 5, 1));
    add(spinnerLineWidth, CC.xy(3, 13));

    //---- buttonRemoveFromPlan ----
    buttonRemoveFromPlan.setText("\u2190");
    buttonRemoveFromPlan.setToolTipText(
            "\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0437 \u043f\u043b\u0430\u043d\u0443 \u0435\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0443");
    buttonRemoveFromPlan.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            buttonRemoveFromPlanActionPerformed(e);
        }
    });
    add(buttonRemoveFromPlan, CC.xywh(5, 11, 1, 5));

    //---- labelLineColor ----
    labelLineColor.setText("\u041a\u043e\u043b\u0456\u0440 \u043b\u0456\u043d\u0456\u0457:");
    add(labelLineColor, CC.xy(1, 15));
    add(chooserLineColor, CC.xy(3, 15));

    //---- labelHSquare ----
    labelHSquare.setText("h\u00b2=");
    add(labelHSquare, CC.xy(1, 17));

    //---- spinnerHSquareLow ----
    spinnerHSquareLow.setModel(new SpinnerNumberModel(0.0, null, null, 1.0));
    add(spinnerHSquareLow, CC.xy(3, 17));

    //---- labelEllipsis ----
    labelEllipsis.setText("\u2026");
    add(labelEllipsis, CC.xy(5, 17, CC.CENTER, CC.DEFAULT));

    //---- spinnerHSquareHigh ----
    spinnerHSquareHigh.setModel(new SpinnerNumberModel(15.0, null, null, 1.0));
    add(spinnerHSquareHigh, CC.xy(7, 17));

    //======== panelInner1 ========
    {
        panelInner1.setLayout(new FormLayout("5*(default, $lcgap), default:grow", "default"));

        //---- labelHSquareStep ----
        labelHSquareStep.setText(", \u043a\u0440\u043e\u043a:");
        panelInner1.add(labelHSquareStep, CC.xy(1, 1));

        //---- spinnerHSquareStep ----
        spinnerHSquareStep.setModel(new SpinnerNumberModel(0.5, 0.001, null, 0.1));
        panelInner1.add(spinnerHSquareStep, CC.xy(3, 1));

        //---- labelMeasurementUnit ----
        labelMeasurementUnit.setText(", \u043e\u0434\u0438\u043d\u0438\u0446\u0456:");
        panelInner1.add(labelMeasurementUnit, CC.xy(5, 1));

        //---- radioButtonMeasurementUnitTimes ----
        radioButtonMeasurementUnitTimes.setText("\u0440\u0430\u0437\u0438");
        radioButtonMeasurementUnitTimes.setSelected(true);
        panelInner1.add(radioButtonMeasurementUnitTimes, CC.xy(7, 1, CC.LEFT, CC.DEFAULT));

        //---- radioButtonMeasurementUnitdB ----
        radioButtonMeasurementUnitdB.setText("\u0434\u0411");
        panelInner1.add(radioButtonMeasurementUnitdB, CC.xy(9, 1, CC.LEFT, CC.DEFAULT));

        //---- buttonRunSimulation ----
        buttonRunSimulation.setText("\u0412\u0438\u043a\u043e\u043d\u0430\u0442\u0438");
        buttonRunSimulation.setToolTipText(
                "\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u044e\u0432\u0430\u043d\u043d\u044f");
        buttonRunSimulation.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                buttonRunSimulationActionPerformed(e);
            }
        });
        panelInner1.add(buttonRunSimulation, CC.xy(11, 1, CC.RIGHT, CC.DEFAULT));
    }
    add(panelInner1, CC.xy(9, 17));

    //---- labelIterations ----
    labelIterations.setText("\u0406\u0442\u0435\u0440\u0430\u0446\u0456\u0439:");
    add(labelIterations, CC.xy(1, 19));

    //---- spinnerIterations ----
    spinnerIterations.setModel(new SpinnerNumberModel(200000, 1, null, 50000));
    add(spinnerIterations, CC.xy(3, 19));

    //---- checkBoxShowLineNumbers ----
    checkBoxShowLineNumbers.setText(
            "\u041d\u0443\u043c\u0435\u0440\u0443\u0432\u0430\u0442\u0438 \u0433\u0440\u0430\u0444\u0456\u043a\u0438");
    add(checkBoxShowLineNumbers, CC.xywh(7, 19, 3, 1));

    //======== tabbedPaneResults ========
    {

        //======== panelChart ========
        {
            panelChart.setLayout(new BoxLayout(panelChart, BoxLayout.X_AXIS));
        }
        tabbedPaneResults.addTab("\u0413\u0440\u0430\u0444\u0456\u043a\u0438", panelChart);

        //======== panelNumeric ========
        {
            panelNumeric.setLayout(new FormLayout("default:grow", "default:grow"));

            //======== scrollPane2 ========
            {

                //---- textAreaNumeric ----
                textAreaNumeric.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
                textAreaNumeric.setEditable(false);
                scrollPane2.setViewportView(textAreaNumeric);
            }
            panelNumeric.add(scrollPane2, CC.xy(1, 1, CC.DEFAULT, CC.FILL));
        }
        tabbedPaneResults.addTab("\u0427\u0438\u0441\u043b\u043e\u0432\u0456 \u0434\u0430\u043d\u0456",
                panelNumeric);

    }
    add(tabbedPaneResults, CC.xywh(1, 21, 9, 1, CC.DEFAULT, CC.FILL));
    add(progressBar, CC.xywh(1, 23, 9, 1));

    //---- buttonGroupMeasurementUnit ----
    ButtonGroup buttonGroupMeasurementUnit = new ButtonGroup();
    buttonGroupMeasurementUnit.add(radioButtonMeasurementUnitTimes);
    buttonGroupMeasurementUnit.add(radioButtonMeasurementUnitdB);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.raddle.tools.ClipboardTransferMain.java

private void initGUI() {
    try {//w w w  . ja  v  a  2 s.c  o  m
        {
            this.setTitle("\u8fdc\u7a0b\u526a\u5207\u677f");
            getContentPane().setLayout(null);
            {
                remoteClipGetBtn = new JButton();
                getContentPane().add(remoteClipGetBtn);
                remoteClipGetBtn.setText("\u83b7\u5f97\u8fdc\u7a0b\u526a\u5207\u677f");
                remoteClipGetBtn.setBounds(12, 22, 151, 29);
                remoteClipGetBtn.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        doInSocket(new SocketCallback() {

                            @Override
                            public Object connected(Socket socket) throws Exception {
                                if (!isProcessing) {
                                    isProcessing = true;
                                    try {
                                        ClipCommand cmd = new ClipCommand();
                                        cmd.setCmdCode(ClipCommand.CMD_GET_CLIP);
                                        updateMessage("??");
                                        // ??
                                        ObjectOutputStream out = new ObjectOutputStream(
                                                socket.getOutputStream());
                                        out.writeObject(cmd);
                                        // 
                                        ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
                                        ClipResult result = (ClipResult) in.readObject();
                                        if (result.isSuccess()) {
                                            setLocalClipboard(result);
                                            StringBuilder sb = new StringBuilder();
                                            for (DataFlavor dataFlavor : result.getClipdata().keySet()) {
                                                sb.append("\n");
                                                sb.append(dataFlavor.getPrimaryType()).append("/")
                                                        .append(dataFlavor.getSubType());
                                            }
                                            updateMessage("??? " + sb);
                                        } else {
                                            updateMessage("?:" + result.getMessage());
                                        }
                                        in.close();
                                        out.close();
                                    } catch (Exception e) {
                                        updateMessage("?:" + e.getMessage());
                                    } finally {
                                        isProcessing = false;
                                    }
                                }
                                return null;
                            }
                        });
                    }
                });
            }
            {
                remoteClipSetBtn = new JButton();
                getContentPane().add(remoteClipSetBtn);
                remoteClipSetBtn.setText("\u8bbe\u7f6e\u8fdc\u7a0b\u526a\u5207\u677f");
                remoteClipSetBtn.setBounds(181, 22, 159, 29);
                remoteClipSetBtn.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        setRemoteClipboard(true);
                    }
                });
            }
            {
                serverLeb = new JLabel();
                getContentPane().add(serverLeb);
                serverLeb.setText("\u8fdc\u7a0b\u670d\u52a1\u5668\u5730\u5740(IP:PORT)");
                serverLeb.setBounds(12, 63, 162, 17);
            }
            {
                serverAddrTxt = new JTextField();
                getContentPane().add(serverAddrTxt);
                serverAddrTxt.setBounds(169, 58, 186, 27);
            }
            {
                jLabel1 = new JLabel();
                getContentPane().add(jLabel1);
                jLabel1.setText("\u6d88\u606f\uff1a");
                jLabel1.setBounds(12, 97, 48, 24);
            }
            {
                jLabel2 = new JLabel();
                getContentPane().add(jLabel2);
                jLabel2.setText("\u672c\u5730\u526a\u5207\u677f\u670d\u52a1");
                jLabel2.setBounds(12, 297, 91, 20);
            }
            {
                clipServerStartBtn = new JButton();
                getContentPane().add(clipServerStartBtn);
                clipServerStartBtn.setText("\u542f\u52a8");
                clipServerStartBtn.setBounds(12, 329, 79, 29);
                clipServerStartBtn.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        startServer();
                    }
                });
            }
            {
                clipServerStopBtn = new JButton();
                getContentPane().add(clipServerStopBtn);
                clipServerStopBtn.setText("\u505c\u6b62");
                clipServerStopBtn.setBounds(103, 329, 81, 29);
                clipServerStopBtn.setEnabled(false);
                clipServerStopBtn.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        shutdown();
                    }
                });
            }
            {
                jLabel3 = new JLabel();
                getContentPane().add(jLabel3);
                jLabel3.setText("\u7aef\u53e3\uff1a");
                jLabel3.setBounds(196, 335, 44, 17);
            }
            {
                portTxt = new JTextField();
                getContentPane().add(portTxt);
                portTxt.setText("11221");
                portTxt.setBounds(252, 330, 88, 27);
            }
            {
                modifyClipChk = new JCheckBox();
                getContentPane().add(modifyClipChk);
                modifyClipChk.setText("\u5141\u8bb8\u8fdc\u7a0b\u4fee\u6539\u526a\u5207\u677f");
                modifyClipChk.setBounds(12, 377, 172, 22);
            }
            {
                clearBtn = new JButton();
                getContentPane().add(clearBtn);
                clearBtn.setText("\u6e05\u7a7a\u672c\u5730\u7cfb\u7edf\u526a\u5207\u677f");
                clearBtn.setBounds(196, 374, 159, 29);
                clearBtn.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        Clipboard sysc = Toolkit.getDefaultToolkit().getSystemClipboard();
                        Transferable tText = new StringSelection(null);
                        sysc.setContents(tText, null);
                    }
                });
            }
            {
                autoChk = new JCheckBox();
                autoChk.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        m.setEnabled(autoChk.isSelected());
                    }
                });
                getContentPane().add(autoChk);
                autoChk.setText("\u81ea\u52a8\u8bbe\u7f6e\u8fdc\u7a0b\u526a\u5207\u677f");
                autoChk.setBounds(12, 405, 172, 22);
            }
        }

        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setBounds(55, 97, 542, 199);
        getContentPane().add(scrollPane);
        {
            messageArea = new JTextArea();
            scrollPane.setViewportView(messageArea);
        }
        this.setSize(611, 465);
        {
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:sim.util.media.chart.ChartGenerator.java

/** Generates a new ChartGenerator with a blank chart.  Before anything else, buildChart() is called.  */
public ChartGenerator() {
    // create the chart
    buildChart();//from www.  ja  v  a 2s.  c  o m
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    chart.setAntiAlias(true);

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    split.setBorder(new EmptyBorder(0, 0, 0, 0));
    JScrollPane scroll = new JScrollPane();
    JPanel b = new JPanel();
    b.setLayout(new BorderLayout());
    b.add(seriesAttributes, BorderLayout.NORTH);
    b.add(new JPanel(), BorderLayout.CENTER);
    scroll.getViewport().setView(b);
    scroll.setBackground(getBackground());
    scroll.getViewport().setBackground(getBackground());
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    LabelledList list = new LabelledList("Chart Properties");
    DisclosurePanel pan1 = new DisclosurePanel("Chart Properties", list);
    globalAttributes.add(pan1);

    JLabel j = new JLabel("Right-Click or Control-Click");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);
    j = new JLabel("on Chart for More Options");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);

    titleField = new PropertyField() {
        public String newValue(String newValue) {
            setTitle(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    titleField.setValue(chart.getTitle().getText());

    list.add(new JLabel("Title"), titleField);

    buildGlobalAttributes(list);

    final JCheckBox legendCheck = new JCheckBox();
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                LegendTitle title = new LegendTitle(chart.getPlot());
                title.setLegendItemGraphicPadding(new org.jfree.ui.RectangleInsets(0, 8, 0, 4));
                chart.addLegend(title);
            } else {
                chart.removeLegend();
            }
        }
    };
    legendCheck.addItemListener(il);
    list.add(new JLabel("Legend"), legendCheck);
    legendCheck.setSelected(true);

    /*
      final JCheckBox aliasCheck = new JCheckBox();
      aliasCheck.setSelected(chart.getAntiAlias());
      il = new ItemListener()
      {
      public void itemStateChanged(ItemEvent e)
      {
      chart.setAntiAlias( e.getStateChange() == ItemEvent.SELECTED );
      }
      };
      aliasCheck.addItemListener(il);
      list.add(new JLabel("Antialias"), aliasCheck);
    */

    JPanel pdfButtonPanel = new JPanel();
    pdfButtonPanel.setBorder(new javax.swing.border.TitledBorder("Chart Output"));
    DisclosurePanel pan2 = new DisclosurePanel("Chart Output", pdfButtonPanel);

    pdfButtonPanel.setLayout(new BorderLayout());
    Box pdfbox = new Box(BoxLayout.Y_AXIS);
    pdfButtonPanel.add(pdfbox, BorderLayout.WEST);

    JButton pdfButton = new JButton("Save as PDF");
    pdfbox.add(pdfButton);
    pdfButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            FileDialog fd = new FileDialog(frame, "Choose PDF file...", FileDialog.SAVE);
            fd.setFile(chart.getTitle().getText() + ".pdf");
            fd.setVisible(true);
            String fileName = fd.getFile();
            if (fileName != null) {
                Dimension dim = chartPanel.getPreferredSize();
                PDFEncoder.generatePDF(chart, dim.width, dim.height,
                        new File(fd.getDirectory(), Utilities.ensureFileEndsWith(fd.getFile(), ".pdf")));
            }
        }
    });
    movieButton = new JButton("Create a Movie");
    pdfbox.add(movieButton);
    pdfbox.add(Box.createGlue());
    movieButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (movieMaker == null)
                startMovie();
            else
                stopMovie();
        }
    });

    globalAttributes.add(pan2);

    // we add into an outer box so we can later on add more global seriesAttributes
    // as the user instructs and still have glue be last
    Box outerAttributes = Box.createVerticalBox();
    outerAttributes.add(globalAttributes);
    outerAttributes.add(Box.createGlue());

    p.add(outerAttributes, BorderLayout.NORTH);
    p.add(scroll, BorderLayout.CENTER);
    p.setMinimumSize(new Dimension(0, 0));
    p.setPreferredSize(new Dimension(200, 0));
    split.setLeftComponent(p);

    // Add scale and proportion fields
    Box header = Box.createHorizontalBox();

    final double MAXIMUM_SCALE = 8;

    fixBox = new JCheckBox("Fill");
    fixBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setFixed(fixBox.isSelected());
        }
    });
    header.add(fixBox);
    fixBox.setSelected(true);

    // add the scale field
    scaleField = new NumberTextField("  Scale: ", 1.0, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0)
                newValue = currentValue;
            if (newValue > MAXIMUM_SCALE)
                newValue = currentValue;
            scale = newValue;
            resizeChart();
            return newValue;
        }
    };
    scaleField.setToolTipText("Zoom in and out");
    scaleField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    scaleField.setEnabled(false);
    scaleField.setText("");
    header.add(scaleField);

    // add the proportion field
    proportionField = new NumberTextField("  Proportion: ", 1.5, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0)
                newValue = currentValue;
            proportion = newValue;
            resizeChart();
            return newValue;
        }
    };
    proportionField.setToolTipText("Change the chart proportions (ratio of width to height)");
    proportionField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    header.add(proportionField);

    chartHolder.setMinimumSize(new Dimension(0, 0));
    chartHolder.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    chartHolder.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    chartHolder.getViewport().setBackground(Color.gray);
    JPanel p2 = new JPanel();
    p2.setLayout(new BorderLayout());
    p2.add(chartHolder, BorderLayout.CENTER);
    p2.add(header, BorderLayout.NORTH);
    split.setRightComponent(p2);
    setLayout(new BorderLayout());
    add(split, BorderLayout.CENTER);

    // set the default to be white, which looks good when printed
    chart.setBackgroundPaint(Color.WHITE);

    // JFreeChart has a hillariously broken way of handling font scaling.
    // It allows fonts to scale independently in X and Y.  We hack a workaround here.
    chartPanel.setMinimumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMaximumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMinimumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setMaximumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setPreferredSize(new java.awt.Dimension((int) (DEFAULT_CHART_HEIGHT * DEFAULT_CHART_PROPORTION),
            (int) (DEFAULT_CHART_HEIGHT)));
}