Example usage for java.awt GridBagConstraints CENTER

List of usage examples for java.awt GridBagConstraints CENTER

Introduction

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

Prototype

int CENTER

To view the source code for java.awt GridBagConstraints CENTER.

Click Source Link

Document

Put the component in the center of its display area.

Usage

From source file:junk.gui.HazardSpectrumApplication.java

public void togglePlot() {
    panel.removeAll();// ww w.ja v  a2s.  c  om
    graphPanel.togglePlot(buttonControlPanel);
    panel.add(graphPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    panel.validate();
    panel.repaint();
}

From source file:net.sf.taverna.t2.workbench.ui.impl.UserRegistrationForm.java

private void initComponents() {
    JPanel mainPanel = new JPanel(new GridBagLayout());

    // Base font for all components on the form
    Font baseFont = new JLabel("base font").getFont().deriveFont(11f);

    // Title panel
    JPanel titlePanel = new JPanel(new FlowLayout(LEFT));
    titlePanel.setBackground(WHITE);//from  w w w .  j  a va2  s .c  om
    // titlePanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    JLabel titleLabel = new JLabel(WELCOME);
    titleLabel.setFont(baseFont.deriveFont(BOLD, 13.5f));
    // titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
    JLabel titleIcon = new JLabel(tavernaCogs32x32Icon);
    // titleIcon.setBorder(new EmptyBorder(10, 10, 10, 10));
    DialogTextArea titleMessage = new DialogTextArea(PLEASE_FILL_IN_THIS_REGISTRATION_FORM);
    titleMessage.setMargin(new Insets(0, 20, 0, 10));
    titleMessage.setFont(baseFont);
    titleMessage.setEditable(false);
    titleMessage.setFocusable(false);
    // titlePanel.setBorder( new EmptyBorder(10, 10, 0, 10));
    JPanel messagePanel = new JPanel(new BorderLayout());
    messagePanel.add(titleLabel, NORTH);
    messagePanel.add(titleMessage, CENTER);
    messagePanel.setBackground(WHITE);
    titlePanel.add(titleIcon);
    titlePanel.add(messagePanel);
    addDivider(titlePanel, BOTTOM, true);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = HORIZONTAL;
    gbc.anchor = WEST;
    gbc.gridwidth = 2;
    // gbc.insets = new Insets(5, 10, 0, 0);
    mainPanel.add(titlePanel, gbc);

    // Registration messages
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 2;
    // gbc.insets = new Insets(5, 0, 0, 10);
    DialogTextArea registrationMessage1 = new DialogTextArea(WHY_REGISTER);
    registrationMessage1.setMargin(new Insets(0, 10, 0, 0));
    registrationMessage1.setFont(baseFont);
    registrationMessage1.setEditable(false);
    registrationMessage1.setFocusable(false);
    registrationMessage1.setBackground(getBackground());

    DialogTextArea registrationMessage2 = new DialogTextArea(WE_DO);
    registrationMessage2.setMargin(new Insets(0, 10, 0, 10));
    registrationMessage2.setFont(baseFont);
    registrationMessage2.setEditable(false);
    registrationMessage2.setFocusable(false);
    registrationMessage2.setBackground(getBackground());
    JPanel registrationMessagePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    registrationMessagePanel.add(registrationMessage1);
    registrationMessagePanel.add(registrationMessage2);
    addDivider(registrationMessagePanel, BOTTOM, true);
    mainPanel.add(registrationMessagePanel, gbc);

    // Mandatory label
    // JLabel mandatoryLabel = new JLabel("* Mandatory fields");
    // mandatoryLabel.setFont(baseFont);
    // gbc.weightx = 0.0;
    // gbc.weighty = 0.0;
    // gbc.gridx = 0;
    // gbc.gridy = 3;
    // gbc.fill = NONE;
    // gbc.anchor = GridBagConstraints.EAST;
    // gbc.gridwidth = 2;
    // gbc.insets = new Insets(0, 10, 0, 20);
    // mainPanel.add(mandatoryLabel, gbc);

    // First name
    JLabel firstNameLabel = new JLabel(FIRST_NAME);
    firstNameLabel.setFont(baseFont);
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(0, 10, 0, 10);
    mainPanel.add(firstNameLabel, gbc);

    firstNameTextField = new JTextField();
    firstNameTextField.setFont(baseFont);
    if (previousRegistrationData != null)
        firstNameTextField.setText(previousRegistrationData.getFirstName());
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.fill = HORIZONTAL;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(firstNameTextField, gbc);

    // Last name
    JLabel lastNameLabel = new JLabel(LAST_NAME);
    lastNameLabel.setFont(baseFont);
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(0, 10, 0, 10);
    mainPanel.add(lastNameLabel, gbc);

    lastNameTextField = new JTextField();
    lastNameTextField.setFont(baseFont);
    if (previousRegistrationData != null)
        lastNameTextField.setText(previousRegistrationData.getLastName());
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 5;
    gbc.fill = HORIZONTAL;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(lastNameTextField, gbc);

    // Email address
    JLabel emailLabel = new JLabel(EMAIL_ADDRESS);
    emailLabel.setFont(baseFont);
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 6;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(emailLabel, gbc);

    emailTextField = new JTextField();
    emailTextField.setFont(baseFont);
    if (previousRegistrationData != null)
        emailTextField.setText(previousRegistrationData.getEmailAddress());
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 6;
    gbc.fill = HORIZONTAL;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(emailTextField, gbc);

    // Keep me informed
    keepMeInformedCheckBox = new JCheckBox(KEEP_ME_INFORMED);
    keepMeInformedCheckBox.setFont(baseFont);
    if (previousRegistrationData != null)
        keepMeInformedCheckBox.setSelected(previousRegistrationData.getKeepMeInformed());
    keepMeInformedCheckBox.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == VK_ENTER) {
                evt.consume();
                keepMeInformedCheckBox.setSelected(!keepMeInformedCheckBox.isSelected());
            }
        }
    });
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 7;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 2;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(keepMeInformedCheckBox, gbc);

    // Institution name
    JLabel institutionLabel = new JLabel(INSTITUTION_COMPANY_NAME);
    institutionLabel.setFont(baseFont);
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 8;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(institutionLabel, gbc);

    institutionOrCompanyTextField = new JTextField();
    institutionOrCompanyTextField.setFont(baseFont);
    if (previousRegistrationData != null)
        institutionOrCompanyTextField.setText(previousRegistrationData.getInstitutionOrCompanyName());
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 8;
    gbc.fill = HORIZONTAL;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(institutionOrCompanyTextField, gbc);

    // Industry type
    JLabel industryLabel = new JLabel(" Industry type:");
    industryLabel.setFont(baseFont);
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 9;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(industryLabel, gbc);

    industryTypeTextField = new JComboBox<>(industryTypes);
    industryTypeTextField.setFont(baseFont);
    if (previousRegistrationData != null)
        industryTypeTextField.setSelectedItem(previousRegistrationData.getIndustry());
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 9;
    gbc.fill = HORIZONTAL;
    gbc.anchor = WEST;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(industryTypeTextField, gbc);

    // Field of investigation
    JTextArea fieldLabel = new JTextArea(FIELD_OF_INVESTIGATION);
    fieldLabel.setFont(baseFont);
    fieldLabel.setEditable(false);
    fieldLabel.setFocusable(false);
    fieldLabel.setBackground(getBackground());
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 10;
    gbc.fill = NONE;
    gbc.anchor = LINE_START;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(fieldLabel, gbc);

    fieldTextField = new JTextField();
    fieldTextField.setFont(baseFont);
    if (previousRegistrationData != null)
        fieldTextField.setText(previousRegistrationData.getField());
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 10;
    gbc.fill = HORIZONTAL;
    gbc.anchor = FIRST_LINE_START;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(fieldTextField, gbc);

    // Purpose of using Taverna
    JTextArea purposeLabel = new JTextArea(WHY_YOU_INTEND_TO_USE_TAVERNA);
    purposeLabel.setFont(baseFont);
    purposeLabel.setEditable(false);
    purposeLabel.setFocusable(false);
    purposeLabel.setBackground(getBackground());
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 11;
    gbc.fill = NONE;
    gbc.anchor = LINE_START;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(purposeLabel, gbc);

    purposeTextArea = new JTextArea(4, 30);
    purposeTextArea.setFont(baseFont);
    purposeTextArea.setLineWrap(true);
    purposeTextArea.setAutoscrolls(true);
    if (previousRegistrationData != null)
        purposeTextArea.setText(previousRegistrationData.getPurposeOfUsingTaverna());
    purposeTextArea.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == VK_TAB) {
                if (evt.getModifiers() > 0)
                    purposeTextArea.transferFocusBackward();
                else
                    purposeTextArea.transferFocus();
                evt.consume();
            }
        }
    });
    JScrollPane purposeScrollPane = new JScrollPane(purposeTextArea);
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 1;
    gbc.gridy = 11;
    gbc.fill = HORIZONTAL;
    gbc.anchor = FIRST_LINE_START;
    gbc.gridwidth = 1;
    gbc.insets = new Insets(5, 10, 0, 10);
    mainPanel.add(purposeScrollPane, gbc);

    // Terms and conditions
    termsAndConditionsCheckBox = new JCheckBox(I_AGREE_TO_THE_TERMS_AND_CONDITIONS);
    termsAndConditionsCheckBox.setFont(baseFont);
    termsAndConditionsCheckBox.setBorder(null);
    termsAndConditionsCheckBox.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == VK_ENTER) {
                evt.consume();
                termsAndConditionsCheckBox.setSelected(!termsAndConditionsCheckBox.isSelected());
            }
        }
    });
    // gbc.weightx = 0.0;
    // gbc.weighty = 0.0;
    // gbc.gridx = 0;
    // gbc.gridy = 12;
    // gbc.fill = NONE;
    // gbc.anchor = WEST;
    // gbc.gridwidth = 2;
    // gbc.insets = new Insets(10, 10, 0, 0);
    // mainPanel.add(termsAndConditionsCheckBox, gbc);

    // Terms and conditions link
    JEditorPane termsAndConditionsURL = new JEditorPane();
    termsAndConditionsURL.setEditable(false);
    termsAndConditionsURL.setBackground(getBackground());
    termsAndConditionsURL.setFocusable(false);
    HTMLEditorKit kit = new HTMLEditorKit();
    termsAndConditionsURL.setEditorKit(kit);
    StyleSheet styleSheet = kit.getStyleSheet();
    // styleSheet.addRule("body {font-family:"+baseFont.getFamily()+"; font-size:"+baseFont.getSize()+";}");
    // // base font looks bigger when rendered as HTML
    styleSheet.addRule("body {font-family:" + baseFont.getFamily() + "; font-size:9px;}");
    Document doc = kit.createDefaultDocument();
    termsAndConditionsURL.setDocument(doc);
    termsAndConditionsURL.setText("<html><body><a href=\"" + TERMS_AND_CONDITIONS_URL + "\">"
            + TERMS_AND_CONDITIONS_URL + "</a></body></html>");
    termsAndConditionsURL.addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent he) {
            if (he.getEventType() == ACTIVATED)
                followHyperlinkToTandCs();
        }
    });
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 13;
    gbc.fill = NONE;
    gbc.anchor = WEST;
    gbc.gridwidth = 2;
    gbc.insets = new Insets(5, 10, 0, 10);
    JPanel termsAndConditionsPanel = new JPanel(new FlowLayout(LEFT));
    termsAndConditionsPanel.add(termsAndConditionsCheckBox);
    termsAndConditionsPanel.add(termsAndConditionsURL);
    mainPanel.add(termsAndConditionsPanel, gbc);

    // Button panel
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    JButton registerButton = new JButton("Register");
    registerButton.setFont(baseFont);
    registerButton.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == VK_ENTER) {
                evt.consume();
                register();
            }
        }
    });
    registerButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            register();
        }
    });
    JButton doNotRegisterButton = new JButton("Do not ask me again");
    doNotRegisterButton.setFont(baseFont);
    doNotRegisterButton.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == VK_ENTER) {
                evt.consume();
                doNotRegister();
            }
        }
    });
    doNotRegisterButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doNotRegister();
        }
    });
    JButton remindMeLaterButton = new JButton("Remind me later"); // in 2 weeks
    remindMeLaterButton.setFont(baseFont);
    remindMeLaterButton.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == VK_ENTER) {
                evt.consume();
                remindMeLater();
            }
        }
    });
    remindMeLaterButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            remindMeLater();
        }
    });
    buttonPanel.add(registerButton);
    buttonPanel.add(remindMeLaterButton);
    buttonPanel.add(doNotRegisterButton);
    addDivider(buttonPanel, TOP, true);
    gbc.gridx = 0;
    gbc.gridy = 14;
    gbc.fill = HORIZONTAL;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(5, 10, 0, 10);
    gbc.gridwidth = 2;
    mainPanel.add(buttonPanel, gbc);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel, CENTER);

    pack();
    setResizable(false);
    // Center the dialog on the screen (we do not have the parent)
    Dimension dimension = getToolkit().getScreenSize();
    Rectangle abounds = getBounds();
    setLocation((dimension.width - abounds.width) / 2, (dimension.height - abounds.height) / 2);
    setSize(getPreferredSize());
}

