Example usage for java.awt Insets Insets

List of usage examples for java.awt Insets Insets

Introduction

In this page you can find the example usage for java.awt Insets Insets.

Prototype

public Insets(int top, int left, int bottom, int right) 

Source Link

Document

Creates and initializes a new Insets object with the specified top, left, bottom, and right insets.

Usage

From source file:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java

/**
 * Initializes the sms menu.//from  w ww .j  av a2s  . c  o  m
 *
 * @param centerPanel the parent panel
 */
private void initSmsLabel(final JPanel centerPanel) {
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    constraints.insets = new Insets(0, 3, 0, 0);

    ImageID smsIcon = new ImageID("service.gui.icons.SEND_SMS");

    ImageID selectedIcon = new ImageID("service.gui.icons.SEND_SMS_SELECTED");

    smsButton = new SIPCommToggleButton(ImageLoader.getImage(smsIcon), ImageLoader.getImage(selectedIcon),
            ImageLoader.getImage(smsIcon), ImageLoader.getImage(selectedIcon));

    smsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (smsMode && !isIMAllowed()) {
                return;
            }

            smsMode = smsButton.isSelected();

            Color bgColor;
            if (smsMode) {
                bgColor = new Color(GuiActivator.getResources().getColor("service.gui.LIST_SELECTION_COLOR"));

                smsCharCountLabel.setVisible(true);
                smsNumberLabel.setVisible(true);
            } else {
                bgColor = Color.WHITE;
                smsCharCountLabel.setVisible(false);
                smsNumberLabel.setVisible(false);
            }

            centerPanel.setBackground(bgColor);
            editorPane.setBackground(bgColor);
        }
    });

    // We hide the sms label until we know if the chat supports sms.
    smsButton.setVisible(false);

    centerPanel.add(smsButton, constraints);
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java

