Java Code Examples for java.awt.GridBagConstraints

The following are top voted examples for showing how to use java.awt.GridBagConstraints. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: java_awt_GridBagConstraints.java   Source Code and License 6 votes vote down vote up
protected GridBagConstraints getObject() {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.gridwidth = 3;
    gbc.gridheight = 4;
    gbc.weightx = 0.1;
    gbc.weighty = 0.2;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.fill = GridBagConstraints.VERTICAL;
    gbc.insets.top = 1;
    gbc.insets.left = 2;
    gbc.insets.right = 3;
    gbc.insets.bottom = 4;
    gbc.ipadx = -1;
    gbc.ipady = -2;
    return gbc;
}
 
Example 2
Project: incubator-netbeans   File: BasicSearchForm.java   Source Code and License 6 votes vote down vote up
public void addRow(JComponent label, JComponent component) {

            GridBagConstraints c = new GridBagConstraints();
            c.gridx = 0;
            c.anchor = GridBagConstraints.NORTHWEST;
            c.gridy = row;
            c.weightx = 0;
            c.weighty = 0;
            c.insets = new Insets(5, 5, 5, 5);
            add(label, c);

            c.gridx = 1;
            c.weightx = 1;
            c.fill = GridBagConstraints.HORIZONTAL;
            add(component, c);

            row++;
        }
 
Example 3
Project: AgentWorkbench   File: DynFormText.java   Source Code and License 6 votes vote down vote up
/**
 * This method initializes this
 * @return void
 */
private void initialize() {
	GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
	gridBagConstraints11.gridx = 0;
	gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
	gridBagConstraints11.weightx = 1.0;
	gridBagConstraints11.gridy = 1;
	
	GridBagConstraints gridBagConstraints = new GridBagConstraints();
	gridBagConstraints.fill = GridBagConstraints.BOTH;
	gridBagConstraints.weightx = 1.0;
	gridBagConstraints.weighty = 1.0;
	gridBagConstraints.gridwidth = 1;
	
	this.setSize(300, 200);
	this.setLayout(new GridBagLayout());
	this.add(getJScrollPaneTextVersion(), gridBagConstraints);
	this.add(getJPanelBottom(), gridBagConstraints11);
}
 
Example 4
Project: rapidminer   File: ManageDatabaseDriversDialog.java   Source Code and License 6 votes vote down vote up
private void add(String labelKey, JComponent component, JComponent button) {
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = 23;
    c.weightx = 0.5D;
    c.weighty = 1.0D;
    c.fill = 1;
    c.gridheight = 1;
    ResourceLabel label = new ResourceLabel("manage_database_drivers." + labelKey, new Object[0]);
    label.setLabelFor(component);
    c.gridwidth = 0;
    this.add(label, c);
    c.insets = new Insets(0, 0, 5, 0);
    if(button == null) {
        c.gridwidth = 0;
        this.add(component, c);
    } else {
        c.gridwidth = -1;
        c.weightx = 1.0D;
        this.add(component, c);
        c.gridwidth = 0;
        c.weightx = 0.0D;
        c.insets = new Insets(0, 5, 5, 0);
        this.add(button, c);
    }

}
 
Example 5
Project: rapidminer   File: SimilarityTable.java   Source Code and License 6 votes vote down vote up
public SimilarityTable(DistanceMeasure measure, ExampleSet exampleSet) {
	GridBagLayout layout = new GridBagLayout();
	setLayout(layout);
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 1;
	c.weighty = 1;
	c.gridwidth = GridBagConstraints.REMAINDER;

	similarityTable = new ExtendedJTable();
	SimilarityTableModel model = new SimilarityTableModel(measure, exampleSet);
	similarityTable.setModel(model);

	JScrollPane tablePane = new ExtendedJScrollPane(similarityTable);
	tablePane.setBorder(null);
	layout.setConstraints(tablePane, c);
	add(tablePane);
}
 
Example 6
Project: incubator-netbeans   File: HierarchyTopComponent.java   Source Code and License 6 votes vote down vote up
@NonNull
private static Pair<JComponent, GridBagConstraints> constrainedComponent(
        @NonNull final JComponent component,
        final int fill,
        final double weightx,
        @NonNull final Insets insets) {
    final GridBagConstraints c = new GridBagConstraints();
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = weightx;
    c.weighty = 0;
    c.anchor = GridBagConstraints.WEST;
    c.fill = fill;
    c.insets = insets;
    return Pair.<JComponent,GridBagConstraints>of(component,c);
}
 