From source file:shuffle.fwk.service.teams.EditTeamService.java

private JPanel createRosterComponent(Species s) {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 1;//from   www . j  a  va2 s. c  om
    c.gridy = 1;
    c.anchor = GridBagConstraints.CENTER;

    MouseAdapter ma = new PressOrClickMouseAdapter() {

        @Override
        protected void onRight(MouseEvent e) {
            onLeft(e);
        }

        @Override
        protected void onLeft(MouseEvent e) {
            setSelected(s, ret);
            selectedDisplayLabel.repaint();
        }

        @Override
        protected void onEnter() {
            // Do nothing
        }
    };
    SpeciesPaint sp = new SpeciesPaint(s, false, getMegaFilter());
    ImageIcon icon = getUser().getImageManager().getImageFor(sp);
    JLabel iconLabel = new JLabel(icon);
    iconLabel.addMouseListener(ma);
    ret.add(iconLabel, c);
    c.gridy += 1;
    JLabel jLabel = new JLabel(s.getLocalizedName(getMegaFilter()));
    jLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel.addMouseListener(ma);
    ret.add(jLabel, c);

    JButton addToTeam = new JButton(getString(KEY_ADD));
    addToTeam.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addSpeciesToTeam(s);
            updateTeamPanel();
        }
    });
    addToTeam.setToolTipText(getString(KEY_ADD_TOOLTIP));
    c.gridy += 1;
    ret.add(addToTeam, c);

    return ret;
}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private JPanel createAppearancePanel(int stentWidth) {
    MultiBitTitledPanel appearancePanel = new MultiBitTitledPanel(
            controller.getLocaliser().getString("showPreferencesPanel.appearanceTitle"),
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;/*w w  w .j  av  a2s.c o  m*/
    constraints.gridy = 3;
    constraints.weightx = 0.1;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel indent = MultiBitTitledPanel.getIndentPanel(1);
    appearancePanel.add(indent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 1;
    constraints.gridy = 4;
    constraints.weightx = 0.3;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    JPanel stent = MultiBitTitledPanel.createStent(stentWidth);
    appearancePanel.add(stent, constraints);

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 2;
    constraints.gridy = 3;
    constraints.weightx = 0.05;
    constraints.weighty = 0.3;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.CENTER;
    appearancePanel.add(
            MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS),
            constraints);

    MultiBitLabel fontNameLabel = new MultiBitLabel(
            controller.getLocaliser().getString("fontChooser.fontName"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 4;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fontNameLabel, constraints);

    fontNameTextLabel = new MultiBitLabel("");
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 4;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontNameTextLabel, constraints);

    MultiBitLabel fontStyleLabel = new MultiBitLabel(
            controller.getLocaliser().getString("fontChooser.fontStyle"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 5;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fontStyleLabel, constraints);

    fontStyleTextLabel = new MultiBitLabel("");
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 5;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontStyleTextLabel, constraints);

    MultiBitLabel fontSizeLabel = new MultiBitLabel(
            controller.getLocaliser().getString("fontChooser.fontSize"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 6;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fontSizeLabel, constraints);

    fontSizeTextLabel = new MultiBitLabel("");
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 6;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontSizeTextLabel, constraints);

    ChooseFontAction chooseFontAction = new ChooseFontAction(controller, this, null);
    MultiBitButton fontChooserButton = new MultiBitButton(chooseFontAction, controller);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 7;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(fontChooserButton, constraints);

    constraints.fill = GridBagConstraints.VERTICAL;
    constraints.gridx = 4;
    constraints.gridy = 8;
    constraints.weightx = 0.2;
    constraints.weighty = 0.3;
    constraints.gridwidth = 3;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(MultiBitTitledPanel.createStent(1, 30), constraints);

    MultiBitLabel lookAndFeelLabel = new MultiBitLabel(
            controller.getLocaliser().getString("showPreferencesPanel.lookAndFeel"));
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 9;
    constraints.weightx = 0.3;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(lookAndFeelLabel, constraints);

    originalLookAndFeel = controller.getModel().getUserPreference(CoreModel.LOOK_AND_FEEL);
    LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();

    lookAndFeelComboBox = new JComboBox();
    lookAndFeelComboBox.addItem(localisedSystemLookAndFeelName);
    if (lookAndFeels != null) {
        for (LookAndFeelInfo info : lookAndFeels) {
            lookAndFeelComboBox.addItem(info.getName());
            if (info.getName().equalsIgnoreCase(originalLookAndFeel)) {
                lookAndFeelComboBox.setSelectedItem(info.getName());
            }
        }
    }

    if (originalLookAndFeel == null || originalLookAndFeel.equals("")
            || CoreModel.SYSTEM_LOOK_AND_FEEL.equalsIgnoreCase(originalLookAndFeel)) {
        lookAndFeelComboBox.setSelectedItem(localisedSystemLookAndFeelName);
    }

    lookAndFeelComboBox.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont());
    lookAndFeelComboBox.setOpaque(false);

    FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont());
    int textWidth = Math.max(fontMetrics.stringWidth("CDE/Motif"), fontMetrics.stringWidth("Windows classic"));
    Dimension preferredSize = new Dimension(textWidth + TICKER_COMBO_WIDTH_DELTA,
            fontMetrics.getHeight() + EXCHANGE_COMBO_HEIGHT_DELTA);
    lookAndFeelComboBox.setPreferredSize(preferredSize);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 3;
    constraints.gridy = 9;
    constraints.weightx = 0.8;
    constraints.weighty = 0.6;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    appearancePanel.add(lookAndFeelComboBox, constraints);

    JPanel fill1 = new JPanel();
    fill1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 4;
    constraints.gridy = 10;
    constraints.weightx = 20;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    appearancePanel.add(fill1, constraints);

    return appearancePanel;
}

