Example usage for java.awt GridBagLayout GridBagLayout

List of usage examples for java.awt GridBagLayout GridBagLayout

Introduction

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

Prototype

public GridBagLayout() 

Source Link

Document

Creates a grid bag layout manager.

Usage

From source file:fr.free.hd.servers.gui.FaceView.java

@Override
protected JComponent createControl() {
    final GridBagLayout layout = new GridBagLayout();
    final JPanel view = new JPanel(layout);

    //Face list//from  ww w  .j a  va 2s.  c o m
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.gridheight = 3;
    c.weighty = 0.75;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    final JList facesList = CreateList();
    facesList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting() == false) {
                if (facesList.getSelectedIndex() != -1) {
                    face = (Face) facesList.getSelectedValue();
                    updateLabel();
                } else {

                }
            }
        }
    });
    view.add(facesList, c);

    // New button
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 3;
    c.fill = GridBagConstraints.BOTH;
    JButton btnNew = new JButton("Nouveau");
    btnNew.setEnabled(false);
    view.add(btnNew, c);

    // Save button
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 4;
    c.fill = GridBagConstraints.BOTH;
    JButton btnModified = new JButton("Modifier");
    btnModified.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            facesDAO.storeFace(face);
        }
    });
    view.add(btnModified, c);

    //Draw Face
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 0;
    c.gridheight = 5;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0.60;
    lblFace = new JLabel();
    view.add(lblFace, c);

    //Hand Panel
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    JPanel pnlHand = createPosition();
    view.add(pnlHand, c);

    //Mouth Panel
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 1;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    JPanel pnlKind = createKind();
    view.add(pnlKind, c);

    //Mouth Panel
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 2;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    JPanel pnlMouth = createMouth();
    view.add(pnlMouth, c);

    // Picture filename
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.BOTH;
    JTextField txtPath = new JTextField();
    view.add(txtPath, c);

    //Browse Button
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 5;
    c.fill = GridBagConstraints.BOTH;
    JButton btnBrownse = new JButton("Browse");
    view.add(btnBrownse, c);

    //Select default face
    if (facesList.getModel().getSize() > 0) {
        facesList.setSelectedIndex(0);
        position = HandPositionEnum.HAND_POSITION_MENTON;
        kind = HandKeyEnum.HAND_KEY_2V;
    }

    return view;
}

From source file:algorithm.OpenStegoRandomLSBSteganography.java

private void createConfigurationGui() {
    initButtons();/*from   ww  w.j a  v  a 2  s.c  o m*/
    panel = new GUIPanel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    panel.add(new JLabel("<html><h2>LSB embedding options</h2></html>"), constraints);
    constraints.gridy++;
    panel.add(new JLabel("Compress payload files (default true):"), constraints);
    constraints.gridx++;
    panel.add(trueCompressionButton, constraints);
    constraints.gridx++;
    panel.add(falseCompressionButton, constraints);
    constraints.gridx = 0;
    constraints.gridy++;
}

From source file:br.org.acessobrasil.silvinha.vista.panels.PainelSenha.java