Example 7
Project: incubator-netbeans   File: StartPageContent.java   Source Code and License 6 votes vote down vote up
public StartPageContent() {
    super( new GridBagLayout() );

    JComponent tabs = new TabbedPane( new LearnAndDiscoverTab(),
            new MyNetBeansTab(),
            new WhatsNewTab());
    tabs.setBorder(BorderFactory.createEmptyBorder(10,15,15,15));
    tabs.setOpaque(false);

    add( tabs, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(27,0,0,0), 0, 0) );

    add( new JLabel(), new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0) );
}
 
Example 8
Project: oxygen-dita-translation-package-builder   File: ShowModifiedFilesDialog.java   Source Code and License 6 votes vote down vote up
/**
* Private constructor
*/
private ShowModifiedFilesDialog() {
  setLayout(new GridBagLayout());
  modifiedFiles = new JTextArea(10, 40);
  modifiedFiles.setLineWrap(true);
  modifiedFiles.setWrapStyleWord(true);
  modifiedFiles.setEditable(false);

  JScrollPane scroll = new JScrollPane(modifiedFiles);
  scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 1;
  gbc.gridwidth = 1;
  gbc.gridheight = 1;
  gbc.weightx = 0;
  gbc.weighty = 0;
  gbc.fill = GridBagConstraints.BOTH;
  gbc.anchor = GridBagConstraints.LINE_START;
  add(scroll , gbc);
}
 
Example 9
Project: incubator-netbeans   File: DetectPanel.java   Source Code and License 6 votes vote down vote up
@Override
public void readSettings(WizardDescriptor settings) {           
    sources = null;
    sourcesString = null;
    javadoc = null;
    javadocString = null;
    this.wiz = settings;
    this.component.progressPanel.setVisible (true);
    this.component.progressLabel.setVisible (true);
    
    this.progressHandle = ProgressHandleFactory.createHandle(NbBundle.getMessage(DetectPanel.class,"TXT_PlatfromDetectProgress"));
    this.component.progressPanel.removeAll();
    this.component.progressPanel.setLayout (new GridBagLayout ());
    GridBagConstraints c = new GridBagConstraints ();
    c.gridx = c.gridy = GridBagConstraints.RELATIVE;
    c.gridheight = c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    JComponent pc = ProgressHandleFactory.createProgressComponent(this.progressHandle);
    ((GridBagLayout)this.component.progressPanel.getLayout ()).setConstraints(pc,c);
    this.component.progressPanel.add (pc);
    this.progressHandle.start ();
    task.schedule(0);
}
 
Example 10
Project: rapidminer   File: CardHeaderPanel.java   Source Code and License 6 votes vote down vote up
public CardHeaderPanel(String i18nKey) {
    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new Insets(20, 0, 20, 0);
    JLabel label = new JLabel(I18N.getGUILabel(i18nKey, new Object[0])) {
        private static final long serialVersionUID = 1L;

        public void paintComponent(Graphics g) {
            SwingTools.disableClearType(this);
            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            super.paintComponent(g);
        }
    };
    label.setFont(OPEN_SANS_SEMIBOLD_18);
    label.setHorizontalTextPosition(2);
    this.add(label, gbc);
    ++gbc.gridx;
    gbc.fill = 2;
    gbc.weightx = 1.0D;
    this.add(new JLabel(), gbc);
    this.setOpaque(false);
    this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 20, 30, 20), BorderFactory.createMatteBorder(0, 0, 1, 0, GettingStartedDialog.VERY_LIGHT_GRAY)));
}
 
Example 11
Project: LogisticApp   File: MenuContratacaoTransporteFrame.java   Source Code and License 6 votes vote down vote up
private void initializeComboBoxes() throws Exception {
	List<LocalidadeVO> localidades = this.contratacaoTransporte.recuperarLocalidades();

	this.cboxOrigem = new JComboBox<LocalidadeVO>();

	GridBagConstraints gbc_comboBox = new GridBagConstraints();
	gbc_comboBox.gridwidth = 2;
	gbc_comboBox.fill = GridBagConstraints.BOTH;
	gbc_comboBox.insets = new Insets(0, 0, 5, 5);
	gbc_comboBox.gridx = 7;
	gbc_comboBox.gridy = 3;
	this.panelSecond.add(this.cboxOrigem, gbc_comboBox);

	this.startComboBoxValues(this.cboxOrigem, localidades);

	this.cboxDestino = new JComboBox<LocalidadeVO>();
	GridBagConstraints gbc_comboBox_1 = new GridBagConstraints();
	gbc_comboBox_1.gridwidth = 2;
	gbc_comboBox_1.insets = new Insets(0, 0, 5, 5);
	gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL;
	gbc_comboBox_1.gridx = 7;
	gbc_comboBox_1.gridy = 7;
	this.panelSecond.add(this.cboxDestino, gbc_comboBox_1);

	this.startComboBoxValues(this.cboxDestino, localidades);
}
 
