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:de.codesourcery.jasm16.ide.ui.utils.UIUtils.java

/**
 * /*  ww  w. j a  v a  2  s. c  om*/
 * @param parent
 * @param title
 * @param message
 * @return <code>true</code> if project should also be physically deleted,
 * <code>false</code> is project should be deleted but all files should be left alone,
 * <code>null</code> if user cancelled the dialog/project should not be deleted
 */
public static Boolean showDeleteProjectDialog(IAssemblyProject project) {
    final JDialog dialog = new JDialog((Window) null, "Delete project " + project.getName());

    dialog.setModal(true);

    final JTextArea message = createMultiLineLabel(
            "Do you really want to delete project '" + project.getName() + " ?");
    final JCheckBox checkbox = new JCheckBox("Delete project files");

    final DialogResult[] outcome = { DialogResult.CANCEL };

    final JButton yesButton = new JButton("Yes");
    yesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.YES;
            dialog.dispose();
        }
    });

    final JButton noButton = new JButton("No");
    noButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.NO;
            dialog.dispose();
        }
    });
    final JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.CANCEL;
            dialog.dispose();
        }
    });

    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout());
    buttonPanel.add(yesButton);
    buttonPanel.add(noButton);
    buttonPanel.add(cancelButton);

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

    GridBagConstraints cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 0;
    cnstrs.gridheight = 1;
    messagePanel.add(message, cnstrs);

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    messagePanel.add(checkbox, cnstrs);

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

    cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    cnstrs.insets = new Insets(5, 2, 5, 2); // top,left,bottom,right         
    panel.add(messagePanel, cnstrs);

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    cnstrs.insets = new Insets(0, 2, 10, 2); // top,left,bottom,right      
    panel.add(buttonPanel, cnstrs);

    dialog.getContentPane().add(panel);
    dialog.pack();
    dialog.setVisible(true);

    if (outcome[0] != DialogResult.YES) {
        return null;
    }
    return checkbox.isSelected();
}

From source file:com.digitalgeneralists.assurance.ui.components.ResultsPanel.java