public PainelSenha() {

    lblNome = new JLabel(GERAL.USUARIO);
    lblPass = new JLabel(GERAL.SENHA);
    txtName = new JTextField(10);
    txtPass = new JPasswordField(10);

    GridBagLayout bag = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    this.setLayout(bag);

    lblNome.setHorizontalAlignment(JLabel.RIGHT);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;//from   www  .j  a  va  2s  . c  om
    gbc.insets = new Insets(2, 10, 2, 10);
    this.add(lblNome, gbc);

    txtName.setAlignmentX(SwingConstants.WEST);
    txtName.addActionListener(new ActivateNextTextFieldListener(txtPass));
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(2, 0, 2, 10);
    this.add(txtName, gbc);

    lblPass.setHorizontalAlignment(JLabel.RIGHT);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = 1;
    gbc.weightx = 1.0;
    gbc.insets = new Insets(2, 10, 2, 10);
    this.add(lblPass, gbc);

    txtPass.setAlignmentX(SwingConstants.WEST);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(2, 0, 2, 10);
    this.add(txtPass, gbc);

    setSize(300, 130);
    setLocation(300, 300);
    //      this.setBackground(corDefault);

    op = new JOptionPane(this, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    //      op.setBackground(corDefault);

}

From source file:com.smart.aqimonitor.client.AqiSettingDialog.java

/**
 * Create the dialog.//from  w  w w .ja va 2  s. c om
 */
public AqiSettingDialog(Frame owner, final AbstractAqiParser aqiParser) {
    super(owner);
    this.aqiParser = aqiParser;
    setTitle("\u8BBE\u7F6E");
    setResizable(false);
    setBounds(100, 100, 450, 135);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 33, 48, 66, 41, 48, 66, 0, 0 };
    gbl_contentPanel.rowHeights = new int[] { 21, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    contentPanel.setLayout(gbl_contentPanel);
    {
        JLabel lblRetryTimes = new JLabel("\u91CD\u8BD5\u6B21\u6570\uFF1A");
        GridBagConstraints gbc_lblRetryTimes = new GridBagConstraints();
        gbc_lblRetryTimes.anchor = GridBagConstraints.WEST;
        gbc_lblRetryTimes.insets = new Insets(0, 0, 5, 5);
        gbc_lblRetryTimes.gridx = 1;
        gbc_lblRetryTimes.gridy = 0;
        contentPanel.add(lblRetryTimes, gbc_lblRetryTimes);
    }
    {
        tfRetryTimes = new JTextField();
        tfRetryTimes.setPreferredSize(new Dimension(6, 29));
        tfRetryTimes.setMinimumSize(new Dimension(60, 29));
        GridBagConstraints gbc_tfRetryTimes = new GridBagConstraints();
        gbc_tfRetryTimes.anchor = GridBagConstraints.NORTHWEST;
        gbc_tfRetryTimes.insets = new Insets(0, 0, 5, 5);
        gbc_tfRetryTimes.gridx = 2;
        gbc_tfRetryTimes.gridy = 0;
        contentPanel.add(tfRetryTimes, gbc_tfRetryTimes);
        tfRetryTimes.setColumns(10);
    }
    {
        JLabel lblRetryGap = new JLabel("\u91CD\u8BD5\u95F4\u9694\uFF1A");
        GridBagConstraints gbc_lblRetryGap = new GridBagConstraints();
        gbc_lblRetryGap.anchor = GridBagConstraints.WEST;
        gbc_lblRetryGap.insets = new Insets(0, 0, 5, 5);
        gbc_lblRetryGap.gridx = 4;
        gbc_lblRetryGap.gridy = 0;
        contentPanel.add(lblRetryGap, gbc_lblRetryGap);
    }
    {
        tfRetryGap = new JTextField();
        tfRetryGap.setMinimumSize(new Dimension(60, 29));
        tfRetryGap.setPreferredSize(new Dimension(60, 29));
        GridBagConstraints gbc_tfRetryGap = new GridBagConstraints();
        gbc_tfRetryGap.insets = new Insets(0, 0, 5, 5);
        gbc_tfRetryGap.anchor = GridBagConstraints.NORTHWEST;
        gbc_tfRetryGap.gridx = 5;
        gbc_tfRetryGap.gridy = 0;
        contentPanel.add(tfRetryGap, gbc_tfRetryGap);
        tfRetryGap.setColumns(10);
    }
    {
        JLabel label = new JLabel("\u5206\u949F");
        GridBagConstraints gbc_label = new GridBagConstraints();
        gbc_label.insets = new Insets(0, 0, 5, 0);
        gbc_label.gridx = 6;
        gbc_label.gridy = 0;
        contentPanel.add(label, gbc_label);
    }
    {
        JLabel lblExportPath = new JLabel("\u8F93\u51FA\u8DEF\u5F84\uFF1A");
        GridBagConstraints gbc_lblExportPath = new GridBagConstraints();
        gbc_lblExportPath.anchor = GridBagConstraints.EAST;
        gbc_lblExportPath.insets = new Insets(0, 0, 0, 5);
        gbc_lblExportPath.gridx = 1;
        gbc_lblExportPath.gridy = 1;
        contentPanel.add(lblExportPath, gbc_lblExportPath);
    }
    {
        tfExportPath = new JTextField();
        tfExportPath.setEditable(false);
        tfExportPath.setPreferredSize(new Dimension(180, 29));
        tfExportPath.setMinimumSize(new Dimension(180, 29));
        GridBagConstraints gbc_tfExportPath = new GridBagConstraints();
        gbc_tfExportPath.gridwidth = 4;
        gbc_tfExportPath.insets = new Insets(0, 0, 0, 5);
        gbc_tfExportPath.fill = GridBagConstraints.HORIZONTAL;
        gbc_tfExportPath.gridx = 2;
        gbc_tfExportPath.gridy = 1;
        contentPanel.add(tfExportPath, gbc_tfExportPath);
        tfExportPath.setColumns(10);
    }
    {
        JButton button = new JButton("...");
        button.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                fDialog = new JFileChooser(); // 
                fDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                int result = fDialog.showOpenDialog(contentPanel);
                if (result == JFileChooser.APPROVE_OPTION) {
                    tfExportPath.setText(fDialog.getSelectedFile().getAbsolutePath());
                }
            }
        });
        GridBagConstraints gbc_button = new GridBagConstraints();
        gbc_button.gridx = 6;
        gbc_button.gridy = 1;
        contentPanel.add(button, gbc_button);
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("\u786E\u5B9A");
            okButton.setName("settingOk");
            okButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {

                    String retryTimes = tfRetryTimes.getText();
                    if (StringUtils.isEmpty(retryTimes) || !isNumeric(retryTimes)) {
                        JOptionPane.showMessageDialog(contentPanel, "", "",
                                JOptionPane.ERROR_MESSAGE);
                        return;
                    }

                    String retryGap = tfRetryGap.getText();
                    if (StringUtils.isEmpty(retryGap) || !isNumeric(retryGap)) {
                        JOptionPane.showMessageDialog(contentPanel, "", "",
                                JOptionPane.ERROR_MESSAGE);
                        return;
                    }

                    String exportPath = tfExportPath.getText();
                    if (StringUtils.isEmpty(exportPath)) {
                        JOptionPane.showMessageDialog(contentPanel, "", "",
                                JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    File testFile = new File(exportPath);
                    if (!testFile.exists()) {
                        JOptionPane.showMessageDialog(contentPanel, "", "",
                                JOptionPane.ERROR_MESSAGE);
                        return;
                    }

                    props.put("query.retryTimes", retryTimes);
                    props.put("query.retryGap", retryGap);
                    props.put("result.path", exportPath);

                    try {
                        props.store(new FileOutputStream(propertiesResource.getFile()), "");
                        aqiParser.setRetryTimes(Integer.parseInt(retryTimes));
                        aqiParser.setRetryGap(Integer.parseInt(retryGap));
                        aqiParser.setFilePath(exportPath);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    } finally {
                        dispose();
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("\u53D6\u6D88");
            cancelButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    dispose();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
}

From source file:captureplugin.drivers.DeviceCreatorDialog.java

/**
 * Create the GUI//from w ww  .j av a 2 s .c o m
 */
private void createGUI() {
    UiUtilities.registerForClosing(this);

    DriverIf[] drivers = DriverFactory.getInstance().getDrivers();

    mDriverCombo = new JComboBox(drivers);
    mDriverCombo.setRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {

            if (value instanceof DriverIf) {
                value = ((DriverIf) value).getDriverName();
            }

            return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        }
    });

    JPanel panel = (JPanel) getContentPane();

    panel.setLayout(new GridBagLayout());

    GridBagConstraints label = new GridBagConstraints();

    label.insets = new Insets(5, 5, 5, 5);
    label.anchor = GridBagConstraints.NORTHWEST;

    GridBagConstraints input = new GridBagConstraints();

    input.fill = GridBagConstraints.HORIZONTAL;
    input.weightx = 1.0;
    input.gridwidth = GridBagConstraints.REMAINDER;
    input.insets = new Insets(5, 5, 5, 5);

    panel.add(new JLabel(mLocalizer.msg("Name", "Name")), label);

    mName = new JTextField();
    panel.add(mName, input);

    panel.add(new JLabel(mLocalizer.msg("Driver", "Driver")), label);
    panel.add(mDriverCombo, input);

    mDesc = UiUtilities.createHtmlHelpTextArea("");
    mDesc.setEditable(false);

    panel.add(new JLabel(mLocalizer.msg("Description", "Description")), input);

    GridBagConstraints descC = new GridBagConstraints();
    descC.weightx = 1.0;
    descC.weighty = 1.0;
    descC.fill = GridBagConstraints.BOTH;
    descC.gridwidth = GridBagConstraints.REMAINDER;
    descC.insets = new Insets(5, 5, 5, 5);

    panel.add(new JScrollPane(mDesc, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), descC);

    final Font font = new JLabel().getFont();

    String desc = ((DriverIf) mDriverCombo.getSelectedItem()).getDriverDesc();
    desc = "<html><div style=\"color:#000000;font-family:" + font.getName() + "; font-size:" + font.getSize()
            + ";\">" + desc + "</div></html>";
    mDesc.setText(desc);
    mDesc.setFont(font);

    mDriverCombo.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            String description = ((DriverIf) mDriverCombo.getSelectedItem()).getDriverDesc();
            description = "<html><div style=\"color:#000000;font-family:" + font.getName() + "; font-size:"
                    + font.getSize() + ";\">" + description + "</div></html>";
            mDesc.setText(description);
            mDesc.setFont(font);
        }

    });

    final JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.setEnabled(false);
    final JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
    ok.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            okPressed();
        }
    });

    cancel.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });

    mName.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            updateButtons();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateButtons();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateButtons();
        }

        private void updateButtons() {
            ok.setEnabled(!mName.getText().trim().isEmpty());
        }
    });

    ButtonBarBuilder2 builder = new ButtonBarBuilder2();
    builder.addGlue();
    builder.addButton(new JButton[] { ok, cancel });

    getRootPane().setDefaultButton(ok);

    input.insets = new Insets(5, 5, 5, 5);

    panel.add(builder.getPanel(), input);

    setSize(400, 300);

}