/**
 * This method initializes jPanelButtons   
 *    // www  . jav a2 s . c om
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelButtons() {
    if (jPanelButtons == null) {
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints2.gridy = 1;
        gridBagConstraints2.gridx = 0;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.insets = new Insets(0, 0, 10, 0);
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.gridx = 0;
        jPanelButtons = new JPanel();
        jPanelButtons.setLayout(new GridBagLayout());
        jPanelButtons.add(getJButtonOK(), gridBagConstraints1);
        jPanelButtons.add(getJButtonCancel(), gridBagConstraints2);
    }
    return jPanelButtons;
}

From source file:es.emergya.ui.base.LoginWindow.java

private void initialize() {
    ventana.getContentPane().removeAll();
    ventana.setLayout(new BorderLayout());
    ventana.setSize(new Dimension(800, 600));

    JPanel panel = new JPanel(new GridBagLayout());
    panel.setBackground(Color.WHITE);

    JPanel logos = new JPanel(new GridLayout(2, 1));
    logos.add(new JLabel(LogicConstants.getIcon("login_logo_cliente")));
    logos.add(new JLabel(LogicConstants.getIcon("login_logo")));
    logos.setBackground(Color.WHITE);

    JLabel label = new JLabel();
    label.setText(i18n.getString("11")); //$NON-NLS-1$

    JLabel labelUsuario = new JLabel();
    labelUsuario.setText(i18n.getString("12")); //$NON-NLS-1$

    JLabel lablep = new JLabel();
    lablep.setText(i18n.getString("13")); //$NON-NLS-1$

    panel.add(logos, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    panel.add(error, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    panel.add(labelUsuario, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    panel.add(usuario, new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    panel.add(lablep, new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    panel.add(pass, new GridBagConstraints(1, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    panel.add(conectando, new GridBagConstraints(0, 4, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    panel.add(login, new GridBagConstraints(1, 6, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0));

    panel.setBorder(new EmptyBorder(100, 100, 100, 100));

    ventana.add(panel, BorderLayout.CENTER);

    JPanel abajo = new JPanel();

    abajo.setLayout(new FlowLayout(FlowLayout.RIGHT));
    abajo.add(version);//from w  w  w.j  a  v  a  2  s . co  m
    abajo.setOpaque(false);
    ventana.add(abajo, BorderLayout.SOUTH);

    try {
        label.setFont(LogicConstants.deriveBoldFont(20.0f));
        labelUsuario.setFont(LogicConstants.deriveBoldFont(20.0f));
        lablep.setFont(LogicConstants.deriveBoldFont(20.0f));
        login.setFont(LogicConstants.deriveBoldFont(20.0f));
        error.setFont(LogicConstants.getBoldFont());
    } catch (Exception e) {
        LOG.error("Error al inicializar el login", e);
    }
    ventana.setLocationRelativeTo(null);
    // ventana.pack();

}

From source file:com.hccl.nlip.GUIMainPanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Super Fan
    bestActionChartPanel = new JPanel();
    consolePanel = new JPanel();
    RLCaptionPanel = new JPanel();
    RLCaption = new JLabel();
    discountLabel = new JLabel();
    discountPanel = new JPanel();
    discountDec = new JButton();
    discountField = new JTextField();
    discountInc = new JButton();
    rewardCollisionLabel = new JLabel();
    rewardCollisionPanel = new JPanel();
    rewardCollisionDec = new JButton();
    rewardCollisionField = new JTextField();
    rewardCollisionInc = new JButton();
    rewadGoalLabel = new JLabel();
    rewardGoalPanel = new JPanel();
    rewardGoalDec = new JButton();
    rewardGoalField = new JTextField();
    rewardGoalInc = new JButton();
    rewardOneStepLabel = new JLabel();
    rewardOneStepPanel = new JPanel();
    rewardOneStepDec = new JButton();
    rewardOneStepField = new JTextField();
    rewardOneStepInc = new JButton();
    fixedEpsilonCheckBox = new JCheckBox();
    fixedEpsilonPanel = new JPanel();
    fixedEpsilonField = new JTextField();
    sepPanel1 = new JPanel();
    separator1 = new JSeparator();
    envCaptionPanel = new JPanel();
    envLabel = new JLabel();
    obstaclesLabel = new JLabel();
    obstaclesPanel = new JPanel();
    obstaclesComboBox = new JComboBox();
    goalsLabel = new JLabel();
    goalsPanel = new JPanel();
    goalsComboBox = new JComboBox();
    sepPanel2 = new JPanel();
    separator2 = new JSeparator();
    controlCaptionPanel = new JPanel();
    controlLabel = new JLabel();
    displayActionsPanel = new JPanel();
    displayActionsCheckBox = new JCheckBox();
    controlActionsPanel = new JPanel();
    stepBtn = new JButton();
    episodeBtn = new JButton();
    animateBtn = new JButton();
    resetBtn = new JButton();
    controlEpisodesPanel = new JPanel();
    performEpisodesBtn = new JButton();
    numberEpisodesField = new JTextField();
    numberEpisodesLabel = new JLabel();
    episodesProgressBar = new JProgressBar();
    sepPanel3 = new JPanel();
    separator3 = new JSeparator();
    totalStepsLabel = new JLabel();
    totalStepsField = new JLabel();
    totalEpisodesLabel = new JLabel();
    totalEpisodesFields = new JLabel();
    totalRewardLabel = new JLabel();
    totalRewardField = new JLabel();
    dicSizeField = new JLabel();
    dicSizeLabel = new JLabel();

    //======== this ========
    setPreferredSize(new Dimension(700, 500));
    setMinimumSize(new Dimension(780, 580));

    setLayout(new GridBagLayout());
    ((GridBagLayout) getLayout()).columnWidths = new int[] { 396, 239, 0 };
    ((GridBagLayout) getLayout()).rowHeights = new int[] { 0, 0 };
    ((GridBagLayout) getLayout()).columnWeights = new double[] { 1.0, 0.0, 1.0E-4 };
    ((GridBagLayout) getLayout()).rowWeights = new double[] { 1.0, 1.0E-4 };

    //======== bestActionChartPanel ========
    {/*from w ww  . j a v  a 2 s .com*/
        bestActionChartPanel.setPreferredSize(new Dimension(250, 250));
        bestActionChartPanel.setLayout(new BorderLayout());
    }
    add(bestActionChartPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));

    //======== consolePanel ========
    {
        consolePanel.setLayout(new GridBagLayout());
        ((GridBagLayout) consolePanel.getLayout()).columnWidths = new int[] { 108, 129, 0 };
        ((GridBagLayout) consolePanel.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        ((GridBagLayout) consolePanel.getLayout()).columnWeights = new double[] { 0.0, 0.0, 1.0E-4 };
        ((GridBagLayout) consolePanel.getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 };

        //======== RLCaptionPanel ========
        {
            RLCaptionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 1));

            //---- RLCaption ----
            RLCaption.setText("RL Parameters");
            RLCaption.setFont(new Font("\u5b8b\u4f53", Font.PLAIN, 16));
            RLCaptionPanel.add(RLCaption);
        }
        consolePanel.add(RLCaptionPanel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- discountLabel ----
        discountLabel.setText("Discount:");
        consolePanel.add(discountLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //======== discountPanel ========
        {
            discountPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2));

            //---- discountDec ----
            discountDec.setText("-");
            discountDec.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    discountDecActionPerformed(e);
                }
            });
            discountPanel.add(discountDec);

            //---- discountField ----
            discountField.setText("000.00");
            discountField.setColumns(6);
            discountPanel.add(discountField);

            //---- discountInc ----
            discountInc.setText("+");
            discountInc.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    discountIncActionPerformed(e);
                }
            });
            discountPanel.add(discountInc);
        }
        consolePanel.add(discountPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- rewardCollisionLabel ----
        rewardCollisionLabel.setText("Reward collision:");
        consolePanel.add(rewardCollisionLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //======== rewardCollisionPanel ========
        {
            rewardCollisionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2));

            //---- rewardCollisionDec ----
            rewardCollisionDec.setText("-");
            rewardCollisionDec.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    rewardCollisionDecActionPerformed(e);
                }
            });
            rewardCollisionPanel.add(rewardCollisionDec);

            //---- rewardCollisionField ----
            rewardCollisionField.setText("000.00");
            rewardCollisionField.setColumns(6);
            rewardCollisionPanel.add(rewardCollisionField);

            //---- rewardCollisionInc ----
            rewardCollisionInc.setText("+");
            rewardCollisionInc.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    rewardCollisionIncActionPerformed(e);
                }
            });
            rewardCollisionPanel.add(rewardCollisionInc);
        }
        consolePanel.add(rewardCollisionPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- rewadGoalLabel ----
        rewadGoalLabel.setText("Reward goal:");
        consolePanel.add(rewadGoalLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //======== rewardGoalPanel ========
        {
            rewardGoalPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2));

            //---- rewardGoalDec ----
            rewardGoalDec.setText("-");
            rewardGoalDec.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    rewardGoalDecActionPerformed(e);
                }
            });
            rewardGoalPanel.add(rewardGoalDec);

            //---- rewardGoalField ----
            rewardGoalField.setText("000.00");
            rewardGoalField.setColumns(6);
            rewardGoalPanel.add(rewardGoalField);

            //---- rewardGoalInc ----
            rewardGoalInc.setText("+");
            rewardGoalInc.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    rewardGoalIncActionPerformed(e);
                }
            });
            rewardGoalPanel.add(rewardGoalInc);
        }
        consolePanel.add(rewardGoalPanel, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- rewardOneStepLabel ----
        rewardOneStepLabel.setText("Reward one step:");
        consolePanel.add(rewardOneStepLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //======== rewardOneStepPanel ========
        {
            rewardOneStepPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2));

            //---- rewardOneStepDec ----
            rewardOneStepDec.setText("-");
            rewardOneStepDec.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    rewardOneStepDecActionPerformed(e);
                }
            });
            rewardOneStepPanel.add(rewardOneStepDec);

            //---- rewardOneStepField ----
            rewardOneStepField.setText("000.00");
            rewardOneStepField.setColumns(6);
            rewardOneStepPanel.add(rewardOneStepField);

            //---- rewardOneStepInc ----
            rewardOneStepInc.setText("+");
            rewardOneStepInc.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    rewardOneStepIncActionPerformed(e);
                }
            });
            rewardOneStepPanel.add(rewardOneStepInc);
        }
        consolePanel.add(rewardOneStepPanel, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- fixedEpsilonCheckBox ----
        fixedEpsilonCheckBox.setText("Fixed Epsilon:");
        fixedEpsilonCheckBox.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                fixedEpsilonCheckBoxActionPerformed(e);
            }
        });
        consolePanel.add(fixedEpsilonCheckBox, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //======== fixedEpsilonPanel ========
        {
            fixedEpsilonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 2));

            //---- fixedEpsilonField ----
            fixedEpsilonField.setText("00.10");
            fixedEpsilonField.setColumns(6);
            fixedEpsilonPanel.add(fixedEpsilonField);
        }
        consolePanel.add(fixedEpsilonPanel, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
                GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //======== sepPanel1 ========
        {
            sepPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));

            //---- separator1 ----
            separator1.setPreferredSize(new Dimension(210, 2));
            sepPanel1.add(separator1);
        }
        consolePanel.add(sepPanel1, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //======== envCaptionPanel ========
        {
            envCaptionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 1));

            //---- envLabel ----
            envLabel.setText("Environment");
            envLabel.setFont(new Font("\u5b8b\u4f53", Font.PLAIN, 16));
            envCaptionPanel.add(envLabel);
        }
        consolePanel.add(envCaptionPanel, new GridBagConstraints(0, 7, 2, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- obstaclesLabel ----
        obstaclesLabel.setText("Obstacles:");
        consolePanel.add(obstaclesLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //======== obstaclesPanel ========
        {
            obstaclesPanel.setLayout(new FlowLayout());

            //---- obstaclesComboBox ----
            obstaclesComboBox.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    obstaclesComboBoxActionPerformed(e);
                }
            });
            obstaclesPanel.add(obstaclesComboBox);
        }
        consolePanel.add(obstaclesPanel, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- goalsLabel ----
        goalsLabel.setText("Goals:");
        consolePanel.add(goalsLabel, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //======== goalsPanel ========
        {
            goalsPanel.setLayout(new FlowLayout());

            //---- goalsComboBox ----
            goalsComboBox.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    goalsComboBoxActionPerformed(e);
                }
            });
            goalsPanel.add(goalsComboBox);
        }
        consolePanel.add(goalsPanel, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //======== sepPanel2 ========
        {
            sepPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));

            //---- separator2 ----
            separator2.setPreferredSize(new Dimension(210, 2));
            sepPanel2.add(separator2);
        }
        consolePanel.add(sepPanel2, new GridBagConstraints(0, 10, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //======== controlCaptionPanel ========
        {
            controlCaptionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 1, 1));

            //---- controlLabel ----
            controlLabel.setText("Control");
            controlLabel.setFont(new Font("\u5b8b\u4f53", Font.PLAIN, 16));
            controlCaptionPanel.add(controlLabel);
        }
        consolePanel.add(controlCaptionPanel, new GridBagConstraints(0, 11, 2, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //======== displayActionsPanel ========
        {
            displayActionsPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));

            //---- displayActionsCheckBox ----
            displayActionsCheckBox.setText("Display action vectors");
            displayActionsCheckBox.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    displayActionsCheckBoxActionPerformed(e);
                }
            });
            displayActionsPanel.add(displayActionsCheckBox);
        }
        consolePanel.add(displayActionsPanel, new GridBagConstraints(0, 12, 2, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //======== controlActionsPanel ========
        {
            controlActionsPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 0));

            //---- stepBtn ----
            stepBtn.setText("1 Step");
            stepBtn.setMargin(new Insets(2, 2, 2, 2));
            stepBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    stepBtnActionPerformed(e);
                }
            });
            controlActionsPanel.add(stepBtn);

            //---- episodeBtn ----
            episodeBtn.setText("1 Episode");
            episodeBtn.setMargin(new Insets(2, 4, 2, 4));
            episodeBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    episodeBtnActionPerformed(e);
                }
            });
            controlActionsPanel.add(episodeBtn);

            //---- animateBtn ----
            animateBtn.setText("Animate");
            animateBtn.setMargin(new Insets(2, 2, 2, 2));
            animateBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    animateBtnActionPerformed(e);
                }
            });
            controlActionsPanel.add(animateBtn);

            //---- resetBtn ----
            resetBtn.setText("Reset");
            resetBtn.setMargin(new Insets(2, 2, 2, 2));
            resetBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    resetBtnActionPerformed(e);
                }
            });
            controlActionsPanel.add(resetBtn);
        }
        consolePanel.add(controlActionsPanel, new GridBagConstraints(0, 13, 2, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //======== controlEpisodesPanel ========
        {
            controlEpisodesPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 2, 0));

            //---- performEpisodesBtn ----
            performEpisodesBtn.setText("Perform");
            performEpisodesBtn.setMargin(new Insets(2, 2, 2, 2));
            performEpisodesBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    performEpisodesBtnActionPerformed(e);
                }
            });
            controlEpisodesPanel.add(performEpisodesBtn);

            //---- numberEpisodesField ----
            numberEpisodesField.setText("100");
            numberEpisodesField.setColumns(5);
            controlEpisodesPanel.add(numberEpisodesField);

            //---- numberEpisodesLabel ----
            numberEpisodesLabel.setText("episodes");
            controlEpisodesPanel.add(numberEpisodesLabel);

            //---- episodesProgressBar ----
            episodesProgressBar.setMinimumSize(new Dimension(5, 10));
            episodesProgressBar.setPreferredSize(new Dimension(80, 20));
            controlEpisodesPanel.add(episodesProgressBar);
        }
        consolePanel.add(controlEpisodesPanel, new GridBagConstraints(0, 14, 2, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //======== sepPanel3 ========
        {
            sepPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));

            //---- separator3 ----
            separator3.setPreferredSize(new Dimension(210, 2));
            sepPanel3.add(separator3);
        }
        consolePanel.add(sepPanel3, new GridBagConstraints(0, 15, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- totalStepsLabel ----
        totalStepsLabel.setText("Total steps:");
        consolePanel.add(totalStepsLabel, new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- totalStepsField ----
        totalStepsField.setText("0000000");
        consolePanel.add(totalStepsField, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- totalEpisodesLabel ----
        totalEpisodesLabel.setText("Total episodes:");
        consolePanel.add(totalEpisodesLabel, new GridBagConstraints(0, 17, 1, 1, 0.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- totalEpisodesFields ----
        totalEpisodesFields.setText("0000000");
        consolePanel.add(totalEpisodesFields, new GridBagConstraints(1, 17, 1, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- totalRewardLabel ----
        totalRewardLabel.setText("Total reward:");
        consolePanel.add(totalRewardLabel, new GridBagConstraints(0, 18, 1, 1, 0.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- totalRewardField ----
        totalRewardField.setText("00000000.00000000");
        consolePanel.add(totalRewardField, new GridBagConstraints(1, 18, 1, 1, 0.0, 0.0,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- dicSizeField ----
        dicSizeField.setText("00000000.00000000");
        consolePanel.add(dicSizeField, new GridBagConstraints(1, 19, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));

        //---- dicSizeLabel ----
        dicSizeLabel.setText("Dictionary size:");
        consolePanel.add(dicSizeLabel, new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));
    }
    add(consolePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
    mazeEnv = new MazeEnvironment();
    controller = (GPSARSASparseController) mazeEnv.controller();
    JFreeChart jFreeChart = mazeEnv.genGraph();
    //Put the jFreeChart in a chartPanel
    ChartPanel chartPanel = new ChartPanel(jFreeChart);
    chartPanel.setPreferredSize(new Dimension(250, 250));
    syncParamsToGUI();
    syncStatusToGUI();
    bestActionChartPanel.add(chartPanel, BorderLayout.CENTER);
}

From source file:com.att.aro.ui.view.menu.tools.RegexWizard.java

private JPanel getFieldPanel() {
    if (fieldPanel == null) {

        fieldPanel = new JPanel();
        fieldPanel.addComponentListener(this);
        fieldPanel.setLayout(new GridBagLayout());

        GridBagConstraints constraint = new GridBagConstraints();
        constraint.gridx = 0;//from   w w  w  . j a v a2s.c om
        constraint.gridy = 0;
        constraint.insets = new Insets(0, 5, 0, 5);
        constraint.anchor = GridBagConstraints.FIRST_LINE_START;
        constraint.weightx = 1;
        constraint.fill = GridBagConstraints.HORIZONTAL;

        cbRequest = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true);
        cbRequest.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                requestField.setEditable(cbRequest.isSelected());
            }
        });
        cbHeader = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true);
        cbHeader.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                headerField.setEditable(cbHeader.isSelected());
            }
        });
        cbResponse = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true);
        cbResponse.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                responseField.setEditable(cbResponse.isSelected());
            }
        });

        compileResultsField = new JTextField();
        compileResultsField.setEditable(false);
        compileResultsField.setBackground(fieldPanel.getBackground());
        compileResultsField.setForeground(Color.red);
        compileResultsField.setFont(compileResultsField.getFont().deriveFont(Font.BOLD));

        requestField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.request"));
        requestField.setName(ResourceBundleHelper.getMessageString("videotab.field.request"));
        regexRequestField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.regex.request"));
        regexRequestField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.request"));
        responseField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.response"));
        responseField.setName(ResourceBundleHelper.getMessageString("videotab.field.response"));
        regexResponseField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.regex.response"));
        regexResponseField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.response"));
        headerField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.header"));
        headerField.setName(ResourceBundleHelper.getMessageString("videotab.field.header"));
        regexHeaderField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.regex.header"));
        regexHeaderField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.header"));

        fieldPanel.add(compileResultsField, constraint);

        constraint.gridy = 1;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.fill = GridBagConstraints.NONE;
        constraint.anchor = GridBagConstraints.EAST;
        fieldPanel.add(cbRequest, constraint);

        constraint.gridy = 2;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(requestField, constraint);

        constraint.gridy = 3;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        constraint.anchor = GridBagConstraints.WEST;
        fieldPanel.add(regexRequestField, constraint);

        constraint.gridy = 4;
        constraint.fill = GridBagConstraints.NONE;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.anchor = GridBagConstraints.EAST;
        fieldPanel.add(cbHeader, constraint);
        constraint.gridy = 5;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(headerField, constraint);
        constraint.gridy = 6;
        fieldPanel.add(regexHeaderField, constraint);

        constraint.gridy = 7;
        constraint.fill = GridBagConstraints.NONE;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.anchor = GridBagConstraints.EAST;
        fieldPanel.add(cbResponse, constraint);

        constraint.gridy = 8;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(responseField, constraint);

        constraint.gridy = 9;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(regexResponseField, constraint);
    }
    return fieldPanel;
}

