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:com.wet.wired.jsr.recorder.JRecorder.java

private void showWindow() {
    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            closeRecorder();/*from w w w .  j  a  v  a  2s.c o m*/
            System.exit(0);
        }
    });

    setTitle("TestingOwl Recorder");
    setIconImage(owl.getWelcomeIcon().getImage());
    getContentPane().removeAll();

    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    this.getContentPane().setLayout(gbl);

    control = new JButton("Start Recording");
    control.setActionCommand("start");
    control.addActionListener(this);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1;
    gbc.weighty = 1;
    this.getContentPane().add(control, gbc);

    decorator.getButtonsAndSoundLevel(this.getContentPane(), gbc);

    player = new JButton("to Player");
    player.setActionCommand("player");
    player.addActionListener(this);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 5;
    gbc.gridy = 0;
    gbc.weightx = 1;
    gbc.weighty = 1;
    this.getContentPane().add(player, gbc);

    text = new JLabel("Ready to record");
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.weightx = 1;
    gbc.weighty = 0;
    gbc.gridwidth = 5;
    this.getContentPane().add(text, gbc);

    getContentPane().doLayout();

    this.pack();
    this.setAlwaysOnTop(true);
    this.setVisible(true);

}

From source file:rhinova.gui.main.view.controller.GISViewController.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    createUIComponents();/*  w w  w.  j av a 2s. c  o m*/

    panel2 = new JPanel();
    btnSkipBack = new JButton();
    btnBack = new JButton();
    btnPlay = new JButton();
    btnPause = new JButton();
    btnStop = new JButton();
    btnForward = new JButton();
    btnSkipForward = new JButton();
    panel1 = new JPanel();
    label3 = new JLabel();
    lblTime = new JLabel();
    label11 = new JLabel();
    lblFinalTime = new JLabel();
    label4 = new JLabel();
    lblStage = new JLabel();
    label13 = new JLabel();
    lblInitialPopulation = new JLabel();
    label5 = new JLabel();
    lblPopulation = new JLabel();
    label12 = new JLabel();
    lblFinalPopulation = new JLabel();
    label1 = new JLabel();
    lblSlide = new JLabel();
    label18 = new JLabel();
    lblCapacity = new JLabel();
    label2 = new JLabel();
    lblFinalSlide = new JLabel();

    //======== this ========
    setLayout(null);

    //======== panel2 ========
    {
        panel2.setLayout(null);

        //---- btnSkipBack ----
        btnSkipBack.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/skip_backward.png")));
        btnSkipBack.setBackground(Color.white);
        btnSkipBack.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSkipBackActionPerformed(e);
            }
        });
        panel2.add(btnSkipBack);
        btnSkipBack.setBounds(5, 5, 58, btnSkipBack.getPreferredSize().height);

        //---- btnBack ----
        btnBack.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/back.png")));
        btnBack.setBackground(Color.white);
        btnBack.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnBackActionPerformed(e);
            }
        });
        panel2.add(btnBack);
        btnBack.setBounds(65, 5, 58, btnBack.getPreferredSize().height);

        //---- btnPlay ----
        btnPlay.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/play.png")));
        btnPlay.setBackground(Color.white);
        btnPlay.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnPlayActionPerformed(e);
            }
        });
        panel2.add(btnPlay);
        btnPlay.setBounds(125, 5, 58, btnPlay.getPreferredSize().height);

        //---- btnPause ----
        btnPause.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/pause.png")));
        btnPause.setBackground(Color.white);
        btnPause.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnPauseActionPerformed(e);
            }
        });
        panel2.add(btnPause);
        btnPause.setBounds(185, 5, 58, btnPause.getPreferredSize().height);

        //---- btnStop ----
        btnStop.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/stop.png")));
        btnStop.setBackground(Color.white);
        btnStop.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnStopActionPerformed(e);
            }
        });
        panel2.add(btnStop);
        btnStop.setBounds(245, 5, 58, btnStop.getPreferredSize().height);

        //---- btnForward ----
        btnForward.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/forward.png")));
        btnForward.setBackground(Color.white);
        btnForward.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnForwardActionPerformed(e);
            }
        });
        panel2.add(btnForward);
        btnForward.setBounds(305, 5, 58, btnForward.getPreferredSize().height);

        //---- btnSkipForward ----
        btnSkipForward.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/skip_forward.png")));
        btnSkipForward.setBackground(Color.white);
        btnSkipForward.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSkipForwardActionPerformed(e);
            }
        });
        panel2.add(btnSkipForward);
        btnSkipForward.setBounds(365, 5, 58, btnSkipForward.getPreferredSize().height);
    }
    add(panel2);
    panel2.setBounds(5, 0, 470, 75);

    //======== panel1 ========
    {
        panel1.setLayout(new GridBagLayout());
        ((GridBagLayout) panel1.getLayout()).columnWidths = new int[] { 82, 113, 92, 130, 0 };
        ((GridBagLayout) panel1.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
        ((GridBagLayout) panel1.getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0E-4 };
        ((GridBagLayout) panel1.getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 };

        //---- label3 ----
        label3.setText("Year:");
        panel1.add(label3, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblTime ----
        lblTime.setText("0000000000");
        panel1.add(lblTime, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label11 ----
        label11.setText("Final Time:");
        panel1.add(label11, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblFinalTime ----
        lblFinalTime.setText("0000000000");
        panel1.add(lblFinalTime, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label4 ----
        label4.setText("Stage:");
        panel1.add(label4, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblStage ----
        lblStage.setText("0000000000");
        panel1.add(lblStage, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label13 ----
        label13.setText("Initial Population:");
        panel1.add(label13, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblInitialPopulation ----
        lblInitialPopulation.setText("0000000000");
        panel1.add(lblInitialPopulation, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label5 ----
        label5.setText("Population:");
        panel1.add(label5, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblPopulation ----
        lblPopulation.setText("0000000000");
        panel1.add(lblPopulation, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label12 ----
        label12.setText("Final Population:");
        panel1.add(label12, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblFinalPopulation ----
        lblFinalPopulation.setText("0000000000");
        panel1.add(lblFinalPopulation, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label1 ----
        label1.setText("Slide");
        panel1.add(label1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblSlide ----
        lblSlide.setText("0.0");
        panel1.add(lblSlide, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label18 ----
        label18.setText("Capacity:");
        panel1.add(label18, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblCapacity ----
        lblCapacity.setText("0000000000");
        panel1.add(lblCapacity, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label2 ----
        label2.setText("No Pictures");
        panel1.add(label2, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));

        //---- lblFinalSlide ----
        lblFinalSlide.setText("0.0");
        panel1.add(lblFinalSlide, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 5), 0, 0));
    }
    add(panel1);
    panel1.setBounds(10, 75, 420, 105);

    { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < getComponentCount(); i++) {
            Rectangle bounds = getComponent(i).getBounds();
            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        setMinimumSize(preferredSize);
        setPreferredSize(preferredSize);
    }

    //---- bindings ----
    bindingGroup = new BindingGroup();
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("year"), lblTime, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("stage"), lblStage, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("population"), lblPopulation, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("finalPopulation"), lblFinalTime, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("initialPopulation"), lblInitialPopulation, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("finalPopulation"), lblFinalPopulation, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("capacity"), lblCapacity, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("noPictures"), lblFinalSlide, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("currentPictureIndex"), lblSlide, BeanProperty.create("text")));
    bindingGroup.bind();
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:org.jets3t.apps.cockpit.gui.StartupDialog.java

/**
 * Initialises all GUI elements.//from www . ja  v  a  2  s .c o m
 */
private void initGui() {
    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);

    cancelButton = new JButton("Don't log in");
    cancelButton.setActionCommand("Cancel");
    cancelButton.addActionListener(this);
    storeCredentialsButton = new JButton("Store Credentials");
    storeCredentialsButton.setActionCommand("StoreCredentials");
    storeCredentialsButton.addActionListener(this);
    okButton = new JButton("Log in");
    okButton.setActionCommand("LogIn");
    okButton.addActionListener(this);

    // Set default ENTER and ESCAPE buttons.
    this.getRootPane().setDefaultButton(okButton);
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),
            "ESCAPE");
    this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
        private static final long serialVersionUID = -1742280851624947873L;

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

    JPanel buttonsPanel = new JPanel(new GridBagLayout());
    buttonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    buttonsPanel.add(storeCredentialsButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    buttonsPanel.add(okButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsZero, 0, 0));

    loginPassphrasePanel = new LoginPassphrasePanel(hyperlinkListener);
    loginLocalFolderPanel = new LoginLocalFolderPanel(ownerFrame, hyperlinkListener);
    loginCredentialsPanel = new LoginCredentialsPanel(false, hyperlinkListener);

    // Target storage service selection
    targetS3 = new JRadioButton("Amazon S3");
    targetS3.setSelected(true);
    targetGS = new JRadioButton("Google Storage");

    ButtonGroup targetButtonGroup = new ButtonGroup();
    targetButtonGroup.add(targetS3);
    targetButtonGroup.add(targetGS);

    JPanel targetServicePanel = new JPanel(new GridBagLayout());
    targetServicePanel.add(targetS3, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    targetServicePanel.add(targetGS, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsZero, 0, 0));

    // Tabbed Pane.
    tabbedPane = new JTabbedPane();
    tabbedPane.addChangeListener(this);
    tabbedPane.add(loginPassphrasePanel, "Online");
    tabbedPane.add(loginLocalFolderPanel, "Local Folder");
    tabbedPane.add(loginCredentialsPanel, "Direct Login");

    int row = 0;
    this.getContentPane().setLayout(new GridBagLayout());
    this.getContentPane().add(targetServicePanel, new GridBagConstraints(0, row++, 2, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    this.getContentPane().add(tabbedPane, new GridBagConstraints(0, row++, 2, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
    this.getContentPane().add(buttonsPanel, new GridBagConstraints(0, row++, 2, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    this.pack();
    this.setSize(500, 430);
    this.setLocationRelativeTo(this.getOwner());
}

From source file:com.versul.testes.JRViewerPanel.java

private void initComponents() {
    scrollPane = new javax.swing.JScrollPane();
    scrollPane.getHorizontalScrollBar().setUnitIncrement(5);
    scrollPane.getVerticalScrollBar().setUnitIncrement(5);

    pnlInScroll = new javax.swing.JPanel();
    pnlPage = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    pnlLinks = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jPanel7 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel9 = new javax.swing.JPanel();
    lblPage = new PageRenderer();

    setMinimumSize(new java.awt.Dimension(450, 150));
    setPreferredSize(new java.awt.Dimension(450, 150));

    setLayout(new java.awt.BorderLayout());
    addComponentListener(new java.awt.event.ComponentAdapter() {
        public void componentResized(java.awt.event.ComponentEvent evt) {
            pnlMainComponentResized(evt);
        }/*w w  w  .  ja  va2 s.c  o  m*/
    });

    scrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    pnlInScroll.setLayout(new java.awt.GridBagLayout());

    pnlPage.setLayout(new java.awt.BorderLayout());
    pnlPage.setMinimumSize(new java.awt.Dimension(100, 100));
    pnlPage.setPreferredSize(new java.awt.Dimension(100, 100));

    jPanel4.setLayout(new java.awt.GridBagLayout());
    jPanel4.setMinimumSize(new java.awt.Dimension(100, 120));
    jPanel4.setPreferredSize(new java.awt.Dimension(100, 120));

    pnlLinks.setLayout(null);
    pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5));
    pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5));
    pnlLinks.setOpaque(false);
    pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mousePressed(java.awt.event.MouseEvent evt) {
            pnlLinksMousePressed(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            pnlLinksMouseReleased(evt);
        }
    });
    pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
        public void mouseDragged(java.awt.event.MouseEvent evt) {
            pnlLinksMouseDragged(evt);
        }
    });

    GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    jPanel4.add(pnlLinks, gridBagConstraints);

    jPanel5.setBackground(java.awt.Color.gray);
    jPanel5.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel5.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
    jPanel4.add(jPanel5, gridBagConstraints);

    jPanel6.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel6.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    jPanel4.add(jPanel6, gridBagConstraints);

    jPanel7.setBackground(java.awt.Color.gray);
    jPanel7.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel7.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    jPanel4.add(jPanel7, gridBagConstraints);

    jPanel8.setBackground(java.awt.Color.gray);
    jPanel8.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel8.setPreferredSize(new java.awt.Dimension(5, 5));
    jLabel1.setText("jLabel1");
    jPanel8.add(jLabel1);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    jPanel4.add(jPanel8, gridBagConstraints);

    jPanel9.setMinimumSize(new java.awt.Dimension(5, 5));
    jPanel9.setPreferredSize(new java.awt.Dimension(5, 5));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    jPanel4.add(jPanel9, gridBagConstraints);

    lblPage.setBackground(java.awt.Color.white);
    lblPage.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
    lblPage.setOpaque(true);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel4.add(lblPage, gridBagConstraints);

    pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    pnlInScroll.add(pnlPage, gridBagConstraints);

    scrollPane.setViewportView(pnlInScroll);
    add(scrollPane, java.awt.BorderLayout.CENTER);

}

From source file:de.tor.tribes.ui.components.TimePicker.java

public void addMinuteLabels(boolean pEachMinute) {
    jPanelMinute.removeAll();/*  www .ja v a 2s  . c  o  m*/
    minutesExpanded = pEachMinute;
    int every, elemsPerRow;
    if (pEachMinute) {
        //12 elems per row, 5 rows
        every = 1;
        elemsPerRow = 12;
    } else {
        //6 elems per row, 2 rows
        every = 5;
        elemsPerRow = 6;
    }
    int rowHeight = 20;
    jPanelMinute.setPreferredSize(
            new Dimension(240, rowHeight * minuteLabels.length / (elemsPerRow * every) + rowHeight));
    jPanelMinute.setMinimumSize(jPanelMinute.getPreferredSize());
    jPanelMinute.setMaximumSize(jPanelMinute.getPreferredSize());

    for (int i = 0; i < minuteLabels.length / every; i++) {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = i % elemsPerRow;
        gbc.gridy = i / elemsPerRow;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weightx = 1;
        gbc.weighty = 1;

        minuteLabels[i * every].uncross();
        jPanelMinute.add(minuteLabels[i * every], gbc);
    }
    selectedMinute = minuteLabels[pMinute];
    selectedMinute.cross();
    BasicArrowButton expandButton = null;

    if (pEachMinute) {
        expandButton = new BasicArrowButton(BasicArrowButton.WEST);
    } else {
        expandButton = new BasicArrowButton(BasicArrowButton.EAST);
    }
    expandButton.setFont(smallFont);
    expandButton.setMargin(new java.awt.Insets(2, 2, 2, 2));
    expandButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addMinuteLabels(!minutesExpanded);
        }
    });
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = elemsPerRow - 1;
    gbc.gridy = minuteLabels.length / (every * elemsPerRow);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.weighty = 1;
    jPanelMinute.add(expandButton, gbc);

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            jPanelMinute.updateUI();
        }
    });
    updateSize();
}

From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java

protected JPanel createDeviceTypePanel() {
    JPanel panel = new JPanel();
    panel.setOpaque(false);/*from   w  w w . j  a va  2 s.c o m*/
    panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
    GridBagLayout gridBag = new GridBagLayout();
    panel.setLayout(gridBag);
    GridBagConstraints gc = new GridBagConstraints();

    gc.insets = new Insets(8, 2, 2, 2);
    gc.weighty = 0;
    gc.weightx = 1;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    gc.gridheight = 1;
    deviceTypeChartPanel = new ChartPanel(null);
    deviceTypeChartPanel.setPreferredSize(new Dimension(80, 60));
    panel.add(deviceTypeChartPanel, gc);

    typeNumberLabels = new JLabel[nodeTypes.length];
    typeNameLabels = new JLabel[nodeTypes.length];
    gc.fill = GridBagConstraints.BOTH;
    gc.insets = new Insets(2, 2, 2, 2);
    for (int i = 0; i < nodeTypes.length; i++) {
        gc.weightx = 1;
        gc.gridwidth = 1;
        typeNumberLabels[i] = createNumberLabel();
        panel.add(typeNumberLabels[i], gc);

        gc.weightx = 0;
        gc.gridwidth = GridBagConstraints.REMAINDER;
        typeNameLabels[i] = createNameLabel(nodeTypes[i].getName());
        panel.add(typeNameLabels[i], gc);
    }

    return panel;
}

From source file:de.tbuchloh.kiskis.gui.SecuredElementView.java

private Component createMainTab() {
    final JPanel textFields = new JPanel(new SpringLayout());
    textFields.setBorder(LnFHelper.createDefaultBorder());

    final JLabel nameLabel = LnFHelper.createLabel(M.getString("name_label")); //$NON-NLS-1$
    nameLabel.setVerticalAlignment(SwingConstants.TOP);
    nameLabel.setLabelFor(_name);//w w w  . j a  v a  2s.com
    textFields.add(nameLabel);
    textFields.add(_name);

    final JLabel pwdLabel = LnFHelper.createLabel(M.getString("password_label")); //$NON-NLS-1$
    pwdLabel.setVerticalAlignment(SwingConstants.TOP);
    pwdLabel.setLabelFor(_pwdField);
    textFields.add(pwdLabel);
    textFields.add(_pwdField);

    final JPanel datePanel = new JPanel();
    final GridBagBuilder builder = new GridBagBuilder(datePanel);
    builder.setAlignment(GridBagConstraints.NORTHWEST);
    builder.add(_dateField);
    builder.add(_neverBox);

    builder.setFill(GridBagConstraints.NONE);
    builder.setAlignment(GridBagConstraints.EAST);
    builder.addLast(_historyLink);
    builder.setFill(GridBagConstraints.BOTH);
    builder.setAlignment(GridBagConstraints.NORTHWEST);

    final JLabel expiresLabel = LnFHelper.createLabel(M.getString("expires_label")); //$NON-NLS-1$
    expiresLabel.setVerticalAlignment(SwingConstants.TOP);
    expiresLabel.setLabelFor(datePanel);
    textFields.add(expiresLabel);
    textFields.add(datePanel);

    SpringUtilities.makeCompactGrid(textFields, 3, 2, 5, 5, 5, 5);

    return textFields;
}

From source file:com.sec.ose.osi.ui.frm.main.report.JPanBillOfMaterials.java

/**
 * This method initializes jPanelTable   
 *    /*  w  ww  .  j a  v  a2s  .c o m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelTable() {
    if (jPanelTable == null) {
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.BOTH;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 1.0;
        gridBagConstraints1.weighty = 1.0;
        gridBagConstraints1.insets = new Insets(10, 10, 0, 10);
        gridBagConstraints1.gridx = 0;
        jPanelTable = new JPanel();
        jPanelTable.setLayout(new GridBagLayout());
        jPanelTable.add(getJScrollPaneBOM(), gridBagConstraints1);
    }
    return jPanelTable;
}

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

protected void createValid() {
    GridBagConstraints c = new GridBagConstraints();
    JComponent label = new JLabel(getDetailsString());
    Font f = label.getFont();// ww  w  .  j  a  v a2  s  .c om
    label.setFont(new Font(f.getName(), Font.BOLD, f.getSize()));
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHWEST;
    DETAILS.add(label, c);

    JTextArea text = newTextArea(LICENSE.getLicenseDescription(URN));
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.gridheight = 2;
    c.weighty = 1;
    c.weightx = .7;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.BOTH;
    DETAILS.add(text, c);

    if (LICENSE.getLicenseDeed(URN) != null) {
        label = new URLLabel(LICENSE.getLicenseDeed(URN), getDeedString());
    } else {
        label = new JLabel();
        label.setVisible(false);
    }
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.weighty = 0;
    c.weightx = .3;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(0, 0, 3, 0);
    DETAILS.add(label, c);

    label = new URLLabel(LICENSE.getLicenseURI(), getVerificationString());
    DETAILS.add(label, c);
}

From source file:org.gridchem.client.gui.charts.UsageChart.java

private void init() {

    removeAll();// w  w  w  . java 2s .com
    String title = "";

    if (CURRENT_CHARTTYPE.equals(ChartType.JOB)) {
        //            dataset = createJobDataset(projectTable);
        dataset = new DefaultPieDataset();
    } else if (CURRENT_CHARTTYPE.equals(ChartType.PROJECT)) {
        dataset = createProjectDataset(projectCollabTable);
        title = "CCG Utilization by Project";
    } else if (CURRENT_CHARTTYPE.equals(ChartType.RESOURCE)) {
        dataset = createResourceDataset(projectCollabTable);
        title = "CCG Utilization by Resource";
    } else if (CURRENT_CHARTTYPE.equals(ChartType.USER)) {
        dataset = createUserDataset(projectCollabTable);
        title = "CCG Utilization by User";
    }

    chart = ChartFactory.createPieChart(title, // chart title
            dataset, // data
            false, // include legend
            true, // tooltips?
            false // URLs?
    );

    if (projectCollabTable.size() == 1) {
        ProjectBean project = projectCollabTable.keySet().iterator().next();
        chart.addSubtitle(
                new TextTitle("Project " + project.getName() + " expires on " + project.getEndDate()));
    }

    ((PiePlot) chart.getPlot()).setCircular(true);

    //        ((PiePlot)chart.getPlot()).setExplodePercent(new Integer(defaultProjectIndex), 25);

    if (CURRENT_CHARTTYPE.equals(ChartType.JOB)) {
        chart.getPlot().setNoDataMessage("Comprehensive job information is not currently available.");
    }

    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(size);

    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    add(chartPanel, c);

    GridBagConstraints c1 = new GridBagConstraints();
    c1.weightx = 0;
    c1.weighty = 0;
    c1.gridx = 0;
    c1.gridy = 1;
    c1.fill = GridBagConstraints.BOTH;
    add(navPanel, c1);
    revalidate();

    //        setPreferredSize(size);

}