From source file:org.apache.taverna.activities.xpath.ui.contextualview.XPathActivityMainContextualView.java

@Override
public JComponent getMainFrame() {
    jpMainPanel = new JPanel(new GridBagLayout());
    jpMainPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 2, 4, 2),
            BorderFactory.createEmptyBorder()));

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.weighty = 0;/*  ww  w .ja  v  a 2s  . co  m*/

    // --- XPath Expression ---

    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(5, 5, 5, 5);
    JLabel jlXPathExpression = new JLabel("XPath Expression:");
    jlXPathExpression.setFont(jlXPathExpression.getFont().deriveFont(Font.BOLD));
    jpMainPanel.add(jlXPathExpression, c);

    c.gridx++;
    c.weightx = 1.0;
    tfXPathExpression = new JTextField();
    tfXPathExpression.setEditable(false);
    jpMainPanel.add(tfXPathExpression, c);

    // --- Label to Show/Hide Mapping Table ---

    final JLabel jlShowHideNamespaceMappings = new JLabel("Show namespace mappings...");
    jlShowHideNamespaceMappings.setForeground(Color.BLUE);
    jlShowHideNamespaceMappings.setCursor(new Cursor(Cursor.HAND_CURSOR));
    jlShowHideNamespaceMappings.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            spXPathNamespaceMappings.setVisible(!spXPathNamespaceMappings.isVisible());
            jlShowHideNamespaceMappings.setText(
                    (spXPathNamespaceMappings.isVisible() ? "Hide" : "Show") + " namespace mappings...");
            thisContextualView.revalidate();
        }
    });

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 2;
    c.weightx = 1.0;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    jpMainPanel.add(jlShowHideNamespaceMappings, c);

    // --- Namespace Mapping Table ---

    xpathNamespaceMappingsTableModel = new DefaultTableModel() {
        /**
         * No cells should be editable
         */
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return (false);
        }
    };
    xpathNamespaceMappingsTableModel.addColumn("Namespace Prefix");
    xpathNamespaceMappingsTableModel.addColumn("Namespace URI");

    jtXPathNamespaceMappings = new JTable();
    jtXPathNamespaceMappings.setModel(xpathNamespaceMappingsTableModel);
    jtXPathNamespaceMappings.setPreferredScrollableViewportSize(new Dimension(200, 90));
    // TODO - next line is to be enabled when Taverna is migrated to Java
    // 1.6; for now it's fine to run without this
    // jtXPathNamespaceMappings.setFillsViewportHeight(true); // makes sure
    // that when the dedicated area is larger than the table, the latter is
    // stretched vertically to fill the empty space

    jtXPathNamespaceMappings.getColumnModel().getColumn(0).setPreferredWidth(20); // set
    // relative
    // sizes of
    // columns
    jtXPathNamespaceMappings.getColumnModel().getColumn(1).setPreferredWidth(300);

    c.gridy++;
    spXPathNamespaceMappings = new JScrollPane(jtXPathNamespaceMappings);
    spXPathNamespaceMappings.setVisible(false);
    jpMainPanel.add(spXPathNamespaceMappings, c);

    // populate the view with values
    refreshView();

    return jpMainPanel;
}