From source file:edu.ku.brc.ui.tmanfe.SearchReplacePanel.java

/**
 * Creates the panel that displays the close button, the search field, the next button,
 * the previous button, the match case checkbox and the wrap search checkbox
 *//*from   w  ww . j a  v  a2s.  co m*/
private void createFindPanel() {
    cancelButton = createButton(hideFindPanelAction);
    cancelButton.setIcon(IconManager.getIcon("Close"));
    cancelButton.setMargin(new Insets(0, 0, 0, 0));
    cancelButton.setBorder(null);

    findLabel = createLabel(getResourceString("SS_SR_FIND") + ": ", SwingConstants.RIGHT);

    nextButton = createButton(getResourceString("SS_SR_NEXT"));//, new ImageIcon(Specify.class.getResource("images/down.png")));
    nextButton.setEnabled(false);
    UIHelper.setLocalizedMnemonic(previousButton, "SS_SR_NEXT_MNEU");
    nextButton.addActionListener(searchAction);

    previousButton = createButton(getResourceString("SS_SR_PREVIOUS"));//, new ImageIcon(Specify.class.getResource("images/up.png")));
    previousButton.setEnabled(false);
    UIHelper.setLocalizedMnemonic(previousButton, "SS_SR_PREVIOUS_MNEU");

    previousButton.addActionListener(searchAction);

    //JComponent[] itemSample = { new JMenuItem("Replace"), new JMenuItem("Replace All") };
    //replaceButton = new MemoryDropDownButton("Replace", IconManager.getIcon("DropDownArrow"),
    //                1, java.util.Arrays.asList(itemSample));
    //replaceButton.setOverrideBorder(true, replaceButton.raisedBorder);
    //replaceButton.setEnabled(false);

    findField.setColumns(textFieldLength);
    findField.setText("");
    findField.addKeyListener(new FindReplaceTextFieldKeyAdapter());

    //replaceField.setColumns(textFieldLength);
    //replaceField.addKeyListener(new InputFieldKeyAdapter());

    matchCaseButton = createCheckBox(getResourceString("SS_SR_MATCHCASE"));
    matchCaseButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            //don't care
        }
    });

    wrapSearchButton = createCheckBox(getResourceString("SS_SR_WRAP"));
    wrapSearchButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            setCheckAndSetWrapOption();
        }
    });

    searchSelectionChkBx = createCheckBox(getResourceString("SS_SR_SELECTED"));
    searchSelectionChkBx.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            setSearchSelectionOption();
            foundCell = null;
        }
    });

    //searchSelectionChkBx.setEnabled(false);

    builder.add(cancelButton, cc.xy(1, 1));
    builder.add(findLabel, cc.xy(3, 1));
    builder.add(findField, cc.xy(5, 1));
    builder.add(nextButton, cc.xy(7, 1));
    builder.add(previousButton, cc.xy(9, 1));
    builder.add(matchCaseButton, cc.xy(11, 1));
    builder.add(wrapSearchButton, cc.xy(13, 1));
    builder.add(searchSelectionChkBx, cc.xy(15, 1));

    // statusInfo = createLabel("");
    // builder.add(statusInfo,          cc.xy(15,1));
}