From source file:org.revager.gui.findings_list.FindingsListFrame.java

private void createBottomOrgPanel() {
    JLabel locationLbl = new JLabel(translate("Location:"));
    locationLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel dateLbl = new JLabel(translate("Date:"));
    dateLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel beginLbl = new JLabel(translate("Period of time:"));
    beginLbl.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel tillLabel = new JLabel(translate("to"));
    tillLabel.setFont(UI.VERY_LARGE_FONT_BOLD);

    clockLabel.setFont(UI.VERY_LARGE_FONT_BOLD);

    dateTxtFld = new ObservingTextField();
    dateTxtFld.setFont(UI.VERY_LARGE_FONT);

    dateTxtFld.setFocusable(false);/*from   www.  j a  v a 2s . com*/
    dateTxtFld.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    dateTxtFld.setPreferredSize(new Dimension(190, (int) dateTxtFld.getPreferredSize().getHeight()));
    dateTxtFld.setMinimumSize(dateTxtFld.getPreferredSize());
    dateTxtFld.addMouseListener(new MouseListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            // instantiate the DatePicker
            DatePicker dp = new DatePicker(UI.getInstance().getProtocolFrame(),
                    UI.getInstance().getProtocolFrame().getDateTxtFld());

            // previously selected date
            Date selectedDate = dp.parseDate(UI.getInstance().getProtocolFrame().getDateTxtFld().getText());
            dp.setSelectedDate(selectedDate);
            dp.start(UI.getInstance().getProtocolFrame().getDateTxtFld());
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }
    });

    dateTxtFld.addKeyListener(updateListener);

    /*
     * creating spinner panel
     */
    beginMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1));
    beginHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1));

    endMSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 59, 1));
    endHSpinner = new JSpinner(new RotateSpinnerNumberModel(00, 00, 23, 1));

    beginMSpinner.setFont(UI.VERY_LARGE_FONT);
    beginHSpinner.setFont(UI.VERY_LARGE_FONT);
    endHSpinner.setFont(UI.VERY_LARGE_FONT);
    endMSpinner.setFont(UI.VERY_LARGE_FONT);

    beginMSpinner.addChangeListener(spinnerChangeListener);
    beginHSpinner.addChangeListener(spinnerChangeListener);
    endHSpinner.addChangeListener(spinnerChangeListener);
    endMSpinner.addChangeListener(spinnerChangeListener);

    locationTxtFld = new JTextField();
    locationTxtFld.setFont(UI.VERY_LARGE_FONT);

    /*
     * Hide border if the application runs on Mac OS X
     */
    boolean hideBorder = UI.getInstance().getPlatform() == UI.Platform.MAC;

    GUITools.formatSpinner(endHSpinner, hideBorder);
    GUITools.formatSpinner(endMSpinner, hideBorder);
    GUITools.formatSpinner(beginHSpinner, hideBorder);
    GUITools.formatSpinner(beginMSpinner, hideBorder);

    // TODO: In some cases 'currentProt.getDate()' returns null.
    dateF.setTimeZone(currentProt.getDate().getTimeZone());
    dateTxtFld.setText(dateF.format(currentProt.getDate().getTime()));

    int beginHours = currentProt.getStart().get(Calendar.HOUR_OF_DAY);
    beginMSpinner.setValue(currentProt.getStart().get(Calendar.MINUTE));
    beginHSpinner.setValue(beginHours);

    int endHours = currentProt.getEnd().get(Calendar.HOUR_OF_DAY);
    endMSpinner.setValue(currentProt.getEnd().get(Calendar.MINUTE));
    endHSpinner.setValue(endHours);

    /*
     * Correct the leading zero's
     */
    if ((Integer) beginMSpinner.getValue() == 0) {
        ((NumberEditor) beginMSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) beginHSpinner.getValue() == 0) {
        ((NumberEditor) beginHSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) endMSpinner.getValue() == 0) {
        ((NumberEditor) endMSpinner.getEditor()).getTextField().setText("00");
    }

    if ((Integer) endHSpinner.getValue() == 0) {
        ((NumberEditor) endHSpinner.getEditor()).getTextField().setText("00");
    }

    locationTxtFld.setText(currentProt.getLocation().trim());

    JPanel spinnerPanel = new JPanel(gbl);
    spinnerPanel.setOpaque(false);

    JLabel labelDoubleDot1 = new JLabel(":");
    labelDoubleDot1.setFont(UI.VERY_LARGE_FONT_BOLD);

    JLabel labelDoubleDot2 = new JLabel(":");
    labelDoubleDot2.setFont(UI.VERY_LARGE_FONT_BOLD);

    GUITools.addComponent(spinnerPanel, gbl, beginHSpinner, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot1, 1, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, beginMSpinner, 2, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHWEST);
    GUITools.addComponent(spinnerPanel, gbl, tillLabel, 3, 0, 1, 1, 1.0, 0, 0, 10, 0, 10,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, endHSpinner, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST);
    GUITools.addComponent(spinnerPanel, gbl, labelDoubleDot2, 5, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    GUITools.addComponent(spinnerPanel, gbl, endMSpinner, 6, 0, 1, 1, 0, 0, 0, 5, 0, 0,
            GridBagConstraints.VERTICAL, GridBagConstraints.NORTHEAST);

    /*
     * adding created components to orgpanel
     */
    GUITools.addComponent(bottomOrgPanel, gbl, dateLbl, 2, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GUITools.addComponent(bottomOrgPanel, gbl, dateTxtFld, 3, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);

    GUITools.addComponent(bottomOrgPanel, gbl, locationLbl, 0, 0, 1, 1, 0.0, 1.0, 10, 20, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GUITools.addComponent(bottomOrgPanel, gbl, locationTxtFld, 1, 0, 1, 1, 1.0, 1.0, 10, 5, 0, 10,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);

    GUITools.addComponent(bottomOrgPanel, gbl, beginLbl, 5, 0, 1, 1, 0.0, 1.0, 10, 30, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.EAST);
    GUITools.addComponent(bottomOrgPanel, gbl, spinnerPanel, 6, 0, 1, 1, 0.0, 1.0, 10, 5, 0, 25,
            GridBagConstraints.VERTICAL, GridBagConstraints.WEST);

    updateAttButtons();
}

From source file:com.sshtools.appframework.ui.SshToolsApplication.java

/**
 * Show an 'About' dialog// w ww  . j  a v a2  s.c  o m
 */
public void showAbout(Component parent) {
    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);
    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);
    JLabel v = new JLabel("Version " + getApplicationVersion());
    v.setFont(v.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER);
    MultilineLabel x = new MultilineLabel(getAboutLicenseDetails());
    x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    x.setFont(x.getFont().deriveFont(12f));
    UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER);
    MultilineLabel c = new MultilineLabel(getExpiryInfo());
    c.setFont(c.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER);
    final JLabel h = new JLabel(getAboutURL());
    h.setForeground(Color.blue);
    h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10));
    h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    h.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            try {
                BrowserLauncher.openURL(getAboutURL());
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    });
    UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER);
    JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon());
}

