Example usage for java.awt GridBagConstraints BOTH

List of usage examples for java.awt GridBagConstraints BOTH

Introduction

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

Prototype

int BOTH

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

Click Source Link

Document

Resize the component both horizontally and vertically.

Usage

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

/**
 * Create the messaging server panel which consists of MultiBit style header
 * and our Netbean visual editor designed panel
 * @param stentWidth/*from   w  w w .j  a v  a  2  s  .co m*/
 * @return 
 */
private JPanel createMessagingServerPanel(int stentWidth) {

    MultiBitTitledPanel panel = new MultiBitTitledPanel("Messaging Servers",
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));

    // Create layout like other panels
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;
    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);
    panel.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);
    panel.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;
    panel.add(MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS),
            constraints);

    // Now insert our custom panel

    messagingServerPanel = new CSMessagingServerPanel();
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 5;
    constraints.weightx = 1;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    panel.add(messagingServerPanel, constraints);

    // fill up right side
    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;
    panel.add(fill1, constraints);

    return panel;
}

From source file:de.codesourcery.jasm16.utils.ASTInspector.java

private void setupUI() throws MalformedURLException {
    // editor pane
    editorPane = new JTextPane();
    editorScrollPane = new JScrollPane(editorPane);
    editorPane.addCaretListener(listener);

    editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    editorScrollPane.setPreferredSize(new Dimension(400, 600));
    editorScrollPane.setMinimumSize(new Dimension(100, 100));

    final AdjustmentListener adjustmentListener = new AdjustmentListener() {

        @Override/*  w w  w .j  av  a 2 s.  c  o m*/
        public void adjustmentValueChanged(AdjustmentEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (currentUnit != null) {
                    doSemanticHighlighting(currentUnit);
                }
            }
        }
    };
    editorScrollPane.getVerticalScrollBar().addAdjustmentListener(adjustmentListener);
    editorScrollPane.getHorizontalScrollBar().addAdjustmentListener(adjustmentListener);

    // button panel
    final JPanel topPanel = new JPanel();

    final JToolBar toolbar = new JToolBar();
    final JButton showASTButton = new JButton("Show AST");
    showASTButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            boolean currentlyVisible = astInspector != null ? astInspector.isVisible() : false;
            if (currentlyVisible) {
                showASTButton.setText("Show AST");
            } else {
                showASTButton.setText("Hide AST");
            }
            if (currentlyVisible) {
                astInspector.setVisible(false);
            } else {
                showASTInspector();
            }

        }
    });

    fileChooser.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final JFileChooser chooser;
            if (lastOpenDirectory != null && lastOpenDirectory.isDirectory()) {
                chooser = new JFileChooser(lastOpenDirectory);
            } else {
                lastOpenDirectory = null;
                chooser = new JFileChooser();
            }

            final FileFilter filter = new FileFilter() {

                @Override
                public boolean accept(File f) {
                    if (f.isDirectory()) {
                        return true;
                    }
                    return f.isFile() && (f.getName().endsWith(".asm") || f.getName().endsWith(".dasm")
                            || f.getName().endsWith(".dasm16"));
                }

                @Override
                public String getDescription() {
                    return "DCPU-16 assembler sources";
                }
            };
            chooser.setFileFilter(filter);
            int returnVal = chooser.showOpenDialog(frame);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File newFile = chooser.getSelectedFile();
                if (newFile.isFile()) {
                    lastOpenDirectory = newFile.getParentFile();
                    try {
                        openFile(newFile);
                    } catch (IOException e1) {
                        statusModel.addError("Failed to read from file " + newFile.getAbsolutePath(), e1);
                    }
                }
            }
        }
    });
    toolbar.add(fileChooser);
    toolbar.add(showASTButton);

    final ComboBoxModel<String> model = new ComboBoxModel<String>() {

        private ICompilerPhase selected;

        private final List<String> realModel = new ArrayList<String>();

        {
            for (ICompilerPhase p : compiler.getCompilerPhases()) {
                realModel.add(p.getName());
                if (p.getName().equals(ICompilerPhase.PHASE_GENERATE_CODE)) {
                    selected = p;
                }
            }
        }

        @Override
        public Object getSelectedItem() {
            return selected != null ? selected.getName() : null;
        }

        private ICompilerPhase getPhaseByName(String name) {
            for (ICompilerPhase p : compiler.getCompilerPhases()) {
                if (p.getName().equals(name)) {
                    return p;
                }
            }
            return null;
        }

        @Override
        public void setSelectedItem(Object name) {
            selected = getPhaseByName((String) name);
        }

        @Override
        public void addListDataListener(ListDataListener l) {
        }

        @Override
        public String getElementAt(int index) {
            return realModel.get(index);
        }

        @Override
        public int getSize() {
            return realModel.size();
        }

        @Override
        public void removeListDataListener(ListDataListener l) {
        }

    };
    comboBox.setModel(model);
    comboBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (model.getSelectedItem() != null) {
                ICompilerPhase oldPhase = findDisabledPhase();
                if (oldPhase != null) {
                    oldPhase.setStopAfterExecution(false);
                }
                compiler.getCompilerPhaseByName((String) model.getSelectedItem()).setStopAfterExecution(true);
                try {
                    compile();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }

        private ICompilerPhase findDisabledPhase() {
            for (ICompilerPhase p : compiler.getCompilerPhases()) {
                if (p.isStopAfterExecution()) {
                    return p;
                }
            }
            return null;
        }
    });

    toolbar.add(new JLabel("Stop compilation after: "));
    toolbar.add(comboBox);

    cursorPosition.setSize(new Dimension(400, 15));
    cursorPosition.setEditable(false);

    statusArea.setPreferredSize(new Dimension(400, 100));
    statusArea.setModel(statusModel);

    /**
     * TOOLBAR
     * SOURCE
     * cursor position
     * status area 
     */
    topPanel.setLayout(new GridBagLayout());

    GridBagConstraints cnstrs = constraints(0, 0, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 0;
    topPanel.add(toolbar, cnstrs);

    cnstrs = constraints(0, 1, GridBagConstraints.BOTH);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    topPanel.add(editorScrollPane, cnstrs);

    cnstrs = constraints(0, 2, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 0;
    topPanel.add(cursorPosition, cnstrs);

    cnstrs = constraints(0, 3, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 0;

    final JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new GridBagLayout());

    statusArea.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);

    statusArea.addMouseListener(new MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1) {
                final int row = statusArea.rowAtPoint(e.getPoint());
                StatusMessage message = statusModel.getMessage(row);
                if (message.getLocation() != null) {
                    moveCursorTo(message.getLocation());
                }
            }
        };
    });

    statusArea.setFillsViewportHeight(true);
    statusArea.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    final JScrollPane statusPane = new JScrollPane(statusArea);
    statusPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    statusPane.setPreferredSize(new Dimension(400, 100));
    statusPane.setMinimumSize(new Dimension(100, 20));

    cnstrs = constraints(0, 0, GridBagConstraints.BOTH);
    cnstrs.weightx = 1;
    cnstrs.weighty = 1;
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = GridBagConstraints.REMAINDER;

    bottomPanel.add(statusPane, cnstrs);

    // setup frame
    frame = new JFrame(
            "DCPU-16 assembler " + Compiler.VERSION + "   (c) 2012 by tobias.gierke@code-sourcery.de");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel);
    splitPane.setBackground(Color.WHITE);
    frame.getContentPane().add(splitPane);

    frame.pack();
    frame.setVisible(true);

    splitPane.setDividerLocation(0.9);
}

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