Example 12
Project: LogisticApp   File: LocalidadeFrame.java   Source Code and License 6 votes vote down vote up
private void initializeButtons() {
	this.btnVoltar = new JButton("< Voltar");
	GridBagConstraints gbc_button = new GridBagConstraints();
	gbc_button.gridwidth = 2;
	gbc_button.insets = new Insets(0, 0, 5, 5);
	gbc_button.gridx = 2;
	gbc_button.gridy = 1;
	this.panelFirst.add(this.btnVoltar, gbc_button);

	this.btnFeito = new JButton("Feito");
	GridBagConstraints gbc_btnFeito = new GridBagConstraints();
	gbc_btnFeito.insets = new Insets(0, 0, 5, 5);
	gbc_btnFeito.gridx = 8;
	gbc_btnFeito.gridy = 1;
	this.panelFirst.add(this.btnFeito, gbc_btnFeito);

	this.btnFeito.addActionListener(this);
	this.btnVoltar.addActionListener(this);
}
 
Example 13
Project: openjdk-jdk10   File: PolicyTool.java   Source Code and License 6 votes vote down vote up
/**
 * display the warning log
 */
void displayWarningLog(Window w) {

    ToolDialog wd = new ToolDialog
            (PolicyTool.getMessage("Warning"), tool, this, true);

    // find the location of the PolicyTool gui
    Point location = ((w == null) ?
            getLocationOnScreen() : w.getLocationOnScreen());
    //wd.setBounds(location.x + 50, location.y + 50, 500, 100);
    wd.setLayout(new GridBagLayout());

    JTextArea ta = new JTextArea();
    ta.setEditable(false);
    for (int i = 0; i < tool.warnings.size(); i++) {
        ta.append(tool.warnings.elementAt(i));
        ta.append(PolicyTool.getMessage("NEWLINE"));
    }
    addNewComponent(wd, ta, 0,
                    0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
                    BOTTOM_PADDING);
    ta.setFocusable(false);

    JButton okButton = new JButton(PolicyTool.getMessage("OK"));
    ActionListener okListener = new CancelButtonListener(wd);
    okButton.addActionListener(okListener);
    addNewComponent(wd, okButton, 1,
                    0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
                    LR_PADDING);

    wd.getRootPane().setDefaultButton(okButton);
    wd.getRootPane().registerKeyboardAction(okListener, escKey, JComponent.WHEN_IN_FOCUSED_WINDOW);

    wd.pack();
    wd.setLocationRelativeTo(w);
    wd.setVisible(true);
}
 
Example 14
Project: incubator-netbeans   File: ProgressPanel.java   Source Code and License 6 votes vote down vote up
/** Creates new form ProgressPanel */
public ProgressPanel() {
    initComponents();
    handle = ProgressHandleFactory.createHandle(
            NbBundle.getMessage(ImportProjectAction.class, "CTL_ProgressDialogTitle")); // NOI18N
    progress = ProgressHandleFactory.createProgressComponent(handle);
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(450, 80));
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new Insets(0, 5, 0, 5);
    add(progress, gridBagConstraints);
}
 
Example 15
Project: incubator-netbeans   File: DesktopImpl.java   Source Code and License 6 votes vote down vote up
private void setViewComponent( Component component) {
    if (viewComponent == component) {
        return;
    }
    if (viewComponent != null) {
        desktop.remove(viewComponent);
    }
    viewComponent = component;
    if (viewComponent != null) {
        GridBagConstraints constr = new GridBagConstraints();
        constr.gridx = 1;
        constr.gridy = 1;
        constr.fill = GridBagConstraints.BOTH;
        constr.weightx = 1;
        constr.weighty = 1;
        constr.anchor = GridBagConstraints.CENTER;
        Insets insets = UIManager.getInsets("nb.desktop.view.insets"); //NOI18N
        if( null != insets )
            constr.insets = insets;
        desktop.add(component, constr);
    }
    layeredPane.revalidate();
    layeredPane.repaint();
}
 