From source file:algorithm.MetsSubmissionInformationPackage.java

private void createConfigurationPanel() {
    panel = new GUIPanel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;//from   w  ww.j a v  a2  s.  c  o  m
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    panel.add(new JLabel("<html><h2>Add information to mets file</h2></html>"), constraints);
    constraints.gridy++;
    panel.add(new JLabel("Add person: "), constraints);
    constraints.gridx++;
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(truePersonButton);
    panel.add(truePersonButton, constraints);
    constraints.gridx++;
    buttonGroup.add(falsePersonButton);
    falsePersonButton.setSelected(true);
    panel.add(falsePersonButton, constraints);
    constraints.gridy++;
    constraints.gridx = 0;
    panel.add(new JLabel("Name:"), constraints);
    constraints.gridx++;
    constraints.gridwidth = 2;
    panel.add(personField, constraints);
    constraints.gridwidth = 1;
    constraints.gridx = 0;
    constraints.gridy++;
    panel.add(new JLabel("Choose archiving technique:"), constraints);
    constraints.gridx++;
    ButtonGroup archivingGroup = new ButtonGroup();
    archivingGroup.add(tarButton);
    archivingGroup.add(zipButton);
    zipButton.setSelected(true);
    panel.add(zipButton, constraints);
    constraints.gridy++;
    panel.add(tarButton, constraints);
    constraints.gridx = 0;
    constraints.gridy++;
}