From source file:uk.ac.ucl.chem.ccs.clinicalgui.DisplayJobPanel.java

private void initGUI() {
    if (ajo == null) {
        try {/*from  w w w.  j  a v  a2  s.  c  o  m*/
            setPreferredSize(new Dimension(400, 300));
        } catch (Exception e) {
            e.printStackTrace();
        }
        //JLabel l = new JLabel("No simulation running");
        //this.add(l);
        //this.setEnabled(false);
        return;
    }
    System.out.println("I am not null: drawing the display job panel");
    try {
        TableLayout thisLayout = new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED,
                TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.FILL } });
        thisLayout.setHGap(5);
        thisLayout.setVGap(5);
        this.setLayout(thisLayout);

        {
            jPanel1 = new JPanel();
            TableLayout jPanel1Layout = new TableLayout(new double[][] {
                    { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED,
                            TableLayout.PREFERRED },
                    { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                            TableLayout.FILL } });

            jPanel1Layout.setHGap(5);
            jPanel1Layout.setVGap(5);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1.setLayout(jPanel1Layout);

            jPanel1.setBorder(BorderFactory.createEtchedBorder());
            this.add(jPanel1, "0, 0, 0, 2");
            jPanel1.setPreferredSize(new java.awt.Dimension(630, 305));
            jPanel1.setSize(630, 305);
            {
                dtails = new JPanel();
                GridLayout dtailsLayout = new GridLayout(1, 1);
                dtailsLayout.setColumns(1);
                dtailsLayout.setHgap(5);
                dtailsLayout.setVgap(5);
                dtails.setBorder(BorderFactory.createTitledBorder("Job Details"));
                jPanel1.add(dtails, "0,  0,  2,  4");
                dtails.setLayout(dtailsLayout);
                {
                    jobDetailsSP = new JScrollPane();
                    dtails.add(jobDetailsSP);
                    {
                        jPanel3 = new JPanel();
                        TableLayout jPanel3Layout = new TableLayout(
                                new double[][] { { TableLayout.PREFERRED, TableLayout.FILL },
                                        { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                                TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                        jPanel3Layout.setHGap(5);
                        jPanel3Layout.setVGap(5);
                        jPanel3.setLayout(jPanel3Layout);
                        jobDetailsSP.setViewportView(jPanel3);
                        jPanel3.setBackground(new java.awt.Color(156, 199, 219));
                        {
                            jLabel2 = new JLabel();
                            jPanel3.add(jLabel2, "0, 0");
                            jLabel2.setText("Job Start Time");
                        }
                        {
                            jLabel3 = new JLabel();
                            jPanel3.add(jLabel3, "0, 1");
                            jLabel3.setText("Resource ID");
                        }
                        {
                            jLabel4 = new JLabel();
                            jPanel3.add(jLabel4, "0, 2");
                            jLabel4.setText("Job Type");
                        }
                        {
                            jLabel5 = new JLabel();
                            jPanel3.add(jLabel5, "0, 3");
                            jLabel5.setText("Status");
                        }
                        {
                            jLabel6 = new JLabel();
                            jPanel3.add(jLabel6, "0, 4");
                            jLabel6.setText("Machine");
                        }
                        {
                            jLabel7 = new JLabel();
                            jPanel3.add(jLabel7, "0, 5");
                            jLabel7.setText("CPUs Requested");
                        }
                        {
                            jLabel8 = new JLabel();
                            jPanel3.add(jLabel8, "0, 6");
                            jLabel8.setText("Configuration File");
                        }
                        {
                            jLabel9 = new JLabel();
                            jPanel3.add(jLabel9, "0, 7");
                            jLabel9.setText("Job Arguments");
                        }
                        {
                            jLabel10 = new JLabel();
                            jPanel3.add(jLabel10, "0, 8");
                            jLabel10.setText("Job Stdout");
                        }
                        {
                            jLabel11 = new JLabel();
                            jPanel3.add(jLabel11, "0, 9");
                            jLabel11.setText("Job Stderr");
                        }
                        {
                            jLabel12 = new JLabel();
                            jPanel3.add(jLabel12, "0, 10");
                            jLabel12.setText("Job Stdin");
                        }
                        {
                            jLabel13 = new JLabel();
                            jPanel3.add(jLabel13, "0, 11");
                            jLabel13.setText("Resource Endpoint");
                        }
                        {
                            jobName = new JTextField();
                            jPanel3.add(jobName, "1, 0");
                            jobName.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobName.setOpaque(true);
                            jobName.setBackground(new java.awt.Color(255, 255, 255));
                            jobName.setEditable(false);

                        }
                        {
                            resourceID = new JTextField();
                            jPanel3.add(resourceID, "1, 1");
                            resourceID.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            resourceID.setOpaque(true);
                            resourceID.setBackground(new java.awt.Color(255, 255, 255));
                            resourceID.setEditable(false);

                        }
                        {
                            jobType = new JTextField();
                            jPanel3.add(jobType, "1, 2");
                            jobType.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobType.setBackground(new java.awt.Color(255, 255, 255));
                            jobType.setOpaque(true);
                            jobType.setEditable(false);

                        }
                        {
                            jobStatus = new JLabel();
                            jPanel3.add(jobStatus, "1, 3");
                            jobStatus.setOpaque(true);
                            jobStatus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStatus.setBackground(new java.awt.Color(255, 255, 255));
                        }
                        {
                            rm = new JTextField();
                            jPanel3.add(rm, "1, 4");
                            rm.setBackground(new java.awt.Color(255, 255, 255));
                            rm.setOpaque(true);
                            rm.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            rm.setEditable(false);

                        }
                        {
                            jobCpus = new JTextField();
                            jPanel3.add(jobCpus, "1, 5");
                            jobCpus.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobCpus.setOpaque(true);
                            jobCpus.setBackground(new java.awt.Color(255, 255, 255));
                            jobCpus.setEditable(false);

                        }
                        {
                            jobConf = new JTextField();
                            jPanel3.add(jobConf, "1, 6");
                            jobConf.setBackground(new java.awt.Color(255, 255, 255));
                            jobConf.setOpaque(true);
                            jobConf.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobConf.setEditable(false);

                        }
                        {
                            jobArgs = new JTextField();
                            jPanel3.add(jobArgs, "1, 7");
                            jobArgs.setBackground(new java.awt.Color(255, 255, 255));
                            jobArgs.setOpaque(true);
                            jobArgs.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobArgs.setEditable(false);

                        }
                        {
                            jobSdtout = new JTextField();
                            jPanel3.add(jobSdtout, "1, 8");
                            jobSdtout.setBackground(new java.awt.Color(255, 255, 255));
                            jobSdtout.setOpaque(true);
                            jobSdtout.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobSdtout.setEditable(false);

                        }
                        {
                            jobStderr = new JTextField();
                            jPanel3.add(jobStderr, "1, 9");
                            jobStderr.setBackground(new java.awt.Color(255, 255, 255));
                            jobStderr.setOpaque(true);
                            jobStderr.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStderr.setEditable(false);

                        }
                        {
                            jobStdin = new JTextField();
                            jPanel3.add(jobStdin, "1, 10");
                            jobStdin.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobStdin.setBackground(new java.awt.Color(255, 255, 255));
                            jobStdin.setOpaque(true);
                            jobStdin.setEditable(false);

                        }
                        {
                            jobEPR = new JTextField();
                            jPanel3.add(jobEPR, "1, 11");
                            jobEPR.setOpaque(true);
                            jobEPR.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                            jobEPR.setBackground(new java.awt.Color(255, 255, 255));
                            jobEPR.setEditable(false);

                        }
                    }

                }
            }
            {
                controls = new JPanel();
                TableLayout controlsLayout = new TableLayout(new double[][] { { TableLayout.FILL },
                        { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                controlsLayout.setHGap(5);
                controlsLayout.setVGap(5);
                controls.setLayout(controlsLayout);
                controls.setBorder(BorderFactory.createTitledBorder("Operations"));
                jPanel1.add(controls, "3,  0,  4,  2");
                {
                    updateStatus = new JButton();
                    controls.add(updateStatus, "0, 0");
                    updateStatus.setText("Update Job Status");
                    updateStatus.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            if (updateStatus.getText().equals("Start Job")) {
                                StartCall sc = new StartCall(ajo,
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-lifetime"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-port"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-dn"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-server"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-pw"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.myproxy-un"));
                                ajo = sc.makeCall();
                                updatePanel();
                            } else {
                                pollJobState();
                            }
                        }
                    });
                }
                {
                    teminateJob = new JButton();
                    controls.add(teminateJob, "0, 1");
                    teminateJob.setText("Terminate Job");
                    teminateJob.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            TerminateSimCall tsc = new TerminateSimCall(ajo.getEndPoint());
                            DisplayJobPanel.this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
                            boolean tcsstatus = tsc.makeCall();
                            DisplayJobPanel.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                            if (tcsstatus) {
                                ajo.setState(AHEJobObject.GRIDSAM_TERMINATING);
                                updateState();
                            } else {
                                ErrorMessage em = new ErrorMessage(DisplayJobPanel.this,
                                        "Error terminating job. Check log for details");
                                ;
                            }
                        }
                    });
                }
                {
                    vizButton = new JButton();
                    controls.add(vizButton, "0, 2");
                    vizButton.setText("Visualize");

                    vizButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            String h = "localhost";
                            int p = 65250;
                            int w = 1024 * 1024;

                            VizSteererWindow vs = new VizSteererWindow(h, p, w,
                                    (JFrame) DisplayJobPanel.this.getTopLevelAncestor());
                        }
                    });
                }

                {
                    deleteFiles = new JCheckBox();
                    controls.add(deleteFiles, "0, 3");
                    deleteFiles.setText("Delete staged files when destroying job");
                    deleteFiles.setFont(new java.awt.Font("Sansserif", 0, 11));
                    deleteFiles.setSelected(true);
                }
            }
            {
                polling = new JPanel();
                GridBagLayout pollingLayout = new GridBagLayout();
                pollingLayout.rowWeights = new double[] { 0.1, 0.1, 0.1, 0.1 };
                pollingLayout.rowHeights = new int[] { 7, 7, 7, 7 };
                pollingLayout.columnWeights = new double[] { 0.0, 0.1 };
                pollingLayout.columnWidths = new int[] { 109, 7 };
                polling.setBorder(BorderFactory.createTitledBorder("Status Polling"));
                jPanel1.add(polling, "3,  3,  4,  4");
                polling.setLayout(pollingLayout);
                {
                    jLabel1 = new JLabel();
                    polling.add(jLabel1,
                            new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                    jLabel1.setText("Set the polling interval ");
                    jLabel1.setFont(new java.awt.Font("Sansserif", 0, 11));
                }
                {
                    jSlider1 = new JSlider();
                    polling.add(jSlider1,
                            new GridBagConstraints(0, 1, 2, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST,
                                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
                    jSlider1.setMaximum(60);
                    jSlider1.setValue(0);
                    //jSlider1.setMinorTickSpacing(1);
                    //jSlider1.createStandardLabels(5);
                    Hashtable lab = new Hashtable();
                    lab.put(new Integer(0), new JLabel("0"));
                    lab.put(new Integer(20), new JLabel("10"));
                    lab.put(new Integer(40), new JLabel("20"));
                    lab.put(new Integer(60), new JLabel("30"));
                    jSlider1.setLabelTable(lab);

                    jSlider1.setPaintTicks(true);
                    jSlider1.setPaintLabels(true);
                    jSlider1.setSnapToTicks(false);
                    jSlider1.setMajorTickSpacing(2);
                    jSlider1.setFont(new java.awt.Font("Sansserif", 0, 11));
                    jSlider1.addChangeListener(new ChangeListener() {
                        public void stateChanged(ChangeEvent e) {
                            if (jSlider1.getValue() != 0) {
                                Integer i = new Integer(jSlider1.getValue());
                                time1.setText(Float.toString(i.floatValue() / 2));
                                if (pollingButton.getText().equals("Stop Polling")) {
                                    pollTimer.stop();

                                    pollTimer.setInitialDelay(jSlider1.getValue() * 30000);
                                    pollTimer.setDelay(jSlider1.getValue() * 30000);
                                    pollTimer.start();
                                }
                            } else {
                                if (pollingButton.getText().equals("Stop Polling")) {
                                    pollTimer.stop();
                                    pollingButton.setText("Start Polling");
                                }
                                time1.setText("0.0");
                            }
                        }
                    });
                }
                {
                    pollingButton = new JButton();
                    polling.add(pollingButton,
                            new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST,
                                    GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    pollingButton.setText("Start Polling");
                    pollingButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            if (jSlider1.getValue() > 0) {
                                if (pollingButton.getText().equals("Start Polling")) {
                                    pollTimer = new Timer(jSlider1.getValue() * 30000, new ActionListener() {
                                        public void actionPerformed(ActionEvent evt) {
                                            pollJobState();
                                        }
                                    });
                                    pollTimer.setInitialDelay(1);
                                    pollTimer.start();
                                    pollingButton.setText("Stop Polling");
                                } else {
                                    pollTimer.stop();
                                    pollingButton.setText("Start Polling");
                                }
                            }
                        }
                    });

                }
                {
                    time = new JLabel();
                    polling.add(time, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    time.setBackground(new java.awt.Color(255, 255, 255));
                    time.setText("Every");
                }
                {
                    jLabel14 = new JLabel();
                    polling.add(jLabel14, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    jLabel14.setText("mins");
                }
                {
                    time1 = new JLabel();
                    polling.add(time1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                            GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
                    time1.setText("0.0");
                    ;
                }
            }
        }
        {
            jPanel2 = new JPanel();
            GridLayout jPanel2Layout = new GridLayout(1, 1);
            jPanel2Layout.setColumns(1);
            jPanel2Layout.setHgap(5);
            jPanel2Layout.setVgap(5);
            jPanel2.setLayout(jPanel2Layout);
            TitledBorder title2;
            title2 = BorderFactory.createTitledBorder("Job Output");
            jPanel2.setBorder(title2);
            this.add(jPanel2, "0, 3, 0, 4");
            jPanel2.setPreferredSize(new java.awt.Dimension(630, 254));
            {
                jTabbedPane1 = new JTabbedPane();
                jPanel2.add(jTabbedPane1);

                {
                    gridsamStatus = new JPanel();
                    GridLayout gridsamStatusLayout = new GridLayout(1, 1);
                    gridsamStatusLayout.setColumns(1);
                    gridsamStatusLayout.setHgap(5);
                    gridsamStatusLayout.setVgap(5);
                    gridsamStatus.setLayout(gridsamStatusLayout);
                    jTabbedPane1.addTab("AHE Job Status", null, gridsamStatus, null);
                    {
                        jScrollPane1 = new JScrollPane();
                        gridsamStatus.add(jScrollPane1);
                        {
                            gridsamStatusResults = new JTextArea();
                            jScrollPane1.setViewportView(gridsamStatusResults);
                            gridsamStatusResults.setFont(new java.awt.Font("Monospaced", 0, 12));
                        }
                    }
                }
                {
                    stagedFiles = new JPanel();
                    TableLayout stagedFilesLayout = new TableLayout(new double[][] {
                            { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                    TableLayout.PREFERRED, TableLayout.PREFERRED },
                            { TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL,
                                    TableLayout.FILL, TableLayout.PREFERRED } });
                    stagedFilesLayout.setHGap(5);
                    stagedFilesLayout.setVGap(5);
                    stagedFiles.setLayout(stagedFilesLayout);
                    jTabbedPane1.addTab("Staged Files", null, stagedFiles, null);
                    {
                        filesScrollPane = new JScrollPane();
                        stagedFiles.add(filesScrollPane, "0, 0, 5, 4");
                        {

                            outputFilesTable = new JTable();

                            int col1 = 0, col2 = 0;
                            int fsize = outputFilesTable.getFont().getSize() - 5;
                            Object data[][] = new Object[ajo.getOutfiles().size() + ajo.getInfiles().size()][3];

                            int i = 0;
                            if (ajo.getOutfiles() != null) {
                                Iterator it = ajo.getOutfiles().iterator();
                                while (it.hasNext()) {
                                    JobFileElement je = (JobFileElement) it.next();
                                    data[i][0] = new Boolean(true);
                                    data[i][1] = je.getName();
                                    if (je.getName().length() > col1) {
                                        col1 = je.getName().length();
                                    }
                                    String url = Tools.getUrlNoUP(je.getRemotepath());
                                    data[i][2] = url;
                                    if (url.length() > col2) {
                                        col2 = url.length();
                                    }
                                    i++;
                                }
                            }

                            if (ajo.getInfiles() != null) {
                                Iterator it = ajo.getInfiles().iterator();
                                while (it.hasNext()) {
                                    JobFileElement je = (JobFileElement) it.next();
                                    data[i][0] = new Boolean(false);
                                    data[i][1] = je.getName();
                                    if (je.getName().length() > col1) {
                                        col1 = je.getName().length();
                                    }
                                    String url = Tools.getUrlNoUP(je.getRemotepath());
                                    data[i][2] = url;
                                    if (url.length() > col2) {
                                        col2 = url.length();
                                    }
                                    i++;
                                }
                            }

                            String colNames[] = { "Download", "File Name", "File Location" };

                            TableModel outputFilesTableModel = new MyTableModel(data, colNames);
                            outputFilesTable.setIntercellSpacing(new Dimension(3, 3));
                            outputFilesTable.setModel(outputFilesTableModel);
                            outputFilesTable.getColumnModel().getColumn(0).setPreferredWidth(70);
                            outputFilesTable.getColumnModel().getColumn(1).setPreferredWidth(col1 * fsize);
                            outputFilesTable.getColumnModel().getColumn(2).setPreferredWidth(col2 * fsize);
                            outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                            filesScrollPane.setViewportView(outputFilesTable);
                            this.addComponentListener(new ComponentAdapter() {
                                public void componentResized(ComponentEvent e) {
                                    if (outputFilesTable.getWidth() < filesScrollPane.getWidth()) {
                                        outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
                                    } else {
                                        outputFilesTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                                    }
                                }
                            });

                        }

                    }
                    {
                        downloadButton = new JButton();
                        stagedFiles.add(downloadButton, "5, 5");
                        downloadButton.setText("Download");
                        downloadButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                int outFileSize = ajo.getOutfiles().size();
                                for (int row = 0; row < outputFilesTable.getRowCount(); row++) {
                                    if (((Boolean) outputFilesTable.getValueAt(row, 0))
                                            .booleanValue() == true) {

                                        if (row < outFileSize) {
                                            JobFileElement je = (JobFileElement) ajo.getOutfiles()
                                                    .elementAt(row);

                                            if (fileLocation != null) {
                                                je.setLocalpath(Tools.checkURL(fileLocation) + je.getName());
                                            }

                                            downloadFiles.add(je);
                                        } else {
                                            JobFileElement je = (JobFileElement) ajo.getInfiles()
                                                    .elementAt(row - outFileSize);

                                            if (fileLocation != null) {
                                                je.setLocalpath(Tools.checkURL(fileLocation) + je.getName());
                                            }

                                            downloadFiles.add(je);
                                        }
                                    }

                                }

                                StageFilesIn task = new StageFilesIn(
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavserver"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavuser"),
                                        ClinicalGuiClient.prop
                                                .getProperty("uk.ac.ucl.chem.ccs.aheclient.ahedavpasswd"));
                                task.init(downloadFiles);

                                ProgressMonitor progressMonitor = new ProgressMonitor(DisplayJobPanel.this,
                                        "Downloading Files", null, 0, task.getLength());
                                //progressMonitor.setMillisToDecideToPopup(1);
                                progressMonitor.setMillisToPopup(100);
                                //jProgressBar1.setMaximum(task.getLength());
                                //jProgressBar1.setValue(0);

                                while (task.filesToStage()) {
                                    if (task.stageNext()) {
                                        progressMonitor.setProgress(task.getCurrent());
                                    } else {
                                        cat.error(task.getError());

                                    }

                                }

                            }
                        });

                    }
                    {
                        changeLocationButton = new JButton();
                        stagedFiles.add(changeLocationButton, "4, 5");
                        changeLocationButton.setText("Local Dir");
                        changeLocationButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                JFileChooser fc = new JFileChooser();
                                fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                                int returnVal = fc.showOpenDialog(DisplayJobPanel.this);

                                if (returnVal == JFileChooser.APPROVE_OPTION) {
                                    File file = fc.getSelectedFile();
                                    fileLocation = file.getAbsolutePath();
                                    //System.out.println(fileLocation);
                                }
                            }
                        });

                    }
                }
                {
                    if (ajo.getReGSWSEPR() != null) {

                        regSteering = new JPanel();

                        TableLayout steerLayout = new TableLayout(
                                new double[][] { { TableLayout.FILL }, { TableLayout.FILL, TableLayout.FILL,
                                        TableLayout.FILL, TableLayout.FILL, TableLayout.FILL } });
                        regSteering.setLayout(steerLayout);
                        steeredApp = true;
                        jTabbedPane1.addTab("ReG Steering", null, regSteering, null);
                        {
                            JLabel look = new JLabel("Steering address");
                            steerERP = new JTextField();
                            steer = new JButton("Start Steerer");
                            steer.setEnabled(false);
                            steer.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent evt) {
                                    vs = new VizSteererWindow(h, p, w,
                                            DisplayJobPanel.this.getTopLevelAncestor());
                                }
                            });

                            regSteering.add(look, "0,1");
                            regSteering.add(steerERP, "0,2");
                            regSteering.add(steer, "0,3");

                        }

                    }
                }

            }
        }
        updatePanel();
        this.setPreferredSize(new java.awt.Dimension(630, 605));
        this.setSize(630, 605);
        this.setOpaque(false);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java