Example 16
Project: oxygen-git-plugin   File: ChangesPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Adds the switchView button the the panel
 * 
 * @param gbc
 *          - the constraints used for this component
 */
private void addSwitchViewButton(GridBagConstraints gbc) {
	gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
			UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
	gbc.anchor = GridBagConstraints.EAST;
	gbc.fill = GridBagConstraints.NONE;
	gbc.gridx = 2;
	gbc.gridy = 0;
	gbc.weightx = 0;
	gbc.weighty = 0;
	JToolBar toolbar = new JToolBar();
	switchViewButton = new ToolbarButton(null, false);
	switchViewButton.setToolTipText(translator.getTranslation(Tags.CHANGE_TREE_VIEW_BUTTON_TOOLTIP));
	URL resource = currentViewMode == ResourcesViewMode.FLAT_VIEW 
	    ? getClass().getResource(ImageConstants.TREE_VIEW)
	    : getClass().getResource(ImageConstants.TABLE_VIEW);
	if (resource != null) {
	  ImageIcon icon = (ImageIcon) imageUtilities.loadIcon(resource);
	  switchViewButton.setIcon(icon);
	}
	toolbar.add(switchViewButton);
	toolbar.setFloatable(false);
	toolbar.setOpaque(false);
	this.add(toolbar, gbc);

}
 
Example 17
Project: Reinickendorf_SER316   File: TaigaProjectListWizardStep.java   Source Code and License 6 votes vote down vote up
/**
 * Create the panel.
 */
public TaigaProjectListWizardStep() {
	GridBagLayout gridBagLayout = new GridBagLayout();
	gridBagLayout.columnWidths = new int[]{365, 0};
	gridBagLayout.rowHeights = new int[]{0, 0, 0};
	gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
	gridBagLayout.rowWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
	setLayout(gridBagLayout);
	
	JLabel lblChooseAProject = new JLabel("Choose a project from the list below:");
	GridBagConstraints gbc_lblChooseAProject = new GridBagConstraints();
	gbc_lblChooseAProject.insets = new Insets(0, 0, 5, 0);
	gbc_lblChooseAProject.gridx = 0;
	gbc_lblChooseAProject.gridy = 0;
	add(lblChooseAProject, gbc_lblChooseAProject);
	
	GridBagConstraints gbc_projectList = new GridBagConstraints();
	gbc_projectList.fill = GridBagConstraints.BOTH;
	gbc_projectList.gridx = 0;
	gbc_projectList.gridy = 1;
	add(projectList, gbc_projectList);
}
 
Example 18
Project: GIFKR   File: ProgressFrame.java   Source Code and License 6 votes vote down vote up
public ProgressFrame() {
	
	initializeComponents();
	addActionListeners();
	
	setLayout(new GridBagLayout());
	GridBagConstraints gbc = ViewUtils.createGBC();
	gbc.fill = GridBagConstraints.NONE;
	
	add(progressText, gbc);
	gbc.gridy++;
	
	add(cancelButton, gbc);
	
	setSize(500, 200);
	setLocationRelativeTo(null);
	setUndecorated(true);
	setBackground(bg);
}
 
Example 19
Project: ObsidianSuite   File: TimelineFrame.java   Source Code and License 6 votes vote down vote up
private JPanel createRightPane()
{
	JPanel rightPanel = new JPanel();
	rightPanel.setLayout(new GridBagLayout());

	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	rightPanel.add(controller.keyframeController.panel,c);
	c.gridx = 0;
	c.gridy = 1;
	c.fill = GridBagConstraints.HORIZONTAL;
	rightPanel.add(actionsPanel, c);
	
	return rightPanel;
}
 
Example 20
Project: AgentWorkbench   File: ProjectInfo.java   Source Code and License 6 votes vote down vote up
/**
 * Switch JPanel for the version of the project between edit and view mode.
 */
public void switchJPanelVersion() {
	
	GridBagConstraints gbc_jPanelVersion = new GridBagConstraints();
	gbc_jPanelVersion.fill = GridBagConstraints.BOTH;
	gbc_jPanelVersion.gridheight = 5;
	gbc_jPanelVersion.gridx = 0;
	gbc_jPanelVersion.gridy = 0;

	if (this.isVersionEdit==true) {
		this.getJPanelUpdateOptions().remove(this.getJPanelVersionEdit());
		this.getJPanelUpdateOptions().add(this.getJPanelVersion(), gbc_jPanelVersion);
		this.getLabelVersionInfo().setText(this.currProject.getVersionInformation().toString());
		this.isVersionEdit = false;
	} else {
		this.getJPanelUpdateOptions().remove(this.getJPanelVersion());
		this.getJPanelUpdateOptions().add(this.getJPanelVersionEdit(), gbc_jPanelVersion);
		this.getJPanelVersionEdit().updateVersionInformation();
		this.isVersionEdit = true;
	}
	this.validate();
	this.repaint();
}
 