From source file:com.limegroup.gnutella.gui.LicenseWindow.java

/**
 * Constructs the dialog itself.//  w  w w  . j  av a 2 s. c om
 */
protected void constructDialog(Container parent) {
    // Add the 
    //  [ img ] | [ license ]
    createTopOfWindow(parent);

    GridBagConstraints c = new GridBagConstraints();

    // Add a -----------
    // line below img & license
    JComponent line = new Line(ThemeFileHandler.TABLE_BACKGROUND_COLOR.getValue());
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(0, 0, 2, 0);
    parent.add(line, c);

    // Create the details panel.
    buildDetails();

    // Add the details panel.
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(4, 4, 0, 4);
    c.weighty = 1;
    c.weightx = 1;
    parent.add(DETAILS, c);

    // Add a ------------
    // line below the details.
    line = new Line(ThemeFileHandler.TABLE_BACKGROUND_COLOR.getValue());
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = GridBagConstraints.RELATIVE;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(2, 0, 2, 0);
    c.ipady = 0;
    c.weighty = 0;
    c.weightx = 0;
    parent.add(line, c);

    // Add an OK button out of the window.
    JButton button = new JButton(GUIMediator.getStringResource("GENERAL_OK_BUTTON_LABEL"));
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            LicenseWindow.this.dispose();
            LicenseWindow.this.setVisible(false);
        }
    });
    c.gridheight = GridBagConstraints.REMAINDER;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(0, 0, 4, 4);
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    parent.add(button, c);

    pack();
}