/**
 * This method initializes jPanelImagePicker   
 *    /*from  w  w  w.j  a v a2 s  .c  o  m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelImagePicker() {
    if (jPanelImagePicker == null) {
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.insets = new Insets(0, 0, 5, 5);
        gridBagConstraints1.gridx = 2;
        gridBagConstraints1.gridy = 0;
        jLabel1 = new JLabel();
        jLabel1.setText("(0)");
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.insets = new Insets(0, 0, 5, 0);
        gridBagConstraints.fill = GridBagConstraints.BOTH;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.gridx = 3;
        jLabel = new JLabel();
        jLabel.setText("Images: ");
        jPanelImagePicker = new JPanel();
        GridBagLayout gbl_jPanelImagePicker = new GridBagLayout();
        gbl_jPanelImagePicker.columnWeights = new double[] { 0.0, 0.0, 0.0, 1.0 };
        jPanelImagePicker.setLayout(gbl_jPanelImagePicker);
        GridBagConstraints gbc_btnVerbatimtranscription = new GridBagConstraints();
        gbc_btnVerbatimtranscription.insets = new Insets(0, 0, 5, 5);
        gbc_btnVerbatimtranscription.gridx = 0;
        gbc_btnVerbatimtranscription.gridy = 0;
        jPanelImagePicker.add(getBtnVerbatimtranscription(), gbc_btnVerbatimtranscription);
        GridBagConstraints gbc_jLabel = new GridBagConstraints();
        gbc_jLabel.insets = new Insets(0, 0, 5, 5);
        gbc_jLabel.gridx = 1;
        gbc_jLabel.gridy = 0;
        jPanelImagePicker.add(jLabel, gbc_jLabel);
        jPanelImagePicker.add(getJComboBoxImagePicker(), gridBagConstraints);
        jPanelImagePicker.add(jLabel1, gridBagConstraints1);
    }
    return jPanelImagePicker;
}

From source file:com._17od.upm.gui.AccountDialog.java

public AccountDialog(AccountInformation account, JFrame parentWindow, boolean readOnly,
        ArrayList existingAccounts) {
    super(parentWindow, true);

    boolean addingAccount = false;

    //Request focus on Account JDialog when mouse clicked
    this.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 1) {
                requestFocus();//from   ww w. j  ava  2 s . co m

            }
        }
    });

    // Set the title based on weather we've been opened in readonly mode and
    // weather the
    // Account passed in is empty or not
    String title = null;
    if (readOnly) {
        title = Translator.translate("viewAccount");
    } else if (!readOnly && account.getAccountName().trim().equals("")) {
        title = Translator.translate("addAccount");
        addingAccount = true;
    } else {
        title = Translator.translate("editAccount");
    }
    setTitle(title);

    this.pAccount = account;
    this.existingAccounts = existingAccounts;
    this.parentWindow = parentWindow;

    getContentPane().setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    Container container = getContentPane();

    // The AccountName Row
    JLabel accountLabel = new JLabel(Translator.translate("account"));
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    container.add(accountLabel, c);

    // This panel will hold the Account field and the copy and paste
    // buttons.
    JPanel accountPanel = new JPanel(new GridBagLayout());

    accountName = new JTextField(new String(pAccount.getAccountName()), 20);
    if (readOnly) {
        accountName.setEditable(false);
    }
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    accountPanel.add(accountName, c);
    accountName.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            accountName.selectAll();
        }
    });

    JButton acctCopyButton = new JButton();
    acctCopyButton.setIcon(Util.loadImage("copy-icon.png"));
    acctCopyButton.setToolTipText("Copy");
    acctCopyButton.setEnabled(true);
    acctCopyButton.setMargin(new Insets(0, 0, 0, 0));
    acctCopyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            copyTextField(accountName);
        }
    });
    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    accountPanel.add(acctCopyButton, c);

    JButton acctPasteButton = new JButton();
    acctPasteButton.setIcon(Util.loadImage("paste-icon.png"));
    acctPasteButton.setToolTipText("Paste");
    acctPasteButton.setEnabled(!readOnly);
    acctPasteButton.setMargin(new Insets(0, 0, 0, 0));
    acctPasteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            pasteToTextField(accountName);
        }
    });
    c.gridx = 2;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    accountPanel.add(acctPasteButton, c);

    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    container.add(accountPanel, c);

    // Userid Row
    JLabel useridLabel = new JLabel(Translator.translate("userid"));
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    container.add(useridLabel, c);

    // This panel will hold the User ID field and the copy and paste
    // buttons.
    JPanel idPanel = new JPanel(new GridBagLayout());

    userId = new JTextField(new String(pAccount.getUserId()), 20);
    if (readOnly) {
        userId.setEditable(false);
    }
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    idPanel.add(userId, c);
    userId.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            userId.selectAll();
        }
    });

    JButton idCopyButton = new JButton();
    idCopyButton.setIcon(Util.loadImage("copy-icon.png"));
    idCopyButton.setToolTipText("Copy");
    idCopyButton.setEnabled(true);
    idCopyButton.setMargin(new Insets(0, 0, 0, 0));
    idCopyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            copyTextField(userId);
        }
    });
    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    idPanel.add(idCopyButton, c);

    JButton idPasteButton = new JButton();
    idPasteButton.setIcon(Util.loadImage("paste-icon.png"));
    idPasteButton.setToolTipText("Paste");
    idPasteButton.setEnabled(!readOnly);
    idPasteButton.setMargin(new Insets(0, 0, 0, 0));
    idPasteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            pasteToTextField(userId);
        }
    });
    c.gridx = 2;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    idPanel.add(idPasteButton, c);

    c.gridx = 1;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    container.add(idPanel, c);

    // Password Row
    JLabel passwordLabel = new JLabel(Translator.translate("password"));
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.insets = new Insets(15, 10, 10, 10);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    container.add(passwordLabel, c);

    // This panel will hold the password, generate password button, copy and
    // paste buttons, and hide password checkbox
    JPanel passwordPanel = new JPanel(new GridBagLayout());

    password = new JPasswordField(new String(pAccount.getPassword()), 20);
    // allow CTRL-C on the password field
    password.putClientProperty("JPasswordField.cutCopyAllowed", Boolean.TRUE);
    password.setEditable(!readOnly);
    password.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            password.selectAll();
        }
    });
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    passwordPanel.add(password, c);

    JButton generateRandomPasswordButton = new JButton(Translator.translate("generate"));
    if (readOnly) {
        generateRandomPasswordButton.setEnabled(false);
    }
    generateRandomPasswordButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionevent) {
            // Get the user's preference about including or not Escape
            // Characters to generated passwords
            Boolean includeEscapeChars = new Boolean(
                    Preferences.get(Preferences.ApplicationOptions.INCLUDE_ESCAPE_CHARACTERS, "true"));
            int pwLength = Preferences.getInt(Preferences.ApplicationOptions.ACCOUNT_PASSWORD_LENGTH, 8);
            String Password;

            if ((includeEscapeChars.booleanValue()) && (pwLength > 3)) {
                // Verify that the generated password satisfies the criteria
                // for strong passwords(including Escape Characters)
                do {
                    Password = GeneratePassword(pwLength, includeEscapeChars.booleanValue());
                } while (!(CheckPassStrong(Password, includeEscapeChars.booleanValue())));

            } else if (!(includeEscapeChars.booleanValue()) && (pwLength > 2)) {
                // Verify that the generated password satisfies the criteria
                // for strong passwords(excluding Escape Characters)
                do {
                    Password = GeneratePassword(pwLength, includeEscapeChars.booleanValue());
                } while (!(CheckPassStrong(Password, includeEscapeChars.booleanValue())));

            } else {
                // Else a weak password of 3 or less chars will be produced
                Password = GeneratePassword(pwLength, includeEscapeChars.booleanValue());
            }
            password.setText(Password);
        }
    });
    if (addingAccount) {
        generateRandomPasswordButton.doClick();
    }
    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    passwordPanel.add(generateRandomPasswordButton, c);

    JButton pwCopyButton = new JButton();
    pwCopyButton.setIcon(Util.loadImage("copy-icon.png"));
    pwCopyButton.setToolTipText("Copy");
    pwCopyButton.setEnabled(true);
    pwCopyButton.setMargin(new Insets(0, 0, 0, 0));
    pwCopyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            copyTextField(password);
        }
    });
    c.gridx = 2;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    passwordPanel.add(pwCopyButton, c);

    JButton pwPasteButton = new JButton();
    pwPasteButton.setIcon(Util.loadImage("paste-icon.png"));
    pwPasteButton.setToolTipText("Paste");
    pwPasteButton.setEnabled(!readOnly);
    pwPasteButton.setMargin(new Insets(0, 0, 0, 0));
    pwPasteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            pasteToTextField(password);
        }
    });
    c.gridx = 3;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    passwordPanel.add(pwPasteButton, c);

    JCheckBox hidePasswordCheckbox = new JCheckBox(Translator.translate("hide"), true);
    defaultEchoChar = password.getEchoChar();
    hidePasswordCheckbox.setMargin(new Insets(5, 0, 5, 0));
    hidePasswordCheckbox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                password.setEchoChar(defaultEchoChar);
            } else {
                password.setEchoChar((char) 0);
            }
        }
    });

    Boolean hideAccountPassword = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.ACCOUNT_HIDE_PASSWORD, "true"));
    hidePasswordCheckbox.setSelected(hideAccountPassword.booleanValue());

    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 0);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    passwordPanel.add(hidePasswordCheckbox, c);

    c.gridx = 1;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    container.add(passwordPanel, c);

    // URL Row
    JLabel urlLabel = new JLabel(Translator.translate("url"));
    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    container.add(urlLabel, c);

    // This panel will hold the URL field and the copy and paste buttons.
    JPanel urlPanel = new JPanel(new GridBagLayout());

    url = new JTextField(new String(pAccount.getUrl()), 20);
    if (readOnly) {
        url.setEditable(false);
    }
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    urlPanel.add(url, c);
    url.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            url.selectAll();
        }
    });

    final JButton urlLaunchButton = new JButton();
    urlLaunchButton.setIcon(Util.loadImage("launch-url-sm.png"));
    urlLaunchButton.setToolTipText("Launch URL");
    urlLaunchButton.setEnabled(true);
    urlLaunchButton.setMargin(new Insets(0, 0, 0, 0));
    urlLaunchButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            String urlText = url.getText();

            // Check if the selected url is null or emty and inform the user
            // via JoptioPane message
            if ((urlText == null) || (urlText.length() == 0)) {
                JOptionPane.showMessageDialog(urlLaunchButton.getParent(),
                        Translator.translate("EmptyUrlJoptionpaneMsg"),
                        Translator.translate("UrlErrorJoptionpaneTitle"), JOptionPane.WARNING_MESSAGE);
                // Check if the selected url is a valid formated url(via
                // urlIsValid() method) and inform the user via JoptioPane
                // message
            } else if (!(urlIsValid(urlText))) {
                JOptionPane.showMessageDialog(urlLaunchButton.getParent(),
                        Translator.translate("InvalidUrlJoptionpaneMsg"),
                        Translator.translate("UrlErrorJoptionpaneTitle"), JOptionPane.WARNING_MESSAGE);
                // Call the method LaunchSelectedURL() using the selected
                // url as input
            } else {
                LaunchSelectedURL(urlText);
            }
        }
    });
    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    urlPanel.add(urlLaunchButton, c);

    JButton urlCopyButton = new JButton();
    urlCopyButton.setIcon(Util.loadImage("copy-icon.png"));
    urlCopyButton.setToolTipText("Copy");
    urlCopyButton.setEnabled(true);
    urlCopyButton.setMargin(new Insets(0, 0, 0, 0));
    urlCopyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            copyTextField(url);
        }
    });
    c.gridx = 2;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    urlPanel.add(urlCopyButton, c);

    JButton urlPasteButton = new JButton();
    urlPasteButton.setIcon(Util.loadImage("paste-icon.png"));
    urlPasteButton.setToolTipText("Paste");
    urlPasteButton.setEnabled(!readOnly);
    urlPasteButton.setMargin(new Insets(0, 0, 0, 0));
    urlPasteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            pasteToTextField(url);
        }
    });
    c.gridx = 3;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    urlPanel.add(urlPasteButton, c);

    c.gridx = 1;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    container.add(urlPanel, c);

    // Notes Row
    JLabel notesLabel = new JLabel(Translator.translate("notes"));
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    container.add(notesLabel, c);

    // This panel will hold the Notes text area and the copy and paste
    // buttons.
    JPanel notesPanel = new JPanel(new GridBagLayout());

    notes = new JTextArea(new String(pAccount.getNotes()), 10, 20);
    if (readOnly) {
        notes.setEditable(false);
    }
    notes.setLineWrap(true); // Enable line wrapping.
    notes.setWrapStyleWord(true); // Line wrap at whitespace.
    JScrollPane notesScrollPane = new JScrollPane(notes);
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.BOTH;
    notesPanel.add(notesScrollPane, c);

    JButton notesCopyButton = new JButton();
    notesCopyButton.setIcon(Util.loadImage("copy-icon.png"));
    notesCopyButton.setToolTipText("Copy");
    notesCopyButton.setEnabled(true);
    notesCopyButton.setMargin(new Insets(0, 0, 0, 0));
    notesCopyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            copyTextArea(notes);
        }
    });
    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    notesPanel.add(notesCopyButton, c);

    JButton notesPasteButton = new JButton();
    notesPasteButton.setIcon(Util.loadImage("paste-icon.png"));
    notesPasteButton.setToolTipText("Paste");
    notesPasteButton.setEnabled(!readOnly);
    notesPasteButton.setMargin(new Insets(0, 0, 0, 0));
    notesPasteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            pasteToTextArea(notes);
        }
    });
    c.gridx = 2;
    c.gridy = 0;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.insets = new Insets(0, 0, 0, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    notesPanel.add(notesPasteButton, c);

    c.gridx = 1;
    c.gridy = 4;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(10, 10, 10, 10);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    container.add(notesPanel, c);

    // Seperator Row
    JSeparator sep = new JSeparator();
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.PAGE_END;
    c.insets = new Insets(0, 0, 0, 0);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    container.add(sep, c);

    // Button Row
    JPanel buttonPanel = new JPanel();
    JButton okButton = new JButton(Translator.translate("ok"));
    // Link Enter key to okButton
    getRootPane().setDefaultButton(okButton);
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            okButtonAction();
        }
    });
    buttonPanel.add(okButton);
    if (!readOnly) {
        JButton cancelButton = new JButton(Translator.translate("cancel"));
        cancelButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                closeButtonAction();
            }
        });
        buttonPanel.add(cancelButton);
    }
    c.gridx = 0;
    c.gridy = 6;
    c.anchor = GridBagConstraints.PAGE_END;
    c.insets = new Insets(5, 0, 5, 0);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.NONE;
    container.add(buttonPanel, c);
}

From source file:com.sec.ose.osi.ui.frm.login.JPanLogin.java

/*********
 * Base//w  w  w  . j  a va 2s.  com
 **********/