Example 21
Project: incubator-netbeans   File: InstallationDetailsDialog.java   Source Code and License 6 votes vote down vote up
private void initComponents() {
    setLayout(new GridBagLayout());
    
    detailsTreeTable = new NbiTreeTable(new InstallationDetailsTreeTableModel());
    detailsTreeTable.setShowVerticalLines(false);
    detailsTreeTable.setOpaque(false);
    detailsTreeTable.setTableHeader(null);
    detailsTreeTable.setRowHeight(detailsTreeTable.getRowHeight() + 4);
    detailsTreeTable.setIntercellSpacing(new Dimension(0, 0));
    detailsTreeTable.setTreeColumnCellRenderer(new InstallationDetailsTreeColumnCellRenderer(detailsTreeTable));
    detailsTreeTable.getColumnModel().getColumn(1).setMaxWidth(200);
    detailsTreeTable.getColumnModel().getColumn(1).setMinWidth(200);
    detailsTreeTable.getColumnModel().getColumn(1).setCellRenderer(new InstallationStatusCellRenderer());
    detailsTreeTable.setRowSelectionAllowed(false);
    detailsTreeTable.setColumnSelectionAllowed(false);
    detailsTreeTable.setCellSelectionEnabled(false);
    
    detailsScrollPane = new NbiScrollPane(detailsTreeTable);
    
    add(detailsScrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0));
}
 
Example 22
Project: AgentWorkbench   File: FeaturePanel.java   Source Code and License 6 votes vote down vote up
/**
 * Initialize.
 */
private void initialize() {
	
	GridBagLayout gridBagLayout = new GridBagLayout();
	gridBagLayout.columnWidths = new int[]{0, 0, 0};
	gridBagLayout.rowHeights = new int[]{0, 0};
	gridBagLayout.columnWeights = new double[]{1.0, 0.0, Double.MIN_VALUE};
	gridBagLayout.rowWeights = new double[]{1.0, Double.MIN_VALUE};
	this.setLayout(gridBagLayout);
	GridBagConstraints gbc_jScrollPaneProjectFeatures = new GridBagConstraints();
	gbc_jScrollPaneProjectFeatures.insets = new Insets(0, 0, 0, 5);
	gbc_jScrollPaneProjectFeatures.fill = GridBagConstraints.BOTH;
	gbc_jScrollPaneProjectFeatures.gridx = 0;
	gbc_jScrollPaneProjectFeatures.gridy = 0;
	this.add(this.getJScrollPaneProjectFeatures(), gbc_jScrollPaneProjectFeatures);
	GridBagConstraints gbc_jPanelFeatureButtons = new GridBagConstraints();
	gbc_jPanelFeatureButtons.insets = new Insets(0, 5, 0, 0);
	gbc_jPanelFeatureButtons.fill = GridBagConstraints.BOTH;
	gbc_jPanelFeatureButtons.gridx = 1;
	gbc_jPanelFeatureButtons.gridy = 0;
	this.add(this.getJPanelFeatureButtons(), gbc_jPanelFeatureButtons);
			
}
 
Example 23
Project: AgentWorkbench   File: EnvironmentModel.java   Source Code and License 6 votes vote down vote up
/**
 * Initialize.
 */
private void initialize() {
	GridBagLayout gridBagLayout = new GridBagLayout();
	gridBagLayout.columnWidths = new int[] { 0, 0 };
	gridBagLayout.rowHeights = new int[] { 0, 0, 0 };
	gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
	gridBagLayout.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
	setLayout(gridBagLayout);
	GridBagConstraints gbc_jPanelSimulationEnvironment = new GridBagConstraints();
	gbc_jPanelSimulationEnvironment.insets = new Insets(10, 10, 0, 0);
	gbc_jPanelSimulationEnvironment.anchor = GridBagConstraints.NORTH;
	gbc_jPanelSimulationEnvironment.fill = GridBagConstraints.HORIZONTAL;
	gbc_jPanelSimulationEnvironment.gridx = 0;
	gbc_jPanelSimulationEnvironment.gridy = 0;
	add(getJPanelSimulationEnvironment(), gbc_jPanelSimulationEnvironment);
	GridBagConstraints gbc_jPanelTimeModelSelection = new GridBagConstraints();
	gbc_jPanelTimeModelSelection.anchor = GridBagConstraints.WEST;
	gbc_jPanelTimeModelSelection.insets = new Insets(10, 10, 0, 0);
	gbc_jPanelTimeModelSelection.fill = GridBagConstraints.VERTICAL;
	gbc_jPanelTimeModelSelection.gridx = 0;
	gbc_jPanelTimeModelSelection.gridy = 1;
	add(getJPanelTimeModelSelection(), gbc_jPanelTimeModelSelection);

}
 