private void initializeComponent() {
    if (!this.initialized) {
        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

        ((DefaultTableCellRenderer) resultsTable.getTableHeader().getDefaultRenderer())
                .setHorizontalAlignment(JLabel.CENTER);
        this.resultsTable.setRowHeight(150);

        ListSelectionModel selectionModel = this.resultsTable.getSelectionModel();

        selectionModel.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                applicationDelegate.fireEvent(new SetScanResultsMenuStateEvent(false));
                resultsTable.editCellAt(resultsTable.getSelectedRow(), 0);
            }// ww w .  j  a  v a2  s.c  o m
        });

        GridBagConstraints resultsLabelConstraints = new GridBagConstraints();
        resultsLabelConstraints.anchor = GridBagConstraints.WEST;
        resultsLabelConstraints.fill = GridBagConstraints.BOTH;
        resultsLabelConstraints.gridx = 0;
        resultsLabelConstraints.gridy = 0;
        resultsLabelConstraints.weightx = 1.0;
        resultsLabelConstraints.weighty = 0.1;
        resultsLabelConstraints.gridheight = 1;
        resultsLabelConstraints.gridwidth = 1;
        resultsLabelConstraints.insets = new Insets(5, 5, 5, 5);

        this.progressIndicatorConstraints.anchor = GridBagConstraints.WEST;
        this.progressIndicatorConstraints.fill = GridBagConstraints.BOTH;
        this.progressIndicatorConstraints.gridx = 0;
        this.progressIndicatorConstraints.gridy = 1;
        this.progressIndicatorConstraints.weightx = 1.0;
        this.progressIndicatorConstraints.weighty = 0.1;
        this.progressIndicatorConstraints.gridheight = 1;
        this.progressIndicatorConstraints.gridwidth = 1;
        this.progressIndicatorConstraints.insets = new Insets(5, 5, 5, 5);

        this.progressIndicator.setIndeterminate(true);

        this.resultsListConstraints.anchor = GridBagConstraints.WEST;
        this.resultsListConstraints.fill = GridBagConstraints.BOTH;
        this.resultsListConstraints.gridx = 0;
        this.resultsListConstraints.gridy = 2;
        this.resultsListConstraints.weightx = 1.0;
        this.resultsListConstraints.weighty = 0.9;
        this.resultsListConstraints.gridheight = 1;
        this.resultsListConstraints.gridwidth = 1;
        this.resultsListConstraints.insets = new Insets(5, 5, 5, 5);

        this.add(this.resultsLabel, resultsLabelConstraints);
        this.add(this.resultsScrollPane, this.resultsListConstraints);

        this.addAncestorListener(new AncestorListener() {
            public void ancestorAdded(AncestorEvent event) {
                resultsTable.setDefaultRenderer(ComparisonResult.class, comparisonResultListRenderer);
                resultsTable.setDefaultEditor(ComparisonResult.class, comparisonResultListRenderer);

                applicationDelegate.addEventObserver(ScanStartedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ComparisonResultAddedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ScanResultsLoadedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(SelectedScanChangedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ScanCompletedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ScanProgressEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ResultMergeCompletedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ScanMergeStartedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ScanMergeProgressEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(ScanMergeCompletedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.addEventObserver(DeletedItemRestoreCompletedEvent.class,
                        (IEventObserver) event.getSource());
            }

            public void ancestorRemoved(AncestorEvent event) {
                applicationDelegate.removeEventObserver(ScanStartedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ComparisonResultAddedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ScanResultsLoadedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(SelectedScanChangedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ScanCompletedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ScanProgressEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ResultMergeCompletedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ScanMergeStartedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ScanMergeProgressEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(ScanMergeCompletedEvent.class,
                        (IEventObserver) event.getSource());
                applicationDelegate.removeEventObserver(DeletedItemRestoreCompletedEvent.class,
                        (IEventObserver) event.getSource());
            }

            public void ancestorMoved(AncestorEvent event) {
            }
        });

        this.initialized = true;
    }
}

From source file:de.codesourcery.eve.skills.ui.components.impl.PasswordComponent.java

@Override
protected JPanel createPanelHook() {

    final JPanel panel = new JPanel();

    panel.setLayout(new GridBagLayout());

    int y = 0;/* w w w. j av  a 2s  .c  o m*/
    if (!StringUtils.isBlank(message)) {
        panel.add(new JLabel(message), constraints(0, y++).width(2).end());
    }

    password1.setColumns(10);
    password2.setColumns(10);

    switch (mode) {
    case SET_PASSWORD:

        panel.add(new JLabel("Enter new password:"), constraints(0, y).end());
        panel.add(password1, constraints(1, y++).end());

        panel.add(new JLabel("Confirm password:"), constraints(0, y).end());
        panel.add(password2, constraints(1, y++).end());

        break;
    case QUERY_PASSWORD:
        panel.add(new JLabel("Enter password:"), constraints(0, y).end());
        panel.add(password1, constraints(1, y++).end());
        break;
    default:
        throw new RuntimeException("Unreachable code reached");
    }

    panel.add(this.savePassword, constraints(0, y).anchorEast().useRemainingWidth().end());
    return panel;
}

From source file:com.frostwire.gui.bittorrent.PartialFilesDialog.java

protected void setupUI() {
    setResizable(true);/*from w  ww .  jav  a2s  .  c o  m*/
    setMinimumSize(new Dimension(400, 300));
    panel = new JPanel(new GridBagLayout());

    // title
    setupTitle();

    // filter
    setupTextFilter();

    setupToggleAllSelectionCheckbox();

    // table
    setupTable();

    // ok button
    setupOkButton();

    // cancel button
    setupCancelButton();

    getContentPane().add(panel);

    pack();
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.APPLICATION_MODAL);
    getRootPane().setDefaultButton(_buttonOK);
    GUIUtils.addHideAction((JComponent) getContentPane());
}

From source file:de.codesourcery.jasm16.ide.ui.views.HexDumpView.java

protected JPanel createPanel() {
    textArea.setEditable(false);/*from   w  w w .  j ava2 s.co  m*/
    setColors(textArea);
    textArea.setFont(getMonospacedFont());
    textArea.setEditable(false);

    // dump panel
    final JPanel dumpPanel = new JPanel();
    setColors(dumpPanel);
    dumpPanel.setLayout(new GridBagLayout());
    GridBagConstraints cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH);
    dumpPanel.add(textArea, cnstrs);

    // toolbar panel
    final JPanel toolbarPanel = new JPanel();
    setColors(toolbarPanel);
    toolbarPanel.setLayout(new GridBagLayout());

    cnstrs = constraints(0, 0, false, false, GridBagConstraints.NONE);
    toolbarPanel.add(new JLabel("Goto"), cnstrs);

    final JTextField gotoTextfield = new JTextField();
    gotoTextfield.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final String val = gotoTextfield.getText();
            Address adr;
            if (StringUtils.isBlank(val)) {
                gotoTextfield.setText("0000");
                adr = Address.wordAddress(0);
            } else {
                try {
                    adr = Address.wordAddress(Misc.parseHexString(val));
                } catch (NumberFormatException e1) {
                    gotoTextfield.setText("0000");
                    adr = Address.wordAddress(0);
                }
            }
            dumpStartAddress = adr;
            refreshDisplay();
        }
    });

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.HORIZONTAL);
    toolbarPanel.add(gotoTextfield, cnstrs);

    // create result panel
    final JPanel result = new JPanel();
    setColors(result);
    result.setLayout(new GridBagLayout());
    cnstrs = constraints(0, 0, false, true, GridBagConstraints.BOTH);
    result.add(dumpPanel, cnstrs);
    cnstrs = constraints(1, 0, true, true, GridBagConstraints.VERTICAL);
    result.add(toolbarPanel, cnstrs);

    textArea.addKeyListener(new PagingKeyAdapter() {

        @Override
        protected void onePageUp() {
            HexDumpView.this.onePageUp();
        }

        @Override
        protected void onePageDown() {
            HexDumpView.this.onePageDown();
        }

        @Override
        protected void oneLineUp() {
            HexDumpView.this.oneLineUp();
        }

        @Override
        protected void oneLineDown() {
            HexDumpView.this.oneLineDown();
        }
    });

    result.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            refreshDisplay();
        }
    });

    return result;
}

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