private JPanel getJPanelBase() {
    if (jPanelBase == null) {
        GridBagConstraints gridBagConstraintsUserInfo = new GridBagConstraints();
        gridBagConstraintsUserInfo.gridx = 0;
        gridBagConstraintsUserInfo.gridy = 0;
        gridBagConstraintsUserInfo.weightx = 1.0;
        gridBagConstraintsUserInfo.insets = new Insets(0, 10, 0, 10);
        gridBagConstraintsUserInfo.fill = GridBagConstraints.HORIZONTAL;

        GridBagConstraints gridBagConstraintsOkReset = new GridBagConstraints();
        gridBagConstraintsOkReset.gridx = 1;
        gridBagConstraintsOkReset.gridy = 0;
        gridBagConstraintsOkReset.weighty = 1.0;
        gridBagConstraintsOkReset.insets = new Insets(0, 0, 0, 10);
        gridBagConstraintsOkReset.fill = GridBagConstraints.BOTH;

        jPanelBase = new JPanel();
        jPanelBase.setLayout(new GridBagLayout());
        jPanelBase.add(getJPanelForUserInfo(), gridBagConstraintsUserInfo);
        jPanelBase.add(getJPanelForOkReset(), gridBagConstraintsOkReset);
    }
    return jPanelBase;
}