Example 24
Project: incubator-netbeans   File: Attribute.java   Source Code and License 6 votes vote down vote up
private void setLabelPanel(JPanel panel, GridBagConstraints c) {
    // []
    c.gridy++;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(0, LARGE_SIZE, TINY_SIZE, 0);
    panel.add(new JLabel(), c);

    // left
    panel.add(createLabel(i18n("LBL_Left")), c); // NOI18N

    // center
    panel.add(createLabel(i18n("LBL_Center")), c); // NOI18N

    // right
    panel.add(createLabel(i18n("LBL_Right")), c); // NOI18N
}
 
Example 25
Project: jdk8u-jdk   File: JDK8048887.java   Source Code and License 5 votes vote down vote up
public TestDialog() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    for (int i=0; i < Xs.length; i++) {
        gbc.gridx = Xs[i];
        gbc.gridy = 100 - gbc.gridx;
        panel.add(new MyComponent(), gbc);
    }
    getRootPane().getContentPane().add(panel);
    pack();
}
 
Example 26
Project: AgentWorkbench   File: ThreadMonitorMetricsTableTab.java   Source Code and License 5 votes vote down vote up
/**
 * Initialize.
 */
private void initialize() {
	GridBagLayout gridBagLayout = new GridBagLayout();
	gridBagLayout.columnWidths = new int[]{450, 0};
	gridBagLayout.rowHeights = new int[] {241, 30, 15, 0};
	gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
	gridBagLayout.rowWeights = new double[]{1.0, 0.0, 0.0, Double.MIN_VALUE};
	setLayout(gridBagLayout);
	GridBagConstraints gbc_scrollPaneTable = new GridBagConstraints();
	gbc_scrollPaneTable.fill = GridBagConstraints.BOTH;
	gbc_scrollPaneTable.insets = new Insets(0, 0, 5, 0);
	gbc_scrollPaneTable.gridx = 0;
	gbc_scrollPaneTable.gridy = 0;
	this.add(getScrollPaneTable(), gbc_scrollPaneTable);
	GridBagConstraints gbc_JPanelFilter = new GridBagConstraints();
	gbc_JPanelFilter.insets = new Insets(0, 0, 5, 0);
	gbc_JPanelFilter.anchor = GridBagConstraints.SOUTH;
	gbc_JPanelFilter.fill = GridBagConstraints.HORIZONTAL;
	gbc_JPanelFilter.gridx = 0;
	gbc_JPanelFilter.gridy = 1;
	this.add(getJPanelFilter(), gbc_JPanelFilter);
	GridBagConstraints gbc_JPanelOptions = new GridBagConstraints();
	gbc_JPanelOptions.fill = GridBagConstraints.HORIZONTAL;
	gbc_JPanelOptions.anchor = GridBagConstraints.SOUTH;
	gbc_JPanelOptions.gridx = 0;
	gbc_JPanelOptions.gridy = 2;
	add(getJPanelOptions(), gbc_JPanelOptions);
}
 
Example 27
Project: oxygen-git-plugin   File: WorkingCopySelectionPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Adds the label to the panel
 * 
 * @param gbc
 *          - the constraints used for this component
 */
private void addLabel(GridBagConstraints gbc) {
	gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
			UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
	gbc.anchor = GridBagConstraints.WEST;
	gbc.fill = GridBagConstraints.NONE;
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 0;
	gbc.weighty = 0;
	this.add(new JLabel(translator.getTranslation(Tags.WORKING_COPY_LABEL)), gbc);

}
 
