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:at.tuwien.ifs.feature.evaluation.SimilarityRetrievalGUI.java

public SimilarityRetrievalGUI() {
    super("Similarity Retrieval GUI");
    setLayout(new GridBagLayout());
    GridBagConstraintsIFS gcMain = new GridBagConstraintsIFS(GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // the panel with the feature files, allows to load new ones
    JPanel panelFeatureFiles = UiUtils.makeBorderedPanel(new VerticalLayout(), "Feature files");
    getContentPane().add(panelFeatureFiles, gcMain);

    panelLoadedFeatureFiles.add(labelNoInputData);

    panelFeatureFiles.add(panelLoadedFeatureFiles);

    JButton btnLoad = initButtonLoad();
    panelFeatureFiles.add(btnLoad);/*from w ww  .j a va  2s  . c  om*/

    txtFieldMusicPath.setToolTipText("Path to the music");

    // TODO: remove
    txtFieldMusicPath.setText("/data/music/ISMIRgenre/mp3_44khz_128kbit_stereo_30sec");

    JButton btnBrowseMusicPath = UiUtils.createBrowseButton(txtFieldMusicPath, this, true);

    JPanel panelMusicPath = new JPanel();
    panelMusicPath.add(new JLabel("Music path"));
    panelMusicPath.add(txtFieldMusicPath);
    panelMusicPath.add(btnBrowseMusicPath);

    panelFeatureFiles.add(panelMusicPath);

    initButtonStart();

    initButtonSaveResults();

    JRadioButton rbDistanceAbsolute = UiUtils.makeRadioButton("absolute", bgDistanceDisplay, true);
    bgDistanceDisplay.add(rbDistanceAbsolute);
    JRadioButton rbDistanceRelative = UiUtils.makeRadioButton("relative", bgDistanceDisplay);
    bgDistanceDisplay.add(rbDistanceRelative);

    initPanelRetrieval();

    ((JSpinner.DefaultEditor) spinnerNumberNeighbours.getEditor()).getTextField().setColumns(6);

    panelRetrieval.setBorder(new TitledBorder("Options"));
    GridBagConstraintsIFS gc = new GridBagConstraintsIFS().setInsets(5, 2);
    panelRetrieval.add(new JLabel("# to retrieve"), gc);
    panelRetrieval.add(spinnerNumberNeighbours, gc.nextCol());
    panelRetrieval.add(new JLabel("Query vector"), gc.nextRow());
    panelRetrieval.add(comboQueryVector, gc.nextCol());

    panelRetrieval.add(new JLabel("Distances"), gc.nextRow());
    panelRetrieval.add(UiUtils.makeAndFillPanel(rbDistanceAbsolute, rbDistanceRelative), gc.nextCol());

    boxMetric.setSelectedItem(L2Metric.class.getSimpleName());
    panelRetrieval.add(new JLabel("Distance metric"), gc.nextRow());
    panelRetrieval.add(boxMetric, gc.nextCol());

    gc.nextRow().setGridWidth(2).setAnchor(GridBagConstraints.CENTER);
    panelRetrieval.add(UiUtils.makeAndFillPanel(btnStart, btnSaveResults), gc);
    panelRetrieval.setEnabled(false);

    getContentPane().add(panelRetrieval, gcMain.nextRow());

    resizeResultTableColumns();

    JScrollPane scrollPaneResults = new JScrollPane(resultsTable);
    scrollPaneResults.setBorder(new TitledBorder("Results"));
    getContentPane().add(scrollPaneResults, gcMain.nextRow());

    databaseDetailsTable = new JTable(new DefaultTableModel(new Object[][] {}, databaseDetailsColumnNames));
    databaseDetailsTable.setAutoCreateRowSorter(true);

    databaseDetailsTable.setDefaultEditor(JButton.class, new ButtonCellEditor());

    resizeDatabaseDetailsTableColumns();
    JScrollPane scrollPaneDatabaseDetails = new JScrollPane(databaseDetailsTable);

    // panel in the upper-right corner, holding the database table & buttons to load class assignment
    JPanel databaseDetailsPanel = UiUtils.makeBorderedPanel(new GridBagLayout(), "Database Details");
    GridBagConstraintsIFS gcDatabaseDetails = new GridBagConstraintsIFS(GridBagConstraints.CENTER,
            GridBagConstraints.BOTH);
    gcDatabaseDetails.setWeights(1, 1);
    databaseDetailsPanel.add(scrollPaneDatabaseDetails, gcDatabaseDetails);

    initButtonLoadClassInfo();
    databaseDetailsPanel.add(buttonLoadClassInfo, gc.nextRow());

    JPanel histogramPanel = UiUtils.makeBorderedPanel("Histogram of Distances");
    histogramPanel.add(chartPanel);

    JPanel detailsPanel = new JPanel(new VerticalLayout());
    gcMain.setGridHeight(3);
    gcMain.setWeights(1, 1);
    getContentPane().add(detailsPanel, gcMain.moveTo(1, 0));
    detailsPanel.add(databaseDetailsPanel);
    detailsPanel.add(histogramPanel);

}

From source file:me.childintime.childintime.ui.window.tool.BmiToolDialog.java

/**
 * Build the UI./*from w ww. j a v  a 2  s .c  o  m*/
 */
private void buildUi() {
    // Set the layout
    setLayout(new BorderLayout());

    // Create a grid bag constraints configuration
    GridBagConstraints c = new GridBagConstraints();

    // Create the container and body state panel
    final JPanel container = new JPanel(new GridBagLayout());
    container.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16));

    // Add the close button
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 0, 0, 0);
    container.add(new JLabel("Select a student to see their details."), c);

    // Add the body state panel to the container
    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(16, 0, 0, 0);
    container.add(buildUiBodyStatePanel(), c);

    // Create the close button
    final JButton closeButton = new JButton("Close");
    closeButton.addActionListener(e -> dispose());

    // Add the close button
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.EAST;
    c.insets = new Insets(8, 0, 0, 0);
    container.add(closeButton, c);

    // Add the container
    add(container, BorderLayout.CENTER);
}

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