From source file:ca.uhn.hl7v2.testpanel.ui.editor.Hl7V2MessageEditorPanel.java

/**
 * Create the panel./*  w  w w  .  j a va 2s .c o m*/
 */
public Hl7V2MessageEditorPanel(final Controller theController) {
    setBorder(null);
    myController = theController;

    ButtonGroup encGrp = new ButtonGroup();
    setLayout(new BorderLayout(0, 0));

    mysplitPane = new JSplitPane();
    mysplitPane.setResizeWeight(0.5);
    mysplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(mysplitPane);

    mysplitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent theEvt) {
            double ratio = (double) mysplitPane.getDividerLocation() / mysplitPane.getHeight();
            ourLog.debug("Resizing split to ratio: {}", ratio);
            Prefs.getInstance().setHl7EditorSplit(ratio);
        }
    });

    EventQueue.invokeLater(new Runnable() {
        public void run() {
            mysplitPane.setDividerLocation(Prefs.getInstance().getHl7EditorSplit());
        }
    });

    messageEditorContainerPanel = new JPanel();
    messageEditorContainerPanel.setBorder(null);
    mysplitPane.setRightComponent(messageEditorContainerPanel);
    messageEditorContainerPanel.setLayout(new BorderLayout(0, 0));

    myMessageEditor = new JEditorPane();
    Highlighter h = new UnderlineHighlighter();
    myMessageEditor.setHighlighter(h);
    // myMessageEditor.setFont(Prefs.getHl7EditorFont());
    myMessageEditor.setSelectedTextColor(Color.black);

    myMessageEditor.setCaret(new EditorCaret());

    myMessageScrollPane = new JScrollPane(myMessageEditor);
    messageEditorContainerPanel.add(myMessageScrollPane);

    JToolBar toolBar = new JToolBar();
    messageEditorContainerPanel.add(toolBar, BorderLayout.NORTH);
    toolBar.setFloatable(false);
    toolBar.setRollover(true);

    myFollowToggle = new JToggleButton("Follow");
    myFollowToggle.setToolTipText("Keep the message tree (above) and the message editor (below) in sync");
    myFollowToggle.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            theController.setMessageEditorInFollowMode(myFollowToggle.isSelected());
        }
    });
    myFollowToggle.setIcon(new ImageIcon(
            Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/updown.png")));
    myFollowToggle.setSelected(theController.isMessageEditorInFollowMode());
    toolBar.add(myFollowToggle);

    myhorizontalStrut = Box.createHorizontalStrut(20);
    toolBar.add(myhorizontalStrut);

    mylabel_4 = new JLabel("Encoding");
    toolBar.add(mylabel_4);

    myRdbtnEr7 = new JRadioButton("ER7");
    myRdbtnEr7.setMargin(new Insets(1, 2, 0, 1));
    toolBar.add(myRdbtnEr7);

    myRdbtnXml = new JRadioButton("XML");
    myRdbtnXml.setMargin(new Insets(1, 5, 0, 1));
    toolBar.add(myRdbtnXml);
    encGrp.add(myRdbtnEr7);
    encGrp.add(myRdbtnXml);

    treeContainerPanel = new JPanel();
    mysplitPane.setLeftComponent(treeContainerPanel);
    treeContainerPanel.setLayout(new BorderLayout(0, 0));

    mySpinnerIconOn = new ImageIcon(
            Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/spinner.gif"));
    mySpinnerIconOff = new ImageIcon();

    myTreePanel = new Hl7V2MessageTree(theController);
    myTreePanel.setWorkingListener(new IWorkingListener() {

        public void startedWorking() {
            mySpinner.setText("");
            mySpinner.setIcon(mySpinnerIconOn);
            mySpinnerIconOn.setImageObserver(mySpinner);
        }

        public void finishedWorking(String theStatus) {
            mySpinner.setText(theStatus);

            mySpinner.setIcon(mySpinnerIconOff);
            mySpinnerIconOn.setImageObserver(null);
        }
    });
    myTreeScrollPane = new JScrollPane(myTreePanel);

    myTopTabBar = new JTabbedPane();
    treeContainerPanel.add(myTopTabBar);
    myTopTabBar.setBorder(null);

    JPanel treeContainer = new JPanel();
    treeContainer.setLayout(new BorderLayout(0, 0));
    treeContainer.add(myTreeScrollPane);

    myTopTabBar.add("Message Tree", treeContainer);

    mytoolBar_1 = new JToolBar();
    mytoolBar_1.setFloatable(false);
    treeContainer.add(mytoolBar_1, BorderLayout.NORTH);

    mylabel_3 = new JLabel("Show");
    mytoolBar_1.add(mylabel_3);

    myShowCombo = new JComboBox();
    mytoolBar_1.add(myShowCombo);
    myShowCombo.setPreferredSize(new Dimension(130, 27));
    myShowCombo.setMinimumSize(new Dimension(130, 27));
    myShowCombo.setMaximumSize(new Dimension(130, 32767));

    collapseAllButton = new JButton();
    collapseAllButton.setBorderPainted(false);
    collapseAllButton.addMouseListener(new HoverButtonMouseAdapter(collapseAllButton));
    collapseAllButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myTreePanel.collapseAll();
        }
    });
    collapseAllButton.setToolTipText("Collapse All");
    collapseAllButton.setIcon(new ImageIcon(
            Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/collapse_all.png")));
    mytoolBar_1.add(collapseAllButton);

    expandAllButton = new JButton();
    expandAllButton.setBorderPainted(false);
    expandAllButton.addMouseListener(new HoverButtonMouseAdapter(expandAllButton));
    expandAllButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myTreePanel.expandAll();
        }
    });
    expandAllButton.setToolTipText("Expand All");
    expandAllButton.setIcon(new ImageIcon(
            Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/expand_all.png")));
    mytoolBar_1.add(expandAllButton);

    myhorizontalGlue = Box.createHorizontalGlue();
    mytoolBar_1.add(myhorizontalGlue);

    mySpinner = new JButton("");
    mySpinner.setForeground(Color.DARK_GRAY);
    mySpinner.setHorizontalAlignment(SwingConstants.RIGHT);
    mySpinner.setMaximumSize(new Dimension(200, 15));
    mySpinner.setPreferredSize(new Dimension(200, 15));
    mySpinner.setMinimumSize(new Dimension(200, 15));
    mySpinner.setBorderPainted(false);
    mySpinner.setSize(new Dimension(16, 16));
    mytoolBar_1.add(mySpinner);
    myProfileComboboxModel = new ProfileComboModel();

    myTablesComboModel = new TablesComboModel(myController);

    mytoolBar = new JToolBar();
    mytoolBar.setFloatable(false);
    mytoolBar.setRollover(true);
    treeContainerPanel.add(mytoolBar, BorderLayout.NORTH);

    myOutboundInterfaceCombo = new JComboBox();
    myOutboundInterfaceComboModel = new DefaultComboBoxModel();

    mylabel_1 = new JLabel("Send");
    mytoolBar.add(mylabel_1);
    myOutboundInterfaceCombo.setModel(myOutboundInterfaceComboModel);
    myOutboundInterfaceCombo.setMaximumSize(new Dimension(200, 32767));
    mytoolBar.add(myOutboundInterfaceCombo);

    mySendButton = new JButton("Send");
    mySendButton.addMouseListener(new HoverButtonMouseAdapter(mySendButton));
    mySendButton.setBorderPainted(false);
    mySendButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // int selectedIndex =
            // myOutboundInterfaceComboModel.getIndexOf(myOutboundInterfaceComboModel.getSelectedItem());
            int selectedIndex = myOutboundInterfaceCombo.getSelectedIndex();
            OutboundConnection connection = myController.getOutboundConnectionList().getConnections()
                    .get(selectedIndex);
            activateSendingActivityTabForConnection(connection);
            myController.sendMessages(connection, myMessage,
                    mySendingActivityTable.provideTransmissionCallback());
        }
    });

    myhorizontalStrut_2 = Box.createHorizontalStrut(20);
    myhorizontalStrut_2.setPreferredSize(new Dimension(2, 0));
    myhorizontalStrut_2.setMinimumSize(new Dimension(2, 0));
    myhorizontalStrut_2.setMaximumSize(new Dimension(2, 32767));
    mytoolBar.add(myhorizontalStrut_2);

    mySendOptionsButton = new JButton("Options");
    mySendOptionsButton.setBorderPainted(false);
    final HoverButtonMouseAdapter sendOptionsHoverAdaptor = new HoverButtonMouseAdapter(mySendOptionsButton);
    mySendOptionsButton.addMouseListener(sendOptionsHoverAdaptor);
    mySendOptionsButton.setIcon(new ImageIcon(
            Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/sendoptions.png")));
    mytoolBar.add(mySendOptionsButton);
    mySendOptionsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent theE) {
            if (mySendOptionsPopupDialog != null) {
                mySendOptionsPopupDialog.doHide();
                mySendOptionsPopupDialog = null;
                return;
            }
            mySendOptionsPopupDialog = new SendOptionsPopupDialog(Hl7V2MessageEditorPanel.this, myMessage,
                    mySendOptionsButton, sendOptionsHoverAdaptor);
            Point los = mySendOptionsButton.getLocationOnScreen();
            mySendOptionsPopupDialog.setLocation(los.x, los.y + mySendOptionsButton.getHeight());
            mySendOptionsPopupDialog.setVisible(true);
        }
    });

    mySendButton.setIcon(new ImageIcon(
            Hl7V2MessageEditorPanel.class.getResource("/ca/uhn/hl7v2/testpanel/images/button_execute.png")));
    mytoolBar.add(mySendButton);

    myhorizontalStrut_1 = Box.createHorizontalStrut(20);
    mytoolBar.add(myhorizontalStrut_1);

    mylabel_2 = new JLabel("Validate");
    mytoolBar.add(mylabel_2);

    myProfileCombobox = new JComboBox();
    mytoolBar.add(myProfileCombobox);
    myProfileCombobox.setPreferredSize(new Dimension(200, 27));
    myProfileCombobox.setMinimumSize(new Dimension(200, 27));
    myProfileCombobox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (myHandlingProfileComboboxChange) {
                return;
            }

            myHandlingProfileComboboxChange = true;
            try {
                if (myProfileCombobox.getSelectedIndex() == 0) {
                    myMessage.setValidationContext(null);
                } else if (myProfileCombobox.getSelectedIndex() == 1) {
                    myMessage.setValidationContext(new DefaultValidation());
                } else if (myProfileCombobox.getSelectedIndex() > 0) {
                    ProfileGroup profile = myProfileComboboxModel.myProfileGroups
                            .get(myProfileCombobox.getSelectedIndex());
                    myMessage.setRuntimeProfile(profile);

                    // } else if (myProfileCombobox.getSelectedItem() ==
                    // ProfileComboModel.APPLY_CONFORMANCE_PROFILE) {
                    // IOkCancelCallback<Void> callback = new
                    // IOkCancelCallback<Void>() {
                    // public void ok(Void theArg) {
                    // myProfileComboboxModel.update();
                    // }
                    //
                    // public void cancel(Void theArg) {
                    // myProfileCombobox.setSelectedIndex(0);
                    // }
                    // };
                    // myController.chooseAndLoadConformanceProfileForMessage(myMessage,
                    // callback);
                }
            } catch (ProfileException e2) {
                ourLog.error("Failed to load profile", e2);
            } finally {
                myHandlingProfileComboboxChange = false;
            }
        }
    });
    myProfileCombobox.setMaximumSize(new Dimension(300, 32767));
    myProfileCombobox.setModel(myProfileComboboxModel);

    myhorizontalStrut_4 = Box.createHorizontalStrut(20);
    myhorizontalStrut_4.setPreferredSize(new Dimension(2, 0));
    myhorizontalStrut_4.setMinimumSize(new Dimension(2, 0));
    myhorizontalStrut_4.setMaximumSize(new Dimension(2, 32767));
    mytoolBar.add(myhorizontalStrut_4);

    // mySendingPanel = new JPanel();
    // mySendingPanel.setBorder(null);
    // myTopTabBar.addTab("Sending", null, mySendingPanel, null);
    // mySendingPanel.setLayout(new BorderLayout(0, 0));

    mySendingActivityTable = new ActivityTable();
    mySendingActivityTable.setController(myController);
    myTopTabBar.addTab("Sending", null, mySendingActivityTable, null);

    // mySendingPanelScrollPanel = new JScrollPane();
    // mySendingPanelScrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    // mySendingPanelScrollPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    // mySendingPanelScrollPanel.setColumnHeaderView(mySendingActivityTable);
    //
    // mySendingPanel.add(mySendingPanelScrollPanel, BorderLayout.CENTER);

    bottomPanel = new JPanel();
    bottomPanel.setPreferredSize(new Dimension(10, 20));
    bottomPanel.setMinimumSize(new Dimension(10, 20));
    add(bottomPanel, BorderLayout.SOUTH);
    GridBagLayout gbl_bottomPanel = new GridBagLayout();
    gbl_bottomPanel.columnWidths = new int[] { 98, 74, 0 };
    gbl_bottomPanel.rowHeights = new int[] { 16, 0 };
    gbl_bottomPanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_bottomPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    bottomPanel.setLayout(gbl_bottomPanel);

    mylabel = new JLabel("Terser Path:");
    mylabel.setHorizontalTextPosition(SwingConstants.LEFT);
    mylabel.setHorizontalAlignment(SwingConstants.LEFT);
    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.fill = GridBagConstraints.VERTICAL;
    gbc_label.weighty = 1.0;
    gbc_label.anchor = GridBagConstraints.NORTHWEST;
    gbc_label.gridx = 0;
    gbc_label.gridy = 0;
    bottomPanel.add(mylabel, gbc_label);

    myTerserPathTextField = new JLabel();
    myTerserPathTextField.setForeground(Color.BLUE);
    myTerserPathTextField.setFont(new Font("Lucida Console", Font.PLAIN, 13));
    myTerserPathTextField.setBorder(null);
    myTerserPathTextField.setBackground(SystemColor.control);
    myTerserPathTextField.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (StringUtils.isNotEmpty(myTerserPathTextField.getText())) {
                myTerserPathPopupMenu.show(myTerserPathTextField, 0, 0);
            }
        }
    });

    GridBagConstraints gbc_TerserPathTextField = new GridBagConstraints();
    gbc_TerserPathTextField.weightx = 1.0;
    gbc_TerserPathTextField.fill = GridBagConstraints.HORIZONTAL;
    gbc_TerserPathTextField.gridx = 1;
    gbc_TerserPathTextField.gridy = 0;
    bottomPanel.add(myTerserPathTextField, gbc_TerserPathTextField);

    initLocal();

}

From source file:DesktopAppTest.java

/**
 * Sets the insets of this cell.//from w ww. j a  v a 2 s  .  c  o m
 * 
 * @param top
 *          the spacing to use on top
 * @param left
 *          the spacing to use to the left
 * @param bottom
 *          the spacing to use on the bottom
 * @param right
 *          the spacing to use to the right
 * @return this object for further modification
 */
public GBC setInsets(int top, int left, int bottom, int right) {
    this.insets = new Insets(top, left, bottom, right);
    return this;
}