/**
  * Builds the panel hosting the information
  * //  ww w .j  a  v  a  2  s  .c  o m
  * @param details The information to display.
  * @param image     The image of reference.
  * @return See above.
  */
private JPanel buildContentPanel(Map details, ImageData image) {
    JPanel content = new JPanel();
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    c.gridy = 0;
    c.gridx = 0;
    JLabel l = new JLabel();
    Font font = l.getFont();
    int size = font.getSize() - 2;
    JLabel label = UIUtilities.setTextFont(EditorUtil.ARCHIVED, Font.BOLD, size);
    JCheckBox box = new JCheckBox();
    box.setEnabled(false);
    box.setBackground(UIUtilities.BACKGROUND);
    box.setSelected(model.isArchived());
    content.add(label, c);
    c.gridx = c.gridx + 2;
    content.add(box, c);
    c.gridy++;
    c.gridx = 0;
    label = UIUtilities.setTextFont(EditorUtil.ACQUISITION_DATE, Font.BOLD, size);
    JLabel value = UIUtilities.createComponent(null);
    String v = model.formatDate(image);
    value.setText(v);
    content.add(label, c);
    c.gridx = c.gridx + 2;
    content.add(value, c);
    c.gridy++;
    c.gridx = 0;
    try { //just to be on the save side
        label = UIUtilities.setTextFont(EditorUtil.IMPORTED_DATE, Font.BOLD, size);
        value = UIUtilities.createComponent(null);
        v = UIUtilities.formatShortDateTime(image.getInserted());
        value.setText(v);
        content.add(label, c);
        c.gridx = c.gridx + 2;
        content.add(value, c);
        c.gridy++;
    } catch (Exception e) {

    }
    label = UIUtilities.setTextFont(EditorUtil.XY_DIMENSION, Font.BOLD, size);
    value = UIUtilities.createComponent(null);
    v = (String) details.get(EditorUtil.SIZE_X);
    v += " x ";
    v += (String) details.get(EditorUtil.SIZE_Y);
    value.setText(v);
    c.gridx = 0;
    content.add(label, c);
    c.gridx = c.gridx + 2;
    content.add(value, c);
    c.gridy++;
    label = UIUtilities.setTextFont(EditorUtil.PIXEL_TYPE, Font.BOLD, size);
    value = UIUtilities.createComponent(null);
    value.setText((String) details.get(EditorUtil.PIXEL_TYPE));
    c.gridx = 0;
    content.add(label, c);
    c.gridx = c.gridx + 2;
    content.add(value, c);

    value = UIUtilities.createComponent(null);
    String s = formatPixelsSize(details, value);
    if (s != null) {
        c.gridy++;
        label = UIUtilities.setTextFont(s, Font.BOLD, size);
        c.gridx = 0;
        content.add(label, c);
        c.gridx = c.gridx + 2;
        content.add(value, c);
    }
    //parse modulo T.
    Map<Integer, ModuloInfo> modulo = model.getModulo();
    ModuloInfo moduloT = modulo.get(ModuloInfo.T);
    c.gridy++;
    label = UIUtilities.setTextFont(EditorUtil.Z_T_FIELDS, Font.BOLD, size);
    value = UIUtilities.createComponent(null);
    v = (String) details.get(EditorUtil.SECTIONS);
    v += " x ";
    if (moduloT != null) {
        String time = (String) details.get(EditorUtil.TIMEPOINTS);
        int t = Integer.parseInt(time);
        v += "" + (t / moduloT.getSize());
    } else {
        v += (String) details.get(EditorUtil.TIMEPOINTS);
    }
    value.setText(v);
    c.gridx = 0;
    content.add(label, c);
    c.gridx = c.gridx + 2;
    content.add(value, c);
    c.gridy++;
    if (moduloT != null) {
        label = UIUtilities.setTextFont(EditorUtil.SMALL_T_VARIABLE, Font.BOLD, size);
        value = UIUtilities.createComponent(null);
        value.setText("" + moduloT.getSize());
        c.gridx = 0;
        content.add(label, c);
        c.gridx = c.gridx + 2;
        content.add(value, c);
        c.gridy++;
    }
    if (!model.isNumerousChannel() && model.getRefObjectID() > 0) {
        label = UIUtilities.setTextFont(EditorUtil.CHANNELS, Font.BOLD, size);
        c.gridx = 0;
        c.anchor = GridBagConstraints.NORTHEAST;
        content.add(label, c);
        c.anchor = GridBagConstraints.CENTER;
        c.gridx++;
        content.add(editChannel, c);
        c.gridx++;
        content.add(channelsPane, c);
    }
    JPanel p = UIUtilities.buildComponentPanel(content);
    p.setBackground(UIUtilities.BACKGROUND_COLOR);
    return p;
}