private void initComponents() {
    Dimension dimension = new Dimension(220, 22);
    setPreferredSize(dimension);//from w  w  w  . j  av  a  2 s . com
    setMinimumSize(dimension);

    speakerIcon = GUIMediator.getThemeImage("speaker");

    text = new JLabel();
    Font f = new Font("DIALOG", Font.BOLD, 10);
    text.setFont(f);
    text.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (MediaPlayer.instance().getCurrentSong().getFile() != null
                    || MediaPlayer.instance().getCurrentSong().getPlaylistItem() != null
                    || MediaPlayer.instance().getCurrentSong() instanceof InternetRadioAudioSource
                    || MediaPlayer.instance().getCurrentSong() instanceof DeviceAudioSource) {
                showCurrentSong();
            } else if (MediaPlayer.instance().getCurrentSong() instanceof StreamAudioSource) {
                StreamAudioSource audioSource = (StreamAudioSource) MediaPlayer.instance().getCurrentSong();
                if (audioSource.getDetailsUrl() != null) {
                    GUIMediator.openURL(audioSource.getDetailsUrl());
                }
            } else if (MediaPlayer.instance().getCurrentSong().getURL() != null) {
                GUIMediator.instance().setWindow(GUIMediator.Tabs.LIBRARY);
            }
        }
    });

    shareButton = new MediaButton(I18n.tr("Send this file to a friend"), "share", "share");
    shareButton.addActionListener(new SendToFriendActionListener());
    shareButton.setVisible(false);

    //Share Button
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.insets = new Insets(0, 0, 0, 3);
    add(shareButton, c);//, BorderLayout.LINE_END);

    //Go to Current Audio Control
    c.gridx = 0;
    c.gridx = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.EAST;
    c.insets = new Insets(0, 0, 0, 0);
    add(text, c);//, BorderLayout.LINE_END);
}

From source file:com.sec.ose.osi.ui.frm.main.identification.autoidentify.JPanImportSPDX.java