Example 28
Project: jdk8u-jdk   File: ServiceDialog.java   Source Code and License 5 votes vote down vote up
public SidesPanel() {
    super();

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    setLayout(gridbag);
    setBorder(BorderFactory.createTitledBorder(strTitle));

    c.fill = GridBagConstraints.BOTH;
    c.insets = compInsets;
    c.weighty = 1.0;
    c.gridwidth = GridBagConstraints.REMAINDER;

    ButtonGroup bg = new ButtonGroup();
    rbOneSide = new IconRadioButton("radiobutton.oneside",
                                    "oneside.png", true,
                                    bg, this);
    rbOneSide.addActionListener(this);
    addToGB(rbOneSide, this, gridbag, c);
    rbTumble = new IconRadioButton("radiobutton.tumble",
                                   "tumble.png", false,
                                   bg, this);
    rbTumble.addActionListener(this);
    addToGB(rbTumble, this, gridbag, c);
    rbDuplex = new IconRadioButton("radiobutton.duplex",
                                   "duplex.png", false,
                                   bg, this);
    rbDuplex.addActionListener(this);
    c.gridwidth = GridBagConstraints.REMAINDER;
    addToGB(rbDuplex, this, gridbag, c);
}
 
Example 29
Project: incubator-netbeans   File: BasicSearchForm.java   Source Code and License 5 votes vote down vote up
public void addEmptyLine() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = row;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 1;
    c.weightx = 0.1;
    JLabel emptyLabel = new JLabel();
    emptyLabel.setPreferredSize(new Dimension(0, 0));
    emptyLabel.setMinimumSize(new Dimension(0, 0));
    add(emptyLabel, c);
    row++;
}
 
Example 30
Project: nbreleaseplugin   File: VersionUpdaterPanel.java   Source Code and License 5 votes vote down vote up
private void insertValue(JComponent value) {
    GridBagConstraints c = new GridBagConstraints();
    c.gridy = nextrow++;
    c.anchor = GridBagConstraints.PAGE_START;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 1;
    c.weightx = 1.0;
    c.ipady = 5;
    c.ipadx = 10;
    add(value, c);
}
 
Example 31
Project: incubator-netbeans   File: OptionsPanel.java   Source Code and License 5 votes vote down vote up
private void addFakeButton () {
    /* i don't know a better workaround */
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.gridy = 0;
    pCategories2.add (new javax.swing.JLabel (""), gbc);
}
 
Example 32
Project: openjdk-jdk10   File: ServiceDialog.java   Source Code and License 5 votes vote down vote up
public SidesPanel() {
    super();

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    setLayout(gridbag);
    setBorder(BorderFactory.createTitledBorder(strTitle));

    c.fill = GridBagConstraints.BOTH;
    c.insets = compInsets;
    c.weighty = 1.0;
    c.gridwidth = GridBagConstraints.REMAINDER;

    ButtonGroup bg = new ButtonGroup();
    rbOneSide = new IconRadioButton("radiobutton.oneside",
                                    "oneside.png", true,
                                    bg, this);
    rbOneSide.addActionListener(this);
    addToGB(rbOneSide, this, gridbag, c);
    rbTumble = new IconRadioButton("radiobutton.tumble",
                                   "tumble.png", false,
                                   bg, this);
    rbTumble.addActionListener(this);
    addToGB(rbTumble, this, gridbag, c);
    rbDuplex = new IconRadioButton("radiobutton.duplex",
                                   "duplex.png", false,
                                   bg, this);
    rbDuplex.addActionListener(this);
    c.gridwidth = GridBagConstraints.REMAINDER;
    addToGB(rbDuplex, this, gridbag, c);
}
 
Example 33
Project: Proj4   File: JSpaceSettlersInfoPanel.java   Source Code and License 5 votes vote down vote up
public JSpaceSettlersInfoPanel(SpaceSettlersSimulator simulator) {
	super();

       //setPreferredSize(new Dimension(100, 800));
	
	constraints = new GridBagConstraints();
	//constraints.fill = GridBagConstraints.BOTH;
	constraints.insets = new Insets(10, 10, 10, 10);
	setLayout(new GridBagLayout());

	constraints.gridx = 0;
	constraints.gridy = 0;
	globalInfo = new GlobalInfoPanel();
	add(globalInfo, constraints);
       teamComponents = new HashMap<String, TeamInfoPanel>();
       
	// populate the team hash map the first time it is called with a valid simulator object
	int teamNum = 1;
       for (Team team : simulator.getTeams()) {
       	TeamInfoPanel tInfo = new TeamInfoPanel(team);
       	teamComponents.put(team.getTeamName(), tInfo);
   		constraints.gridx = 0;
   		constraints.gridy = teamNum;
           constraints.gridwidth = GridBagConstraints.REMAINDER;
           add(tInfo, constraints);
           teamNum++;
       }
       
       objectPanel = new ObjectInfoPanel();
	constraints.gridx = 0;
	constraints.gridy = simulator.getTeams().size() + 1;
       constraints.gridwidth = GridBagConstraints.REMAINDER;
       add(objectPanel, constraints);
}
 