protected void initializeComponent(ComparisonResult result) {
    if (!this.initialized) {
        this.merging = false;
        this.numberOfLines = 0;

        this.setOpaque(true);

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

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

        this.standardPanel.setOpaque(false);
        GridBagLayout basePanelGridbag = new GridBagLayout();
        this.standardPanel.setLayout(basePanelGridbag);
        this.add(this.standardPanel, this.basePanelConstraints);

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

        JPanel sourcePanel = new JPanel();
        sourcePanel.setOpaque(false);/*from   w w w.  java 2 s.  c  o  m*/
        GridBagLayout sourcePanelGridbag = new GridBagLayout();
        sourcePanel.setLayout(sourcePanelGridbag);
        this.standardPanel.add(sourcePanel, sourcePanelConstraints);

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

        String sourcePath = "No File Specified";
        if ((result != null) && (result.getSource() != null)) {
            File sourceFile = result.getSource().getFile();
            if ((sourceFile == null) || (!sourceFile.exists())) {
                sourcePath = "File does not exist in source location.";
            } else {
                sourcePath = sourceFile.getPath();
            }
            sourceFile = null;
        }
        JLabel sourceFileLabel = new JLabel(sourcePath);
        sourcePath = null;
        sourcePanel.add(sourceFileLabel, sourceFileLabelConstraints);

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

        FileReference sourceReference = null;
        if (result != null) {
            sourceReference = result.getSource();
        }

        FileReference targetReference = null;
        if (result != null) {
            targetReference = result.getTarget();
        }

        JPanel sourceAttributesPanel = this.createFileAttributesPanel(sourceReference, targetReference,
                GridBagConstraints.WEST);
        sourcePanel.add(sourceAttributesPanel, sourceAttributesPanelConstraints);

        this.moreSourceAttributesButton.setHorizontalAlignment(SwingConstants.LEFT);
        this.moreSourceAttributesButton.setBorderPainted(false);
        this.moreSourceAttributesButton.setOpaque(false);
        this.moreSourceAttributesButton.setForeground(Color.blue);

        if (this.editable) {
            this.moreSourceAttributesButton.setText("All attributes...");
            this.moreSourceAttributesButton.addActionListener(this);
            this.moreSourceAttributesButton.setEnabled(true);
        } else {
            this.moreSourceAttributesButton.setText(" ");
            this.moreSourceAttributesButton.setEnabled(false);
        }
        this.moreSourceAttributesButton.setActionCommand(AssuranceActions.sourceAttributesAction);

        GridBagConstraints moreSourceAttributesButtonConstraints = new GridBagConstraints();
        moreSourceAttributesButtonConstraints.anchor = GridBagConstraints.WEST;
        moreSourceAttributesButtonConstraints.fill = GridBagConstraints.BOTH;
        moreSourceAttributesButtonConstraints.gridx = 0;
        moreSourceAttributesButtonConstraints.gridy = 2;
        moreSourceAttributesButtonConstraints.weightx = 1.0;
        moreSourceAttributesButtonConstraints.weighty = 1.0;
        moreSourceAttributesButtonConstraints.gridheight = 1;
        moreSourceAttributesButtonConstraints.gridwidth = 1;
        moreSourceAttributesButtonConstraints.insets = new Insets(0, 0, 0, 0);
        sourcePanel.add(this.moreSourceAttributesButton, moreSourceAttributesButtonConstraints);

        this.buildMergePanel(result);

        GridBagConstraints targetPanelConstraints = new GridBagConstraints();
        targetPanelConstraints.anchor = GridBagConstraints.EAST;
        targetPanelConstraints.fill = GridBagConstraints.BOTH;
        targetPanelConstraints.gridx = 2;
        targetPanelConstraints.gridy = 0;
        targetPanelConstraints.weightx = 0.4;
        targetPanelConstraints.weighty = 1.0;
        targetPanelConstraints.gridheight = 1;
        targetPanelConstraints.gridwidth = 1;
        targetPanelConstraints.insets = new Insets(0, 0, 0, 0);

        JPanel targetPanel = new JPanel();
        GridBagLayout targetPanelGridbag = new GridBagLayout();
        targetPanel.setOpaque(false);
        targetPanel.setLayout(targetPanelGridbag);
        this.standardPanel.add(targetPanel, targetPanelConstraints);

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

        // Create a label to put messages during an action event.
        String targetPath = "No File Specified";
        if ((result != null) && (result.getTarget() != null)) {
            File targetFile = result.getTarget().getFile();
            if ((targetFile == null) || (!targetFile.exists())) {
                targetPath = "File does not exist in target location.";
            } else {
                targetPath = targetFile.getPath();
            }
            targetFile = null;
        }
        JLabel targetFileLabel = new JLabel(targetPath);
        targetPath = null;
        targetPanel.add(targetFileLabel, targetFileLabelConstraints);

        GridBagConstraints targetAttributesPanelConstraints = new GridBagConstraints();
        targetAttributesPanelConstraints.anchor = GridBagConstraints.EAST;
        targetAttributesPanelConstraints.fill = GridBagConstraints.BOTH;
        targetAttributesPanelConstraints.gridx = 0;
        targetAttributesPanelConstraints.gridy = 1;
        targetAttributesPanelConstraints.weightx = 1.0;
        targetAttributesPanelConstraints.weighty = 1.0;
        targetAttributesPanelConstraints.gridheight = 1;
        targetAttributesPanelConstraints.gridwidth = 1;
        targetAttributesPanelConstraints.insets = new Insets(0, 0, 0, 0);

        JPanel targetAttributesPanel = this.createFileAttributesPanel(targetReference, sourceReference,
                GridBagConstraints.EAST);
        targetPanel.add(targetAttributesPanel, targetAttributesPanelConstraints);

        sourceReference = null;
        targetReference = null;

        this.moreTargetAttributesButton.setHorizontalAlignment(SwingConstants.RIGHT);
        this.moreTargetAttributesButton.setBorderPainted(false);
        this.moreTargetAttributesButton.setOpaque(false);
        this.moreTargetAttributesButton.setForeground(Color.blue);

        if (this.editable) {
            this.moreTargetAttributesButton.setText("All attributes...");
            this.moreTargetAttributesButton.addActionListener(this);
            this.moreTargetAttributesButton.setEnabled(true);
        } else {
            this.moreTargetAttributesButton.setText(" ");
            this.moreTargetAttributesButton.setEnabled(false);
        }
        this.moreTargetAttributesButton.setActionCommand(AssuranceActions.targetAttributesAction);

        GridBagConstraints moreTargetAttributesButtonConstraints = new GridBagConstraints();
        moreTargetAttributesButtonConstraints.anchor = GridBagConstraints.EAST;
        moreTargetAttributesButtonConstraints.fill = GridBagConstraints.BOTH;
        moreTargetAttributesButtonConstraints.gridx = 0;
        moreTargetAttributesButtonConstraints.gridy = 2;
        moreTargetAttributesButtonConstraints.weightx = 1.0;
        moreTargetAttributesButtonConstraints.weighty = 1.0;
        moreTargetAttributesButtonConstraints.gridheight = 1;
        moreTargetAttributesButtonConstraints.gridwidth = 1;
        moreTargetAttributesButtonConstraints.insets = new Insets(0, 0, 0, 0);
        targetPanel.add(this.moreTargetAttributesButton, moreTargetAttributesButtonConstraints);

        GridBagLayout mergingPanelGridbag = new GridBagLayout();
        this.mergingPanel.setLayout(mergingPanelGridbag);

        GridBagConstraints mergingLabelConstraints = new GridBagConstraints();
        mergingLabelConstraints.anchor = GridBagConstraints.NORTH;
        mergingLabelConstraints.fill = GridBagConstraints.BOTH;
        mergingLabelConstraints.gridx = 0;
        mergingLabelConstraints.gridy = 0;
        mergingLabelConstraints.weightx = 1.0;
        mergingLabelConstraints.weighty = 1.0;
        mergingLabelConstraints.gridheight = 1;
        mergingLabelConstraints.gridwidth = 1;
        mergingLabelConstraints.insets = new Insets(10, 10, 10, 10);

        this.mergingLabel.setHorizontalAlignment(JLabel.CENTER);
        mergingPanel.add(this.mergingLabel, mergingLabelConstraints);

        GridBagConstraints mergingStatusIndicatorConstraints = new GridBagConstraints();
        mergingStatusIndicatorConstraints.anchor = GridBagConstraints.SOUTH;
        mergingStatusIndicatorConstraints.fill = GridBagConstraints.BOTH;
        mergingStatusIndicatorConstraints.gridx = 0;
        mergingStatusIndicatorConstraints.gridy = 1;
        mergingStatusIndicatorConstraints.weightx = 1.0;
        mergingStatusIndicatorConstraints.weighty = 1.0;
        mergingStatusIndicatorConstraints.gridheight = 1;
        mergingStatusIndicatorConstraints.gridwidth = 1;
        mergingStatusIndicatorConstraints.insets = new Insets(10, 10, 10, 10);

        this.mergingProgressIndicator.setIndeterminate(true);

        mergingPanel.add(this.mergingProgressIndicator, mergingStatusIndicatorConstraints);

        this.addAncestorListener(new AncestorListener() {
            public void ancestorAdded(AncestorEvent event) {
                if (applicationDelegate != null) {
                    applicationDelegate.addEventObserver(ResultMergeStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(ResultMergeProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(ResultMergeCompletedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(DeletedItemRestoreStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(DeletedItemRestoreProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.addEventObserver(DeletedItemRestoreCompletedEvent.class,
                            (IEventObserver) event.getSource());
                }
            }

            public void ancestorRemoved(AncestorEvent event) {
                if (applicationDelegate != null) {
                    applicationDelegate.removeEventObserver(ResultMergeStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(ResultMergeProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(ResultMergeCompletedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(DeletedItemRestoreStartedEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(DeletedItemRestoreProgressEvent.class,
                            (IEventObserver) event.getSource());
                    applicationDelegate.removeEventObserver(DeletedItemRestoreCompletedEvent.class,
                            (IEventObserver) event.getSource());
                }
            }

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

        this.initialized = true;
    }
}

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

/**
 * Description://from   w  w w .  j a  v a 2  s .  c o  m
 * 
 * @param name
 */
protected void initComponent() {
    setLayout(new GridBagLayout());
    setOpaque(false);
    setBorder(BorderFactory.createTitledBorder((Border) null));

    GridBagConstraints gc = new GridBagConstraints();

    gc.fill = GridBagConstraints.BOTH;
    gc.weightx = 1;
    gc.gridwidth = GridBagConstraints.REMAINDER;
    JPanel titlePanel = createTitlePanel();
    add(titlePanel, gc);

    gc.gridwidth = 1;
    JPanel deviceTypePanel = createDeviceTypePanel();
    add(deviceTypePanel, gc);

    gc.gridwidth = GridBagConstraints.REMAINDER;
    JPanel flowTypePanel = createFlowTypePanel();
    add(flowTypePanel, gc);

    gc.weighty = 1;
    gc.fill = GridBagConstraints.BOTH;
    add(Box.createGlue(), gc);
}

From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectAdd.java

/**
 * This method initializes jPanelPjtList   
 *    /*w w w.ja va2s  . c  o m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelPjtList() {
    if (jPanelPjtList == null) {
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridy = 1;
        gridBagConstraints3.fill = GridBagConstraints.BOTH;
        gridBagConstraints3.gridwidth = 2;
        gridBagConstraints3.weighty = 0.1;
        gridBagConstraints3.insets = new Insets(0, 10, 10, 10);
        gridBagConstraints3.ipadx = 0;
        gridBagConstraints3.weightx = 0.1;
        gridBagConstraints3.gridx = 0;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.insets = new Insets(10, 10, 10, 0);
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 0.1;
        gridBagConstraints1.insets = new Insets(10, 10, 10, 10);
        gridBagConstraints1.ipadx = 0;
        gridBagConstraints1.ipady = 0;
        gridBagConstraints1.gridx = 1;
        jLabelFilter = new JLabel();
        jLabelFilter.setText("Filter :");
        jPanelPjtList = new JPanel();
        jPanelPjtList.setLayout(new GridBagLayout());
        jPanelPjtList.setBorder(BorderFactory.createTitledBorder(null, "Project List",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelPjtList.add(jLabelFilter, gridBagConstraints2);
        jPanelPjtList.add(getJTextFieldFilter(), gridBagConstraints1);
        jPanelPjtList.add(getJScrollPanePjtList(), gridBagConstraints3);
    }
    return jPanelPjtList;
}

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

protected void createRunPanel(JPanel dataPanel) {
    JPanel runPanel = new JPanel();
    GridBagConstraints gbc_runPanel = new GridBagConstraints();
    gbc_runPanel.fill = GridBagConstraints.BOTH;
    gbc_runPanel.weightx = 1.0;/* www  . j a v a 2s  .co  m*/
    gbc_runPanel.weighty = 1.0;
    gbc_runPanel.gridx = 0;
    gbc_runPanel.gridy = 3;
    dataPanel.add(runPanel, gbc_runPanel);

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

    JScrollPane dataScrollPane = new JScrollPane();
    createLogDataTable(dataScrollPane);
    GridBagConstraints gbc_dataScrollPane = new GridBagConstraints();
    gbc_dataScrollPane.fill = GridBagConstraints.BOTH;
    gbc_dataScrollPane.ipadx = ColumnWidth * ColumnCount;
    gbc_dataScrollPane.weighty = 1.0;
    gbc_dataScrollPane.gridx = 0;
    gbc_dataScrollPane.gridy = 0;
    runPanel.add(dataScrollPane, gbc_dataScrollPane);

    JScrollPane aprScrollPane = new JScrollPane();
    createAfrDataTables(aprScrollPane);
    GridBagConstraints gbc_aprScrollPane = new GridBagConstraints();
    gbc_aprScrollPane.weightx = 1.0;
    gbc_aprScrollPane.weighty = 1.0;
    gbc_aprScrollPane.anchor = GridBagConstraints.PAGE_START;
    gbc_aprScrollPane.fill = GridBagConstraints.BOTH;
    gbc_aprScrollPane.gridx = 1;
    gbc_aprScrollPane.gridy = 0;
    runPanel.add(aprScrollPane, gbc_aprScrollPane);
}

From source file:de.topobyte.livecg.LiveCG.java

public void setup(boolean exitOnClose, Content content) {
    frame.setSize(800, 600);/*from  ww  w  .  j a  v a2s.com*/
    if (exitOnClose) {
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    frame.setTitle("Live CG");

    GeometryEditor geometryEditor = new GeometryEditor();
    Menu menu = new Menu(this, geometryEditor.getEditPane(), geometryEditor.getEditPane());
    Toolbar toolbar = new Toolbar(geometryEditor.getEditPane(), geometryEditor.getEditPane());

    toolbar.setFloatable(false);

    StatusBar statusBar = new StatusBar();
    StatusBarMouseListener statusBarMouseListener = new StatusBarMouseListener(geometryEditor.getEditPane(),
            statusBar);
    geometryEditor.getEditPane().addMouseListener(statusBarMouseListener);
    geometryEditor.getEditPane().addMouseMotionListener(statusBarMouseListener);

    GridBagConstraints c = new GridBagConstraints();

    JPanel mainPanel = new JPanel(new GridBagLayout());
    frame.setJMenuBar(menu);
    frame.setContentPane(mainPanel);

    c.weightx = 1.0;
    c.fill = GridBagConstraints.BOTH;

    c.gridy = 0;
    c.weighty = 0.0;
    mainPanel.add(toolbar, c);

    c.gridy = 1;
    c.weighty = 1.0;
    mainPanel.add(geometryEditor, c);

    c.gridy = 2;
    c.weighty = 0.0;
    mainPanel.add(statusBar, c);

    frame.setLocationByPlatform(true);
    frame.setVisible(true);

    objectDialog = new ObjectDialog(frame, geometryEditor.getEditPane());
    objectDialog.setSize(300, 300);

    contentDialog = new ContentDialog(frame, geometryEditor.getEditPane());
    contentDialog.setSize(300, 300);

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (showObjectDialog) {
                showObjectDialog();
            }
            if (showContentDialog) {
                showContentDialog();
            }
        }
    });

    if (content != null) {
        geometryEditor.getEditPane().setContent(content);
    }
}

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

/**
 * This method initializes jPanel   /* w ww .  jav a 2s.com*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
        gridBagConstraints9.fill = GridBagConstraints.BOTH;
        gridBagConstraints9.gridy = 4;
        gridBagConstraints9.weightx = 1.0;
        gridBagConstraints9.anchor = GridBagConstraints.WEST;
        gridBagConstraints9.gridx = 1;
        GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
        gridBagConstraints8.gridx = 0;
        gridBagConstraints8.anchor = GridBagConstraints.EAST;
        gridBagConstraints8.gridy = 4;
        jLabel4 = new JLabel();
        jLabel4.setText("Image Of:");
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.gridx = 1;
        gridBagConstraints7.weighty = 1.0;
        gridBagConstraints7.gridy = 6;
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.gridx = 1;
        gridBagConstraints6.gridy = 5;
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.fill = GridBagConstraints.BOTH;
        gridBagConstraints5.gridy = 3;
        gridBagConstraints5.weightx = 1.0;
        gridBagConstraints5.anchor = GridBagConstraints.WEST;
        gridBagConstraints5.gridx = 1;
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.gridx = 0;
        gridBagConstraints4.anchor = GridBagConstraints.EAST;
        gridBagConstraints4.weighty = 0.0;
        gridBagConstraints4.gridy = 3;
        jLabel3 = new JLabel();
        jLabel3.setText("DrawerNumber:");
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridwidth = 2;
        gridBagConstraints3.weighty = 0.0;
        gridBagConstraints3.anchor = GridBagConstraints.NORTH;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.fill = GridBagConstraints.BOTH;
        gridBagConstraints2.gridy = 2;
        gridBagConstraints2.weightx = 1.0;
        gridBagConstraints2.anchor = GridBagConstraints.WEST;
        gridBagConstraints2.gridx = 1;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.anchor = GridBagConstraints.EAST;
        gridBagConstraints1.weighty = 0.0;
        gridBagConstraints1.gridy = 2;
        jLabel2 = new JLabel();
        jLabel2.setText("Barcode:");
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.insets = new Insets(0, 0, 5, 0);
        gridBagConstraints.weighty = 0.0;
        gridBagConstraints.gridy = 1;
        jLabel1 = new JLabel();
        jLabel1.setText("Please Identify this Image.");
        jLabel = new JLabel();
        jLabel.setText("No Barcode or drawer number found.");
        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        jPanel.add(jLabel, gridBagConstraints3);
        jPanel.add(jLabel1, gridBagConstraints);
        jPanel.add(jLabel2, gridBagConstraints1);
        jPanel.add(getJTextFieldBarcode(), gridBagConstraints2);
        jPanel.add(jLabel3, gridBagConstraints4);
        jPanel.add(getJTextFieldDrawerNumber(), gridBagConstraints5);
        jPanel.add(getJButton(), gridBagConstraints6);
        jPanel.add(getJPanel2(), gridBagConstraints7);
        jPanel.add(jLabel4, gridBagConstraints8);
        jPanel.add(getJComboBox(), gridBagConstraints9);
    }
    return jPanel;
}

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

/**
 * This method initializes jPanelUserInfo   
 *    //  w  w w . j  a v a  2  s. c  o m
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelUserInfo() {

    if (jPanelUserInfo == null) {

        jPanelUserInfo = new JPanel();
        jPanelUserInfo.setLayout(new GridBagLayout());

        // User ID
        JLabel jLabelUser = new JLabel("User ID:");
        jLabelUser.setHorizontalAlignment(SwingConstants.RIGHT);
        jLabelUser.setText("User ID :");
        jLabelUser.setEnabled(true);
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridx = 0;
        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new Insets(0, 10, 0, 0);
        jPanelUserInfo.add(jLabelUser, gridBagConstraints);

        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.BOTH;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.gridx = 1;
        gridBagConstraints1.weightx = 1.0;
        gridBagConstraints1.insets = new Insets(5, 5, 5, 5);
        jPanelUserInfo.add(getJTextFieldUser(), gridBagConstraints1);

        // Password
        JLabel jLabelPwd = new JLabel();
        jLabelPwd.setText("Password :");
        jLabelPwd.setHorizontalAlignment(SwingConstants.RIGHT);
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridy = 1;
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints2.insets = new Insets(0, 10, 0, 0);
        jPanelUserInfo.add(jLabelPwd, gridBagConstraints2);

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.fill = GridBagConstraints.BOTH;
        gridBagConstraints3.gridy = 1;
        gridBagConstraints3.gridx = 1;
        gridBagConstraints3.weightx = 1.0;
        gridBagConstraints3.insets = new Insets(5, 5, 5, 5);
        jPanelUserInfo.add(getJPasswordField(), gridBagConstraints3);

        // Protex Server IP
        JLabel jLabelServer = new JLabel();
        jLabelServer.setText("Protex Server IP :");
        jLabelServer.setHorizontalAlignment(SwingConstants.RIGHT);
        jLabelServer.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridy = 2;
        gridBagConstraints11.gridx = 0;
        gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints11.insets = new Insets(0, 10, 5, 0);
        jPanelUserInfo.add(jLabelServer, gridBagConstraints11);

        GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
        gridBagConstraints21.gridy = 2;
        gridBagConstraints21.gridx = 1;
        gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints21.insets = new Insets(5, 5, 10, 5);

        jPanelUserInfo.add(getJTextFieldServerIP(), gridBagConstraints21);
    }
    return jPanelUserInfo;
}

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

private void initialize() {
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;//from ww  w. j  a v  a2 s.c om
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 5;
    gridBagConstraints.weightx = 0.7;
    gridBagConstraints.insets = new Insets(10, 300, 0, 0); //(int top, int left, int bottom, int right)
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
    gridBagConstraints7.gridx = 5;
    gridBagConstraints7.gridy = 0;
    gridBagConstraints7.weightx = 0.3;
    gridBagConstraints7.insets = new Insets(10, 0, 0, 90);
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
    gridBagConstraints3.gridx = 0;
    gridBagConstraints3.gridy = 1;
    gridBagConstraints3.weightx = 1.0;
    gridBagConstraints3.gridwidth = 6;
    GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
    gridBagConstraints5.fill = GridBagConstraints.BOTH;
    gridBagConstraints5.gridx = 0;
    gridBagConstraints5.gridy = 2;
    gridBagConstraints5.weightx = 1.0;
    gridBagConstraints5.weighty = 1.0;
    gridBagConstraints5.gridwidth = 6;
    this.setSize(920, 700);
    this.setLayout(new GridBagLayout());
    this.add(getJPanelProjectCombo(), gridBagConstraints);
    this.add(getJPanelAutoIdentify(), gridBagConstraints7);
    this.add(JPanPendingTypeSelection(), gridBagConstraints3);
    this.add(getJSplitPaneMain(), gridBagConstraints5);
}