private JPanel getJPanelImportSPDX() {
    if (jPanelImportSPDX == null) {
        jPanelImportSPDX = new JPanel();
        jPanelImportSPDX.setLayout(new GridBagLayout());

    }//  www.  jav a2 s.co  m
    return jPanelImportSPDX;
}

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

private JPanel getJPanelValue() {
    if (jPanelValue == null) {

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;/* w  w w.ja  va  2s.  c  o  m*/
        gridBagConstraints3.weighty = 1.0;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.gridy = 4;
        jLabelEmpty = new JLabel();
        jLabelEmpty.setText("");
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.gridy = 3;
        jPanelValue = new JPanel();
        jPanelValue.setLayout(new GridBagLayout());
        jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelValue.setPreferredSize(new Dimension(400, 200));
        jPanelValue.add(jLabelEmpty, gridBagConstraints3);

        JLabel jLabelProxyHost = new JLabel("Proxy Host : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyHost = new GridBagConstraints();
        gridBagConstraintsjLabelProxyHost.gridx = 0;
        gridBagConstraintsjLabelProxyHost.insets = new Insets(10, 20, 5, 0);
        gridBagConstraintsjLabelProxyHost.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyHost.weightx = 0.0;
        gridBagConstraintsjLabelProxyHost.weighty = 0.0;
        gridBagConstraintsjLabelProxyHost.gridy = 1;
        jPanelValue.add(jLabelProxyHost, gridBagConstraintsjLabelProxyHost);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyHost = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyHost.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyHost.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyHost.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyHost.insets = new Insets(10, 5, 5, 100);
        gridBagConstraintsgetJTextFieldProxyHost.gridwidth = 2;
        gridBagConstraintsgetJTextFieldProxyHost.gridy = 1;
        jPanelValue.add(getJTextFieldProxyHost(), gridBagConstraintsgetJTextFieldProxyHost);

        JLabel jLabelProxyPort = new JLabel("Proxy Port : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyPort = new GridBagConstraints();
        gridBagConstraintsjLabelProxyPort.gridx = 0;
        gridBagConstraintsjLabelProxyPort.insets = new Insets(0, 20, 0, 0);
        gridBagConstraintsjLabelProxyPort.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyPort.weighty = 0.0;
        gridBagConstraintsjLabelProxyPort.gridy = 2;
        jPanelValue.add(jLabelProxyPort, gridBagConstraintsjLabelProxyPort);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyPort = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyPort.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyPort.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyPort.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyPort.insets = new Insets(5, 5, 5, 220);
        gridBagConstraintsgetJTextFieldProxyPort.weighty = 0.0;
        gridBagConstraintsgetJTextFieldProxyPort.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsgetJTextFieldProxyPort.gridy = 2;
        jPanelValue.add(getJTextFieldProxyPort(), gridBagConstraintsgetJTextFieldProxyPort);

        JLabel jLabelProxyBypass = new JLabel("Proxy Bypass : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyBypass = new GridBagConstraints();
        gridBagConstraintsjLabelProxyBypass.gridx = 0;
        gridBagConstraintsjLabelProxyBypass.insets = new Insets(0, 20, 0, 0);
        gridBagConstraintsjLabelProxyBypass.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyBypass.weighty = 0.0;
        gridBagConstraintsjLabelProxyBypass.gridy = 3;
        jPanelValue.add(jLabelProxyBypass, gridBagConstraintsjLabelProxyBypass);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyBypass = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyBypass.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyBypass.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyBypass.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyBypass.insets = new Insets(5, 5, 5, 100);
        gridBagConstraintsgetJTextFieldProxyBypass.weighty = 0.0;
        gridBagConstraintsgetJTextFieldProxyBypass.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsgetJTextFieldProxyBypass.gridy = 3;
        jPanelValue.add(getJTextFieldProxyBypass(), gridBagConstraintsgetJTextFieldProxyBypass);

        //jPanelValue.add(getJPanel(), gridBagConstraints2);

    }
    return jPanelValue;
}

From source file:PlayerOfMedia.java

/***************************************************************************
 * Construct a PlayerOfMedia. The Frame will have the title supplied by the
 * user. All initial actions on the PlayerOfMedia object are initiated
 * through its menu (or shotcut key).//www.j  a  v  a  2s  . c  o m
 **************************************************************************/
PlayerOfMedia(String name) {

    super(name);
    ///////////////////////////////////////////////////////////
    // Setup the menu system: a "File" menu with Open and Quit.
    ///////////////////////////////////////////////////////////
    bar = new MenuBar();
    fileMenu = new Menu("File");
    MenuItem openMI = new MenuItem("Open...", new MenuShortcut(KeyEvent.VK_O));
    openMI.setActionCommand("OPEN");
    openMI.addActionListener(this);
    fileMenu.add(openMI);
    MenuItem quitMI = new MenuItem("Quit", new MenuShortcut(KeyEvent.VK_Q));
    quitMI.addActionListener(this);
    quitMI.setActionCommand("QUIT");
    fileMenu.add(quitMI);
    bar.add(fileMenu);
    setMenuBar(bar);

    ///////////////////////////////////////////////////////
    // Layout the frame, its position on screen, and ensure
    // window closes are dealt with properly, including
    // relinquishing the resources of any Player.
    ///////////////////////////////////////////////////////
    setLayout(new BorderLayout());
    setLocation(100, 100);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            if (player != null) {
                player.stop();
                player.close();
            }
            System.exit(0);
        }
    });

    /////////////////////////////////////////////////////
    // Build the Dialog box by which the user can select
    // the media to play.
    /////////////////////////////////////////////////////
    selectionDialog = new Dialog(this, "Media Selection");
    Panel pan = new Panel();
    pan.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    mediaName = new TextField(40);
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 2;
    pan.add(mediaName, gbc);
    choose = new Button("Choose File...");
    gbc.ipadx = 10;
    gbc.ipady = 10;
    gbc.gridx = 2;
    gbc.gridwidth = 1;
    pan.add(choose, gbc);
    choose.addActionListener(this);
    open = new Button("Open");
    gbc.gridy = 1;
    gbc.gridx = 1;
    pan.add(open, gbc);
    open.addActionListener(this);
    cancel = new Button("Cancel");
    gbc.gridx = 2;
    pan.add(cancel, gbc);
    cancel.addActionListener(this);
    selectionDialog.add(pan);
    selectionDialog.pack();
    selectionDialog.setLocation(200, 200);

    ////////////////////////////////////////////////////
    // Build the error Dialog box by which the user can
    // be informed of any errors or problems.
    ////////////////////////////////////////////////////
    errorDialog = new Dialog(this, "Error", true);
    errorLabel = new Label("");
    errorDialog.add(errorLabel, "North");
    ok = new Button("OK");
    ok.addActionListener(this);
    errorDialog.add(ok, "South");
    errorDialog.pack();
    errorDialog.setLocation(150, 300);

    Manager.setHint(Manager.PLUGIN_PLAYER, new Boolean(true));
}

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

protected void createRunPanel(JPanel dataPanel) {
    JScrollPane dataScrollPane = new JScrollPane();
    GridBagConstraints gbc_dataScrollPane = new GridBagConstraints();
    gbc_dataScrollPane.weightx = 1.0;/* w  ww  . j a v a2  s .  co  m*/
    gbc_dataScrollPane.weighty = 1.0;
    gbc_dataScrollPane.fill = GridBagConstraints.BOTH;
    gbc_dataScrollPane.gridx = 0;
    gbc_dataScrollPane.gridy = 3;
    dataPanel.add(dataScrollPane, gbc_dataScrollPane);

    JPanel dataRunPanel = new JPanel();
    dataScrollPane.setViewportView(dataRunPanel);
    GridBagLayout gbl_dataRunPanel = new GridBagLayout();
    gbl_dataRunPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_dataRunPanel.rowHeights = new int[] { 0 };
    gbl_dataRunPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            1.0 };
    gbl_dataRunPanel.rowWeights = new double[] { 0.0 };
    dataRunPanel.setLayout(gbl_dataRunPanel);

    createRunTables(dataRunPanel);
}