From source file:net.sf.jabref.gui.FindUnlinkedFilesDialog.java

/**
 * Initializes the layout for the visible components in this menu. A
 * {@link GridBagLayout} is used.//w ww .  j a  v  a  2  s.  com
 */
private void initLayout() {

    GridBagLayout gbl = new GridBagLayout();

    panelDirectory.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            Localization.lang("Select directory")));
    panelFiles.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            Localization.lang("Select files")));
    panelEntryTypesSelection.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            Localization.lang("BibTeX entry creation")));

    Insets basicInsets = new Insets(6, 6, 6, 6);
    Insets smallInsets = new Insets(3, 2, 3, 1);
    Insets noInsets = new Insets(0, 0, 0, 0);

    //       x, y, w, h, wx,wy,ix,iy
    FindUnlinkedFilesDialog.addComponent(gbl, panelSearchArea, buttonScan, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.EAST, noInsets, 0, 1, 1, 1, 1, 1, 40, 10);
    FindUnlinkedFilesDialog.addComponent(gbl, panelSearchArea, labelSearchingDirectoryInfo,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST, noInsets, 0, 2, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelSearchArea, progressBarSearching,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST, noInsets, 0, 3, 1, 1, 0, 0, 0, 0);

    FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, labelDirectoryDescription, null,
            GridBagConstraints.WEST, new Insets(6, 6, 0, 6), 0, 0, 3, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, textfieldDirectoryPath,
            GridBagConstraints.HORIZONTAL, null, basicInsets, 0, 1, 2, 1, 1, 1, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, buttonBrowse, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.EAST, basicInsets, 2, 1, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, labelFileTypesDescription,
            GridBagConstraints.NONE, GridBagConstraints.WEST, new Insets(18, 6, 18, 3), 0, 3, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, comboBoxFileTypeSelection,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, new Insets(18, 3, 18, 6), 1, 3, 1, 1, 1, 0,
            0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, panelSearchArea, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.EAST, new Insets(18, 6, 18, 6), 2, 3, 1, 1, 0, 0, 0, 0);

    FindUnlinkedFilesDialog.addComponent(gbl, panelFiles, labelFilesDescription, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST, new Insets(6, 6, 0, 6), 0, 0, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelFiles, scrollpaneTree, GridBagConstraints.BOTH,
            GridBagConstraints.CENTER, basicInsets, 0, 1, 1, 1, 1, 1, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelFiles, panelOptions, GridBagConstraints.NONE,
            GridBagConstraints.NORTHEAST, basicInsets, 1, 1, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionSelectAll,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, noInsets, 0, 0, 1, 1, 1, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionUnselectAll,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, noInsets, 0, 1, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionExpandAll,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, new Insets(6, 0, 0, 0), 0, 2, 1, 1, 0, 0,
            0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionCollapseAll,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, noInsets, 0, 3, 1, 1, 0, 0, 0, 0);

    FindUnlinkedFilesDialog.addComponent(gbl, panelEntryTypesSelection, labelEntryTypeDescription,
            GridBagConstraints.NONE, GridBagConstraints.WEST, basicInsets, 0, 0, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelEntryTypesSelection, comboBoxEntryTypeSelection,
            GridBagConstraints.NONE, GridBagConstraints.WEST, basicInsets, 1, 0, 1, 1, 1, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelEntryTypesSelection, checkboxCreateKeywords,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, basicInsets, 0, 1, 2, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelImportArea, labelImportingInfo,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, new Insets(6, 6, 0, 6), 0, 1, 1, 1, 1, 0,
            0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelImportArea, progressBarImporting,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, new Insets(0, 6, 6, 6), 0, 2, 1, 1, 1, 0,
            0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, panelButtons, panelImportArea, GridBagConstraints.NONE,
            GridBagConstraints.EAST, smallInsets, 1, 0, 1, 1, 0, 0, 0, 0);

    FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelDirectory, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER, basicInsets, 0, 0, 1, 1, 0, 0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelFiles, GridBagConstraints.BOTH,
            GridBagConstraints.NORTHWEST, new Insets(12, 6, 2, 2), 0, 1, 1, 1, 1, 1, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelEntryTypesSelection,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHWEST, new Insets(12, 6, 2, 2), 0, 2, 1, 1, 0,
            0, 0, 0);
    FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelButtons, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER, new Insets(10, 6, 10, 6), 0, 3, 1, 1, 0, 0, 0, 0);

    ButtonBarBuilder bb = new ButtonBarBuilder();
    bb.addGlue();
    bb.addButton(buttonApply);
    bb.addButton(buttonClose);
    bb.addGlue();

    bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panelImportArea.add(bb.getPanel(), GridBagConstraints.NONE);
    pack();

}