From source file:be.tutul.naheulcraft.launcher.auth.LogInForm.java

private void createUserDropdownPanel(Font labelFont) {
    this.userDropdownPanel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = 2;//from w w  w  . ja v  a 2 s .co m
    constraints.gridx = 0;
    constraints.gridy = -1;
    constraints.weightx = 1.0D;

    this.userDropdownPanel.add(Box.createVerticalStrut(8), constraints);

    JLabel userDropdownLabel = new JLabel("Pseudo : ");
    userDropdownLabel.setFont(labelFont);
    this.userDropdownPanel.add(userDropdownLabel, constraints);
    this.userDropdownPanel.add(this.userDropdown, constraints);

    this.userDropdownPanel.setVisible(false);
}

From source file:client.gui.ButtonPanel.java

public ButtonPanel() {

    GlobalVariables.buttonPanel = this;

    exchangeCards = new JButton("Exchange cards");
    exchangeCards.setHorizontalAlignment(SwingConstants.LEFT);
    exchangeCards.addActionListener(this);
    check = new JButton("Check");
    check.setHorizontalAlignment(SwingConstants.LEFT);
    check.addActionListener(this);
    bet = new JButton("Bet");
    bet.setHorizontalAlignment(SwingConstants.LEFT);
    bet.addActionListener(this);
    raise = new JButton("Raise");
    raise.setHorizontalAlignment(SwingConstants.LEFT);
    raise.addActionListener(this);
    call = new JButton("Call");
    call.setHorizontalAlignment(SwingConstants.LEFT);
    call.addActionListener(this);
    fold = new JButton("Fold");
    fold.setHorizontalAlignment(SwingConstants.LEFT);
    fold.addActionListener(this);
    allIn = new JButton("All-In");
    allIn.setHorizontalAlignment(SwingConstants.LEFT);
    allIn.addActionListener(this);
    startGame = new JButton("Start Game");
    startGame.setHorizontalAlignment(SwingConstants.LEFT);
    startGame.addActionListener(this);
    smallBlind = new JButton("Small Blind");
    smallBlind.setHorizontalAlignment(SwingConstants.LEFT);
    smallBlind.addActionListener(this);
    bigBlind = new JButton("Big Blind");
    bigBlind.setHorizontalAlignment(SwingConstants.LEFT);
    bigBlind.addActionListener(this);
    liveBlind = new JButton("Live Blind");
    liveBlind.setHorizontalAlignment(SwingConstants.LEFT);
    liveBlind.addActionListener(this);

    setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.5;/*  w w w .j a va 2 s. c  om*/
    c.gridx = 0;
    c.gridy = 0;
    add(exchangeCards, c);

    c.gridy++;
    add(check, c);
    c.gridy++;
    add(bet, c);
    c.gridy++;
    add(raise, c);
    c.gridy++;
    add(call, c);
    c.gridy++;
    add(fold, c);
    c.gridy++;
    add(allIn, c);
    // c.gridy++;
    // add(startGame, c);
    c.gridy++;
    add(smallBlind, c);
    c.gridy++;
    add(bigBlind, c);
    c.gridy++;
    add(liveBlind, c);

    exchangeCards.setVisible(false);
    check.setVisible(false);
    bet.setVisible(false);
    raise.setVisible(false);
    call.setVisible(false);
    fold.setVisible(false);
    allIn.setVisible(false);
    smallBlind.setVisible(false);
    bigBlind.setVisible(false);
    liveBlind.setVisible(false);

}