From source file:userinterface.properties.GUIGraphPicker.java

/** This method is called from within the constructor to
 * initialize the form.//from  w  w  w  .  j a  v  a  2s.c  om
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    buttonGroup1 = new javax.swing.ButtonGroup();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    topComboLabel = new javax.swing.JLabel();
    jPanel6 = new javax.swing.JPanel();
    selectAxisConstantCombo = new javax.swing.JComboBox();
    jPanel7 = new javax.swing.JPanel();
    middleLabel = new javax.swing.JLabel();
    constantTablePanel = new javax.swing.JPanel();
    jPanel9 = new javax.swing.JPanel();
    jPanel10 = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    newGraphRadio = new javax.swing.JRadioButton();
    existingGraphRadio = new javax.swing.JRadioButton();
    jPanel11 = new javax.swing.JPanel();
    existingGraphCombo = new javax.swing.JComboBox();
    jPanel12 = new javax.swing.JPanel();
    seriesNameLabel = new javax.swing.JLabel();
    seriesNameField = new javax.swing.JTextField();
    jPanel4 = new javax.swing.JPanel();
    lineOkayButton = new javax.swing.JButton();
    lineCancelButton = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();

    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
        }
    });

    jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);
    jPanel1.setLayout(new java.awt.BorderLayout());

    jPanel1.setBorder(new javax.swing.border.TitledBorder("Line Graph"));
    jPanel1.setFocusable(false);
    jPanel1.setEnabled(false);
    GridBagLayout gbl_jPanel3 = new GridBagLayout();
    gbl_jPanel3.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
    gbl_jPanel3.columnWeights = new double[] { 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
    jPanel3.setLayout(gbl_jPanel3);

    lblPlotType = new JLabel("Plot type:");
    GridBagConstraints gbc_lblPlotType = new GridBagConstraints();
    gbc_lblPlotType.anchor = GridBagConstraints.WEST;
    gbc_lblPlotType.insets = new Insets(0, 0, 5, 5);
    gbc_lblPlotType.gridx = 1;
    gbc_lblPlotType.gridy = 0;
    jPanel3.add(lblPlotType, gbc_lblPlotType);

    panel = new JPanel();
    GridBagConstraints gbc_panel = new GridBagConstraints();
    gbc_panel.anchor = GridBagConstraints.WEST;
    gbc_panel.insets = new Insets(0, 0, 5, 5);
    gbc_panel.fill = GridBagConstraints.VERTICAL;
    gbc_panel.gridx = 3;
    gbc_panel.gridy = 0;
    jPanel3.add(panel, gbc_panel);

    plotType2d = new JRadioButton("2D");
    plotType2d.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            plotType2DRadioActionPerformed(e);

        }
    });
    panel.add(plotType2d);

    plotType3d = new JRadioButton("3D");
    plotType3d.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            plotType3DRadioActionPerformed(e);
        }
    });
    panel.add(plotType3d);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    jPanel3.add(jPanel5, gridBagConstraints);

    topComboLabel.setText("Select x axis constant:");
    gridBagConstraints_1 = new java.awt.GridBagConstraints();
    gridBagConstraints_1.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_1.gridx = 1;
    gridBagConstraints_1.gridy = 2;
    gridBagConstraints_1.anchor = java.awt.GridBagConstraints.WEST;
    jPanel3.add(topComboLabel, gridBagConstraints_1);

    gridBagConstraints_2 = new java.awt.GridBagConstraints();
    gridBagConstraints_2.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_2.gridx = 2;
    gridBagConstraints_2.gridy = 1;
    jPanel3.add(jPanel6, gridBagConstraints_2);

    selectAxisConstantCombo.setPreferredSize(new java.awt.Dimension(100, 24));
    selectAxisConstantCombo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            selectAxisConstantComboActionPerformed(evt);
        }
    });

    gridBagConstraints_3 = new java.awt.GridBagConstraints();
    gridBagConstraints_3.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_3.gridx = 3;
    gridBagConstraints_3.gridy = 2;
    gridBagConstraints_3.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel3.add(selectAxisConstantCombo, gridBagConstraints_3);

    gridBagConstraints_4 = new java.awt.GridBagConstraints();
    gridBagConstraints_4.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_4.gridx = 0;
    gridBagConstraints_4.gridy = 3;
    jPanel3.add(jPanel7, gridBagConstraints_4);

    lblSelectYAxis = new JLabel("Select y axis constant:");
    GridBagConstraints gbc_lblSelectYAxis = new GridBagConstraints();
    gbc_lblSelectYAxis.anchor = GridBagConstraints.WEST;
    gbc_lblSelectYAxis.insets = new Insets(0, 0, 5, 5);
    gbc_lblSelectYAxis.gridx = 1;
    gbc_lblSelectYAxis.gridy = 4;
    jPanel3.add(lblSelectYAxis, gbc_lblSelectYAxis);

    selectYaxisConstantCombo = new JComboBox();
    selectYaxisConstantCombo.setPreferredSize(new java.awt.Dimension(100, 24));
    selectYaxisConstantCombo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            selectYAxisConstantComboActionPerformed(e);

        }
    });
    GridBagConstraints gbc_selectYaxisConstantCombo = new GridBagConstraints();
    gbc_selectYaxisConstantCombo.insets = new Insets(0, 0, 5, 5);
    gbc_selectYaxisConstantCombo.fill = GridBagConstraints.HORIZONTAL;
    gbc_selectYaxisConstantCombo.gridx = 3;
    gbc_selectYaxisConstantCombo.gridy = 4;
    jPanel3.add(selectYaxisConstantCombo, gbc_selectYaxisConstantCombo);

    panel_1 = new JPanel();
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.insets = new Insets(0, 0, 5, 5);
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 5;
    jPanel3.add(panel_1, gbc_panel_1);

    middleLabel.setText("Define other constants:");
    gridBagConstraints_5 = new java.awt.GridBagConstraints();
    gridBagConstraints_5.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_5.gridx = 1;
    gridBagConstraints_5.gridy = 6;
    gridBagConstraints_5.anchor = java.awt.GridBagConstraints.WEST;
    jPanel3.add(middleLabel, gridBagConstraints_5);

    constantTablePanel.setLayout(new java.awt.BorderLayout());

    gridBagConstraints_6 = new java.awt.GridBagConstraints();
    gridBagConstraints_6.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_6.gridx = 3;
    gridBagConstraints_6.gridy = 6;
    gridBagConstraints_6.gridwidth = 3;
    gridBagConstraints_6.gridheight = 2;
    gridBagConstraints_6.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints_6.weightx = 1.0;
    gridBagConstraints_6.weighty = 1.0;
    jPanel3.add(constantTablePanel, gridBagConstraints_6);

    gridBagConstraints_7 = new java.awt.GridBagConstraints();
    gridBagConstraints_7.insets = new Insets(0, 0, 5, 0);
    gridBagConstraints_7.gridx = 6;
    gridBagConstraints_7.gridy = 1;
    jPanel3.add(jPanel9, gridBagConstraints_7);

    gridBagConstraints_8 = new java.awt.GridBagConstraints();
    gridBagConstraints_8.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_8.gridx = 0;
    gridBagConstraints_8.gridy = 8;
    jPanel3.add(jPanel10, gridBagConstraints_8);

    jLabel3.setText("Add Series to:");
    gridBagConstraints_9 = new java.awt.GridBagConstraints();
    gridBagConstraints_9.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_9.gridx = 1;
    gridBagConstraints_9.gridy = 9;
    gridBagConstraints_9.anchor = java.awt.GridBagConstraints.WEST;
    jPanel3.add(jLabel3, gridBagConstraints_9);

    newGraphRadio.setText("New Graph");
    buttonGroup1.add(newGraphRadio);
    newGraphRadio.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            newGraphRadioActionPerformed(evt);
        }
    });

    gridBagConstraints_10 = new java.awt.GridBagConstraints();
    gridBagConstraints_10.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_10.gridx = 3;
    gridBagConstraints_10.gridy = 9;
    gridBagConstraints_10.anchor = java.awt.GridBagConstraints.WEST;
    jPanel3.add(newGraphRadio, gridBagConstraints_10);

    existingGraphRadio.setText("Existing Graph");
    buttonGroup1.add(existingGraphRadio);
    existingGraphRadio.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            existingGraphRadioActionPerformed(evt);
        }
    });

    gridBagConstraints_11 = new java.awt.GridBagConstraints();
    gridBagConstraints_11.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_11.gridx = 3;
    gridBagConstraints_11.gridy = 10;
    gridBagConstraints_11.anchor = java.awt.GridBagConstraints.WEST;
    jPanel3.add(existingGraphRadio, gridBagConstraints_11);

    gridBagConstraints_12 = new java.awt.GridBagConstraints();
    gridBagConstraints_12.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_12.gridx = 4;
    gridBagConstraints_12.gridy = 1;
    jPanel3.add(jPanel11, gridBagConstraints_12);

    gridBagConstraints_13 = new java.awt.GridBagConstraints();
    gridBagConstraints_13.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_13.gridx = 5;
    gridBagConstraints_13.gridy = 10;
    gridBagConstraints_13.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints_13.anchor = java.awt.GridBagConstraints.WEST;
    jPanel3.add(existingGraphCombo, gridBagConstraints_13);

    gridBagConstraints_14 = new java.awt.GridBagConstraints();
    gridBagConstraints_14.insets = new Insets(0, 0, 5, 5);
    gridBagConstraints_14.gridx = 0;
    gridBagConstraints_14.gridy = 11;
    jPanel3.add(jPanel12, gridBagConstraints_14);

    seriesNameLabel.setText("Series name:");
    gridBagConstraints_15 = new java.awt.GridBagConstraints();
    gridBagConstraints_15.insets = new Insets(0, 0, 0, 5);
    gridBagConstraints_15.gridx = 1;
    gridBagConstraints_15.gridy = 12;
    gridBagConstraints_15.anchor = java.awt.GridBagConstraints.WEST;
    jPanel3.add(seriesNameLabel, gridBagConstraints_15);

    gridBagConstraints_16 = new java.awt.GridBagConstraints();
    gridBagConstraints_16.insets = new Insets(0, 0, 0, 5);
    gridBagConstraints_16.gridx = 3;
    gridBagConstraints_16.gridy = 12;
    gridBagConstraints_16.gridwidth = 3;
    gridBagConstraints_16.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel3.add(seriesNameField, gridBagConstraints_16);

    jPanel1.add(jPanel3, java.awt.BorderLayout.CENTER);

    jPanel4.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

    lineOkayButton.setText("Okay");
    lineOkayButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            lineOkayButtonActionPerformed(evt);
        }
    });

    jPanel4.add(lineOkayButton);

    lineCancelButton.setText("Cancel");
    lineCancelButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            lineCancelButtonActionPerformed(evt);
        }
    });

    jPanel4.add(lineCancelButton);

    jPanel1.add(jPanel4, java.awt.BorderLayout.SOUTH);

    //jTabbedPane1.addTab("", GUIPrism.getIconFromImage("lineGraph.png"), jPanel1);

    jPanel2.setBorder(new javax.swing.border.TitledBorder("Bar Graph"));
    jPanel2.setEnabled(false);
    //jTabbedPane1.addTab("", GUIPrism.getIconFromImage("barGraph.png"), jPanel2);

    getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

    pack();
}

From source file:de.tor.tribes.ui.views.DSWorkbenchStatsFrame.java

/** This method is called from within the constructor to
 * initialize the form./*from  w ww  .  jav a2  s  .  c  om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jMainStatPanel = new javax.swing.JPanel();
    jChartPanel = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jAllyList = new javax.swing.JList();
    jScrollPane2 = new javax.swing.JScrollPane();
    jTribeList = new javax.swing.JList();
    jShowPoints = new javax.swing.JCheckBox();
    jShowRank = new javax.swing.JCheckBox();
    jShowVillages = new javax.swing.JCheckBox();
    jShowKillsOff = new javax.swing.JCheckBox();
    jShowRankOff = new javax.swing.JCheckBox();
    jShowKillsDef = new javax.swing.JCheckBox();
    jShowRankDef = new javax.swing.JCheckBox();
    jShowItemValues = new javax.swing.JCheckBox();
    jShowLegend = new javax.swing.JCheckBox();
    jShowLines = new javax.swing.JCheckBox();
    jShowDataPoints = new javax.swing.JCheckBox();
    jViewSelectionBox = new javax.swing.JComboBox();
    jStatCreatePanel = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jScrollPane7 = new javax.swing.JScrollPane();
    jPointsPane = new javax.swing.JEditorPane();
    jScrollPane10 = new javax.swing.JScrollPane();
    jBashOffPane = new javax.swing.JEditorPane();
    jScrollPane11 = new javax.swing.JScrollPane();
    jBashDefPane = new javax.swing.JEditorPane();
    jScrollPane12 = new javax.swing.JScrollPane();
    jWinnerLoserPane = new javax.swing.JEditorPane();
    jButton8 = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jLabel4 = new javax.swing.JLabel();
    jStartDate = new de.tor.tribes.ui.components.DateTimeField();
    jLabel5 = new javax.swing.JLabel();
    jEndDate = new de.tor.tribes.ui.components.DateTimeField();
    jPanel11 = new javax.swing.JPanel();
    jWeeklyStats = new javax.swing.JButton();
    jMonthlyStats = new javax.swing.JButton();
    jUseTop10Box = new javax.swing.JCheckBox();
    jAlwaysOnTopBox = new javax.swing.JCheckBox();
    jStatsPanel = new org.jdesktop.swingx.JXPanel();
    capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel();

    jMainStatPanel.setMinimumSize(new java.awt.Dimension(516, 300));
    jMainStatPanel.setLayout(new java.awt.BorderLayout());

    jChartPanel.setBackground(new java.awt.Color(239, 235, 223));
    jChartPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jChartPanel.setPreferredSize(new java.awt.Dimension(499, 300));
    jChartPanel.setLayout(new java.awt.BorderLayout());
    jMainStatPanel.add(jChartPanel, java.awt.BorderLayout.CENTER);

    jPanel7.setPreferredSize(new java.awt.Dimension(516, 150));
    jPanel7.setLayout(new java.awt.GridBagLayout());

    jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("berwachte Stmme"));
    jScrollPane1.setMinimumSize(new java.awt.Dimension(258, 100));
    jScrollPane1.setPreferredSize(new java.awt.Dimension(258, 150));

    jScrollPane1.setViewportView(jAllyList);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel7.add(jScrollPane1, gridBagConstraints);

    jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("berwachte Spieler"));
    jScrollPane2.setMinimumSize(new java.awt.Dimension(258, 100));
    jScrollPane2.setPreferredSize(new java.awt.Dimension(258, 150));

    jScrollPane2.setViewportView(jTribeList);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel7.add(jScrollPane2, gridBagConstraints);

    jMainStatPanel.add(jPanel7, java.awt.BorderLayout.NORTH);

    jShowPoints.setSelected(true);
    jShowPoints.setText("Punkte anzeigen");
    jShowPoints.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowRank.setText("Rang anzeigen");
    jShowRank.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowVillages.setText("Drfer anzeigen");
    jShowVillages.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowKillsOff.setText("Kills (Off) anzeigen");
    jShowKillsOff.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowRankOff.setText("Rang (Off) anzeigen");
    jShowRankOff.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowKillsDef.setText("Kills (Deff) anzeigen");
    jShowKillsDef.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowRankDef.setText("Rang (Deff) anzeigen");
    jShowRankDef.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowItemValues.setText("Werte anzeigen");
    jShowItemValues.setToolTipText("Zeigt die Werte der Datenpunkte im Diagramm an");
    jShowItemValues.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowLegend.setSelected(true);
    jShowLegend.setText("Legende anzeigen");
    jShowLegend.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowLines.setSelected(true);
    jShowLines.setText("Linien anzeigen");
    jShowLines.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jShowDataPoints.setSelected(true);
    jShowDataPoints.setText("Datenpunkte anzeigen");
    jShowDataPoints.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireUpdateChartEvent(evt);
        }
    });

    jViewSelectionBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Punkte", "Rang (Punkte)",
            "Drfer", "Kills (Off)", "Rang (Off)", "Kills (Def)", "Rang (Def)" }));
    jViewSelectionBox.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireViewChangedEvent(evt);
        }
    });

    jStatCreatePanel.setBackground(new java.awt.Color(239, 235, 223));

    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Auswertung"));

    jPointsPane.setContentType("text/html"); // NOI18N
    jPointsPane.setEditable(false);
    jScrollPane7.setViewportView(jPointsPane);

    jTabbedPane1.addTab("Punkte", new javax.swing.ImageIcon(getClass().getResource("/res/goblet_gold.png")),
            jScrollPane7); // NOI18N

    jBashOffPane.setContentType("text/html"); // NOI18N
    jBashOffPane.setEditable(false);
    jScrollPane10.setViewportView(jBashOffPane);

    jTabbedPane1.addTab("Bash (Off)", new javax.swing.ImageIcon(getClass().getResource("/res/barracks.png")),
            jScrollPane10); // NOI18N

    jBashDefPane.setContentType("text/html"); // NOI18N
    jBashDefPane.setEditable(false);
    jScrollPane11.setViewportView(jBashDefPane);

    jTabbedPane1.addTab("Bash (Deff)", new javax.swing.ImageIcon(getClass().getResource("/res/ally.png")),
            jScrollPane11); // NOI18N

    jWinnerLoserPane.setContentType("text/html"); // NOI18N
    jWinnerLoserPane.setEditable(false);
    jScrollPane12.setViewportView(jWinnerLoserPane);

    jTabbedPane1.addTab("Gewinner/Verlierer",
            new javax.swing.ImageIcon(getClass().getResource("/res/up_plus.png")), jScrollPane12); // NOI18N

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE)
                    .addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addContainerGap()));

    jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/select.png"))); // NOI18N
    jButton8.setText("Auswertung erstellen");
    jButton8.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            fireGenerateStatsEvent(evt);
        }
    });

    jPanel1.setOpaque(false);
    jPanel1.setLayout(new java.awt.GridBagLayout());

    jLabel4.setText("Zeitraum (Start)");
    jPanel1.add(jLabel4, new java.awt.GridBagConstraints());

    jStartDate.setTimeEnabled(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10);
    jPanel1.add(jStartDate, gridBagConstraints);

    jLabel5.setText("Zeitraum (Ende)");
    jPanel1.add(jLabel5, new java.awt.GridBagConstraints());

    jEndDate.setTimeEnabled(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
    jPanel1.add(jEndDate, gridBagConstraints);

    jPanel11.setOpaque(false);
    jPanel11.setPreferredSize(new java.awt.Dimension(520, 100));
    jPanel11.setLayout(new java.awt.GridBagLayout());

    jWeeklyStats.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/calendar_7.png"))); // NOI18N
    jWeeklyStats.setText("Statistik fr eine Woche (Heute - 7 Tage)");
    jWeeklyStats.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
    jWeeklyStats.setMaximumSize(new java.awt.Dimension(40, 25));
    jWeeklyStats.setMinimumSize(new java.awt.Dimension(40, 25));
    jWeeklyStats.setPreferredSize(new java.awt.Dimension(260, 25));
    jWeeklyStats.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            fireChangeStatTimeEvent(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
    jPanel11.add(jWeeklyStats, gridBagConstraints);

    jMonthlyStats.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/calendar_31.png"))); // NOI18N
    jMonthlyStats.setText("Statistik fr einen Monat (Heute - 31 Tage)");
    jMonthlyStats.setMaximumSize(new java.awt.Dimension(40, 25));
    jMonthlyStats.setMinimumSize(new java.awt.Dimension(40, 25));
    jMonthlyStats.setPreferredSize(new java.awt.Dimension(260, 25));
    jMonthlyStats.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            fireChangeStatTimeEvent(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    jPanel11.add(jMonthlyStats, gridBagConstraints);

    jUseTop10Box.setText("Nur Top-10 anzeigen");

    javax.swing.GroupLayout jStatCreatePanelLayout = new javax.swing.GroupLayout(jStatCreatePanel);
    jStatCreatePanel.setLayout(jStatCreatePanelLayout);
    jStatCreatePanelLayout.setHorizontalGroup(jStatCreatePanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jStatCreatePanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(jStatCreatePanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jStatCreatePanelLayout.createSequentialGroup()
                                    .addGroup(jStatCreatePanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 589,
                                                    Short.MAX_VALUE)
                                            .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, 589,
                                                    Short.MAX_VALUE))
                                    .addContainerGap())
                            .addGroup(jStatCreatePanelLayout.createSequentialGroup()
                                    .addGroup(jStatCreatePanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(jStatCreatePanelLayout.createSequentialGroup()
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            287, Short.MAX_VALUE)
                                                    .addComponent(jUseTop10Box).addGap(18, 18, 18)
                                                    .addComponent(jButton8)))
                                    .addGap(14, 14, 14)))));
    jStatCreatePanelLayout.setVerticalGroup(jStatCreatePanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jStatCreatePanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 51,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(jStatCreatePanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jUseTop10Box, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton8))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()));

    setTitle("Statistiken");
    getContentPane().setLayout(new java.awt.GridBagLayout());

    jAlwaysOnTopBox.setText("Immer im Vordergrund");
    jAlwaysOnTopBox.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            fireAlwaysOnTopEvent(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(jAlwaysOnTopBox, gridBagConstraints);

    jStatsPanel.setBackground(new java.awt.Color(239, 235, 223));
    jStatsPanel.setMinimumSize(new java.awt.Dimension(700, 500));
    jStatsPanel.setPreferredSize(new java.awt.Dimension(700, 500));
    jStatsPanel.setLayout(new java.awt.BorderLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(jStatsPanel, gridBagConstraints);

    capabilityInfoPanel1.setCopyable(false);
    capabilityInfoPanel1.setPastable(false);
    capabilityInfoPanel1.setSearchable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(capabilityInfoPanel1, gridBagConstraints);

    pack();
}

From source file:junk.gui.HazardSpectrumApplication.java

public void togglePlot() {
    panel.removeAll();//from  ww  w .jav a2  s . c o m
    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:de.tor.tribes.ui.views.DSWorkbenchTagFrame.java

/** This method is called from within the constructor to
 * initialize the form.//from   w  ww  .j  a  v a  2s.c  o m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    jTagsPanel = new javax.swing.JPanel();
    jTagTablePanel = new org.jdesktop.swingx.JXPanel();
    infoPanel = new org.jdesktop.swingx.JXCollapsiblePane();
    jXLabel1 = new org.jdesktop.swingx.JXLabel();
    jScrollPane4 = new javax.swing.JScrollPane();
    villageListPanel = new javax.swing.JPanel();
    jScrollPane5 = new javax.swing.JScrollPane();
    jVillageList = new javax.swing.JList();
    jAlwaysOnTopBox = new javax.swing.JCheckBox();
    jTagPanel = new org.jdesktop.swingx.JXPanel();
    capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel();

    jTagsPanel.setLayout(new java.awt.BorderLayout(10, 0));

    jTagTablePanel.setLayout(new java.awt.BorderLayout());

    infoPanel.setCollapsed(true);
    infoPanel.setInheritAlpha(false);

    jXLabel1.setText("Keine Meldung");
    jXLabel1.setOpaque(true);
    jXLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseReleased(java.awt.event.MouseEvent evt) {
            jXLabel1fireHideInfoEvent(evt);
        }
    });
    infoPanel.add(jXLabel1, java.awt.BorderLayout.CENTER);

    jTagTablePanel.add(infoPanel, java.awt.BorderLayout.SOUTH);

    jTagsTable
            .setModel(new javax.swing.table.DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null } },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
    jScrollPane4.setViewportView(jTagsTable);

    jTagTablePanel.add(jScrollPane4, java.awt.BorderLayout.CENTER);

    jTagsPanel.add(jTagTablePanel, java.awt.BorderLayout.CENTER);

    villageListPanel.setPreferredSize(new java.awt.Dimension(180, 80));
    villageListPanel.setLayout(new java.awt.BorderLayout());

    jScrollPane5.setBorder(javax.swing.BorderFactory.createTitledBorder("Zugeordnete Drfer"));

    jScrollPane5.setViewportView(jVillageList);

    villageListPanel.add(jScrollPane5, java.awt.BorderLayout.CENTER);

    jTagsPanel.add(villageListPanel, java.awt.BorderLayout.WEST);

    setTitle("Gruppen");
    getContentPane().setLayout(new java.awt.GridBagLayout());

    jAlwaysOnTopBox.setText("Immer im Vordergrund");
    jAlwaysOnTopBox.setOpaque(false);
    jAlwaysOnTopBox.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            fireAlwaysOnTopEvent(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(jAlwaysOnTopBox, gridBagConstraints);

    jTagPanel.setBackground(new java.awt.Color(239, 235, 223));
    jTagPanel.setPreferredSize(new java.awt.Dimension(500, 300));
    jTagPanel.setLayout(new java.awt.BorderLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(jTagPanel, gridBagConstraints);

    capabilityInfoPanel1.setCopyable(false);
    capabilityInfoPanel1.setSearchable(false);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    getContentPane().add(capabilityInfoPanel1, gridBagConstraints);

    pack();
}

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;//from w  w  w  .  ja  v  a 2  s .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;
}