From source file:com.vgi.mafscaling.LogView.java

private void createChartTab() {
    JPanel plotPanel = new JPanel();
    add(plotPanel, "<html><div style='text-align: center;'>3<br>D<br><br>C<br>h<br>a<br>r<br>t</div></html>");
    GridBagLayout gbl_plotPanel = new GridBagLayout();
    gbl_plotPanel.columnWidths = new int[] { 0 };
    gbl_plotPanel.rowHeights = new int[] { 0, 0 };
    gbl_plotPanel.columnWeights = new double[] { 1.0 };
    gbl_plotPanel.rowWeights = new double[] { 0.0, 1.0 };
    plotPanel.setLayout(gbl_plotPanel);//from   ww w.j  a va2 s .c o  m

    JPanel cntlPanel = new JPanel();
    GridBagConstraints gbc_ctrlPanel = new GridBagConstraints();
    gbc_ctrlPanel.insets = insets3;
    gbc_ctrlPanel.anchor = GridBagConstraints.NORTH;
    gbc_ctrlPanel.weightx = 1.0;
    gbc_ctrlPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_ctrlPanel.gridx = 0;
    gbc_ctrlPanel.gridy = 0;
    plotPanel.add(cntlPanel, gbc_ctrlPanel);

    GridBagLayout gbl_cntlPanel = new GridBagLayout();
    gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_cntlPanel.rowHeights = new int[] { 0 };
    gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 };
    gbl_cntlPanel.rowWeights = new double[] { 0 };
    cntlPanel.setLayout(gbl_cntlPanel);

    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.anchor = GridBagConstraints.EAST;
    gbc_label.insets = new Insets(3, 3, 3, 0);
    gbc_label.gridx = 0;
    gbc_label.gridy = 0;

    GridBagConstraints gbc_column = new GridBagConstraints();
    gbc_column.anchor = GridBagConstraints.WEST;
    gbc_column.insets = insets3;
    gbc_column.gridx = 1;
    gbc_column.gridy = 0;

    cntlPanel.add(new JLabel("X-Axis"), gbc_label);

    xAxisColumn = new JComboBox<String>();
    xAxisColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX");
    cntlPanel.add(xAxisColumn, gbc_column);

    gbc_label.gridx += 2;
    cntlPanel.add(new JLabel("Y-Axis"), gbc_label);

    gbc_column.gridx += 2;
    yAxisColumn = new JComboBox<String>();
    yAxisColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX");
    cntlPanel.add(yAxisColumn, gbc_column);

    gbc_label.gridx += 2;
    cntlPanel.add(new JLabel("Plots"), gbc_label);

    gbc_column.gridx += 2;
    plotsColumn = new JMultiSelectionBox();
    plotsColumn.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXX");
    cntlPanel.add(plotsColumn, gbc_column);

    gbc_label.gridx = 7;
    JButton btnGoButton = new JButton("View");
    btnGoButton.setActionCommand("view");
    btnGoButton.addActionListener(this);
    cntlPanel.add(btnGoButton, gbc_label);

    plot3d = new Plot3DPanel("SOUTH") {
        private static final long serialVersionUID = 7914951068593204419L;

        public void addPlotToolBar(String location) {
            super.addPlotToolBar(location);
            super.plotToolBar.remove(7);
            super.plotToolBar.remove(5);
            super.plotToolBar.remove(4);
        }
    };
    plot3d.setAutoBounds();
    plot3d.setAutoscrolls(true);
    plot3d.setEditable(false);
    plot3d.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    plot3d.setForeground(Color.BLACK);
    plot3d.getAxis(0).setColor(Color.BLACK);
    plot3d.getAxis(1).setColor(Color.BLACK);
    plot3d.getAxis(2).setColor(Color.BLACK);

    GridBagConstraints gbc_chartPanel = new GridBagConstraints();
    gbc_chartPanel.anchor = GridBagConstraints.CENTER;
    gbc_chartPanel.insets = insets3;
    gbc_chartPanel.weightx = 1.0;
    gbc_chartPanel.weighty = 1.0;
    gbc_chartPanel.fill = GridBagConstraints.BOTH;
    gbc_chartPanel.gridx = 0;
    gbc_chartPanel.gridy = 1;
    plotPanel.add(plot3d, gbc_chartPanel);
}