From source file:com.polivoto.vistas.Charts.java

public void getHeader(JPanel header) {
    header.removeAll();/*from w  w  w. j av a2 s  .  co m*/
    GridBagConstraints gridBagConstraints;
    header.setLayout(new GridBagLayout());
    header.setBackground(Color.white);
    header.setPreferredSize(new Dimension(0, 100));
    JLabel titulo = new JLabel("<html>     <b>Votacin: </b>" + votacion.getTitulo() + "</html>");
    JLabel lugar = new JLabel("<html>     <b>Lugar: </b>" + votacion.getLugar() + "</html>");
    SimpleDateFormat sdf = new SimpleDateFormat("EEEE d' de 'MMMM' del 'yyyy, hh:mm:ss");
    JLabel fechaInicio = new JLabel(
            "<html><b>Fecha de inicio: </b>" + sdf.format(new Date(votacion.getFechaInicio())) + "</html>");
    JLabel fechaFin = new JLabel(
            "<html><b>Fecha de fin: </b>" + sdf.format(new Date(votacion.getFechaFin())) + "</html>");
    titulo.setFont(fuenteNormal);
    titulo.setVerticalAlignment(JLabel.CENTER);
    lugar.setFont(fuenteNormal);
    lugar.setVerticalAlignment(JLabel.CENTER);
    fechaFin.setFont(fuenteNormal);
    fechaFin.setVerticalAlignment(JLabel.CENTER);
    fechaInicio.setFont(fuenteNormal);
    fechaInicio.setVerticalAlignment(JLabel.CENTER);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(5, 15, 5, 5);
    header.add(titulo, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 15);
    header.add(fechaInicio, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(5, 15, 5, 5);
    header.add(lugar, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 15);
    header.add(fechaFin, gridBagConstraints);

    header.repaint();
    header.revalidate();

}