Example 34
Project: Pixie   File: GUILabelingTool.java   Source Code and License 5 votes vote down vote up
/**
 * Adds a label which is not needed for active purposes. It just aligns
 * north all the other components.
 */
private void addButtonsAlignComponent() {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 100;        // put the label as low as possible
    gbc.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gbc.weighty = 0.5;
    jPObjList.add(jLAlignNorth, gbc);
}
 
Example 35
Project: incubator-netbeans   File: RSSFeed.java   Source Code and License 5 votes vote down vote up
private JComponent buildProxyPanel() {
    Component header = getContentHeader();
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque( false );

    int row = 0;
    if( null != header ) {
        panel.add( header,  new GridBagConstraints(0,row++,1,1,1.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
    }

    panel.add( new JLabel(BundleSupport.getLabel("ErrCannotConnect")),  // NOI18N
            new GridBagConstraints(0,row++,1,1,0.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    if( showProxyButton ) {
        JButton button = new JButton();
        Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "ProxyConfig" ) );  // NOI18N
        button.setOpaque( false );
        button.addActionListener( new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                HttpProxySettings.getDefault().showConfigurationDialog();
            }
        });
        panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    }
    return panel;
}
 
Example 36
Project: SuperMarketManageSystem   File: XiaoShouTuiHuoChaXun.java   Source Code and License 5 votes vote down vote up
private void setupComponet(JComponent component, int gridx, int gridy,
		int gridwidth, int ipadx, boolean fill) {
	final GridBagConstraints gridBagConstrains = new GridBagConstraints();
	gridBagConstrains.gridx = gridx;
	gridBagConstrains.gridy = gridy;
	if (gridwidth > 1)
		gridBagConstrains.gridwidth = gridwidth;
	if (ipadx > 0)
		gridBagConstrains.ipadx = ipadx;
	gridBagConstrains.insets = new Insets(5, 1, 3, 1);
	if (fill)
		gridBagConstrains.fill = GridBagConstraints.HORIZONTAL;
	getContentPane().add(component, gridBagConstrains);
}
 
Example 37
Project: incubator-netbeans   File: SortPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Creates new form SortPanel
 */
public SortPanel() {
    listener = new SortingChangeListener();
    initComponents();
    initCombos();
    pnlAttributes.add(new JLabel(), new GridBagConstraints(0, NUMBER_OF_COMBOS, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 3, 0), 0, 0));
}
 
Example 38
Project: rapidminer   File: PerspectivesPanelBar.java   Source Code and License 5 votes vote down vote up
private PerspectivesPanelBar(Perspectives perspectives) {
	setLayout(new GridBagLayout());
	setOpaque(false);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.insets = new Insets(1, 10, 2, 0);

	JToolBar workspaceToolBar = perspectives.getWorkspaceToolBar();
	workspaceToolBar.setBackground(getBackgroundColor());
	add(workspaceToolBar, gbc);
}
 
Example 39
Project: Equella   File: WhereTargetChooser.java   Source Code and License 5 votes vote down vote up
protected void createGUI()
{
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();

	setLayout(gridbag);
	setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

	target = new JTextField();
	target.setEditable(false);
	target.setMinimumSize(new Dimension(150, 20));
	target.setPreferredSize(new Dimension(150, 20));
	target.setMaximumSize(new Dimension(150, 20));
	c.gridx = 0;
	c.weightx = 1;
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	gridbag.setConstraints(target, c);
	add(target);

	search = new JButton("...");
	search.setFont(new Font("Sans Serif", Font.PLAIN, 8));
	search.addActionListener(this);
	search.setMinimumSize(new Dimension(18, 20));
	search.setPreferredSize(new Dimension(18, 20));
	search.setMaximumSize(new Dimension(18, 20));

	c.gridx = 1;
	c.weightx = 0;
	gridbag.setConstraints(search, c);
	add(search);
}
 
Example 40
Project: s-store   File: AbstractViewer.java   Source Code and License 5 votes vote down vote up
public static GridBagConstraints getConstraints() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.ipadx = 150;
    c.ipady = 2;
    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.NONE;
    c.insets = insets;
    c.anchor = GridBagConstraints.LINE_START;
    return (c);
}