Java Code Examples for java.awt.GridBagConstraints

The following examples show how to use java.awt.GridBagConstraints. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: ramus   Source File: HTMLEditOptionPanel.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method initializes this
 *
 * @return void
 */
private void initialize() {
    final GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
    gridBagConstraints3.gridx = 3;
    gridBagConstraints3.gridy = 0;
    final GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
    gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints2.gridy = 0;
    gridBagConstraints2.weightx = 1.0;
    gridBagConstraints2.gridx = 2;
    final GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
    gridBagConstraints1.gridx = 1;
    gridBagConstraints1.gridy = 0;
    final GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    jLabel = new JLabel();
    jLabel.setText(GlobalResourcesManager.getString("HTMLEditor.Programm"));
    this.setSize(300, 200);
    setLayout(new GridBagLayout());
    this.add(jLabel, gridBagConstraints);
    this.add(getJPanel(), gridBagConstraints1);
    this.add(getJTextField(), gridBagConstraints2);
    this.add(getJButton(), gridBagConstraints3);
}
 
Example 2
Source Project: DominionSim   Source File: DomBotSelector.java    License: MIT License 6 votes vote down vote up
private JPanel getSelectionPanel() {
    final JPanel thePanel = new JPanel();
    thePanel.setLayout( new GridBagLayout() );
    final GridBagConstraints theCons = DomGui.getGridBagConstraints( 2 );
    JScrollPane theTypePane = new JScrollPane(getBotTypeList(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    theTypePane.setBorder(new TitledBorder( "Type" ));
    theCons.weightx = 0.0;
    theCons.weighty = 1.0;
    thePanel.add(theTypePane, theCons);

    theCons.weightx = 1.0;
    theCons.gridx++;
    thePanel.add(getBotPanel(), theCons);

    return thePanel;
}
 
Example 3
Source Project: javamoney-examples   Source File: DataElementPanel.java    License: Apache License 2.0 6 votes vote down vote up
private
Panel
createNewPanel(ActionListener listener)
{
  Panel panel = new Panel();
  String key = getCollection().getType().toString().toLowerCase();
  Link link = new Link(getProperty("default") + " " + key, listener, ACTION_ADD);

  // Build link.
  link.setBackground(GUIConstants.COLOR_BACKGROUND_FILL);

  // Build panel.
  panel.setAnchor(GridBagConstraints.NORTHWEST);
  panel.add(link, 0, 0, 1, 1, 100, 100);

  panel.setBackground(GUIConstants.COLOR_BACKGROUND_FILL);
  panel.setBorder(createTitledBorder(""));

  return panel;
}
 
Example 4
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 5
private void anhadeTextAreaParaTextoAnalizado(Container contenedor) {
	areaDeTextoAAnalizar = new JTextArea();
       areaDeTextoAAnalizar.setLineWrap(true);
       areaDeTextoAAnalizar.setWrapStyleWord(true);
       areaDeTextoAAnalizar.setColumns(40);
       areaDeTextoAAnalizar.invalidate();

       JScrollPane scroll = new JScrollPane(areaDeTextoAAnalizar);
       scroll.setBorder(new TitledBorder("Escribe o copia aqu� un texto"));

       GridBagConstraints constraints = new GridBagConstraints();
       constraints.gridx = 0;
       constraints.gridy = 1;
       constraints.gridwidth = 4;
       constraints.gridheight = 1;
       constraints.weightx = 1.0;
       constraints.weighty = 1.0;
       constraints.fill = GridBagConstraints.BOTH;
       contenedor.add(scroll, constraints);
}
 
Example 6
Source Project: MtgDesktopCompanion   Source File: UITools.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static GridBagConstraints createGridBagConstraints(Integer anchor,Integer fill,int col,int line)
{
	GridBagConstraints cons = new GridBagConstraints();
	
	if(anchor!=null)
		cons.anchor = anchor;
	
	if(fill!=null)
		cons.fill = fill;
	
	cons.insets = new Insets(0, 0, 5, 5);
	cons.gridx = col;
	cons.gridy = line;
	
	return cons;
}
 
Example 7
private void addUseCustomQTCheckBox(JPanel panel, int col, int row)
{
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = col;
	c.gridy = row;
	c.insets = new Insets(5, 5, 0, 0);
	c.anchor = GridBagConstraints.WEST;
	c.gridwidth = 2; // Span across two columns
	useCustomQTCheckBox = new JCheckBox(i18n.USE_CUSTOM_QT_LABEL);
	useCustomQTCheckBox.setName("useCustomQTCheckBox");

	// i18n[PreferencesPanel.useCustomQTToolTip=Gives enhanced capabilities
	// over the default query tokenizer for handling {0} scripts]
	String USE_CUSTOM_QT_TOOLTIP =
		s_stringMgr.getString("PreferencesPanel.useCustomQTToolTip", _databaseName);

	useCustomQTCheckBox.setToolTipText(USE_CUSTOM_QT_TOOLTIP);
	useCustomQTCheckBox.addActionListener(new UseQTHandler());
	panel.add(useCustomQTCheckBox, c);
}
 
Example 8
private
Panel
createFilterPanel()
{
  Panel panel = new Panel();

  // Build panel.
  panel.setFill(GridBagConstraints.BOTH);
  panel.add(createChooserPanel(getChoosers()[ACCOUNTS], ACTION_ACCOUNTS), 0, 0, 1, 1, 50, 100);
  panel.addEmptyCellAt(1, 0);
  panel.add(createChooserPanel(getChoosers()[CATEGORIES], ACTION_CATEGORIES), 2, 0, 1, 1, 50, 0);
  panel.addEmptyCellAt(3, 0);
  panel.add(createChooserPanel(getChoosers()[PAYEES], ACTION_PAYEES), 4, 0, 1, 1, 50, 0);

  panel.setInsets(new Insets(10, 10, 10, 10));

  return panel;
}
 
Example 9
Source Project: collect-earth   Source File: PropertiesDialog.java    License: MIT License 6 votes vote down vote up
private JPanel getSqlLitePanel() {
	final JPanel panel = new JPanel(new GridBagLayout());
	final GridBagConstraints constraints = new GridBagConstraints();
	constraints.gridx = 0;
	constraints.gridy = 0;
	constraints.anchor = GridBagConstraints.LINE_START;
	constraints.insets = new Insets(5, 5, 5, 5);
	constraints.weightx = 1.0;
	constraints.fill = GridBagConstraints.HORIZONTAL;

	final Border border = new TitledBorder(new BevelBorder(BevelBorder.RAISED),
			Messages.getString("OptionWizard.30")); //$NON-NLS-1$
	panel.setBorder(border);

	panel.add(propertyToComponent.get(EarthProperty.AUTOMATIC_BACKUP)[0], constraints);
	constraints.gridx++;
	panel.add(getOpenBackupFolderButton());
	return panel;
}
 
Example 10
Source Project: zap-extensions   Source File: CustomPayloadsOptionsPanel.java    License: Apache License 2.0 6 votes vote down vote up
public CustomPayloadsOptionsPanel() {
    this.tableModel = new CustomPayloadMultipleOptionsTableModel();
    this.tablePanel = new CustomPayloadsMultipleOptionsTablePanel(tableModel);
    this.setName(OPTIONS_TITLE);
    this.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.LINE_START;
    gbc.fill = GridBagConstraints.BOTH;

    this.add(new JLabel(OPTIONS_TITLE), gbc);
    gbc.weighty = 1.0;
    this.add(tablePanel, gbc);
}
 
Example 11
Source Project: lucene-solr   Source File: DocumentsPanelProvider.java    License: Apache License 2.0 6 votes vote down vote up
private JPanel initUpperPanel() {
  JPanel panel = new JPanel(new GridBagLayout());
  panel.setOpaque(false);
  GridBagConstraints c = new GridBagConstraints();

  c.gridx = 0;
  c.gridy = 0;
  c.weightx = 0.5;
  c.anchor = GridBagConstraints.FIRST_LINE_START;
  c.fill = GridBagConstraints.HORIZONTAL;
  panel.add(initBrowseTermsPanel(), c);

  c.gridx = 1;
  c.gridy = 0;
  c.weightx = 0.5;
  c.anchor = GridBagConstraints.FIRST_LINE_START;
  c.fill = GridBagConstraints.HORIZONTAL;
  panel.add(initBrowseDocsByTermPanel(), c);

  return panel;
}
 
Example 12
Source Project: visualvm   Source File: SectionSeparator.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void initComponents(String text, Font font) {
    setBorder(BorderFactory.createEmptyBorder());
    setLayout(new GridBagLayout());
    setOpaque(false);

    label = new JLabel(text);
    label.setForeground(getForeground());
    if (font != null) label.setFont(font);
    else label.setFont(label.getFont().deriveFont(Font.BOLD));
    GridBagConstraints c1 = new GridBagConstraints();
    c1.weighty = 1d;
    add(label, c1);

    GridBagConstraints c2 = new GridBagConstraints();
    c2.weightx = 1d;
    c2.fill = GridBagConstraints.HORIZONTAL;
    c2.insets = new Insets(0, 4, 0, 0);
    add(new Separator(), c2);
}
 
Example 13
Source Project: jdk8u-dev-jdk   Source File: Font2DTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void addLabeledComponentToGBL( String name,
                                       JComponent c,
                                       GridBagLayout gbl,
                                       GridBagConstraints gbc,
                                       Container target ) {
    LabelV2 l = new LabelV2( name );
    GridBagConstraints gbcLabel = (GridBagConstraints) gbc.clone();
    gbcLabel.insets = new Insets( 2, 2, 2, 0 );
    gbcLabel.gridwidth = 1;
    gbcLabel.weightx = 0;

    if ( c == null )
      c = new JLabel( "" );

    gbl.setConstraints( l, gbcLabel );
    target.add( l );
    gbl.setConstraints( c, gbc );
    target.add( c );
}
 
Example 14
Source Project: netbeans   Source File: DetectPanel.java    License: Apache License 2.0 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 15
Source Project: javamoney-examples   Source File: ViewsPanel.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new views panel.
 */
public
ViewsPanel()
{
  setCardPanel(new JPanel(new CardLayout()));
  setView(null);
  setViewChooser(new ViewChooser());

  createViews();

  // Put the views into the cards.
  for(ViewKeys key : ViewKeys.values())
  {
    getCardPanel().add(getView(key), key.toString());
  }

  // Build panel.
  setFill(GridBagConstraints.BOTH);
  add(getViewChooser(), 0, 0, 1, 1, 100, 0);
  add(getCardPanel(), 0, 1, 1, 1, 0, 100);

  setInsets(new Insets(0, 10, 10, 10));
}
 
Example 16
Source Project: netbeans   Source File: XmlOptionPanelManager.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected int initAdditionalSyntaxButton( int gridy, 
        final TargetChooserPanel<FileType> panel,
        final TargetChooserPanelGUI<FileType> uiPanel) 
{
    myXmlSyntaxButton.setMnemonic(NbBundle.getMessage(XmlOptionPanelManager.class, 
            "A11Y_JspXml_mnem").charAt(0));
    getButtonGroup().add(myXmlSyntaxButton);
    myXmlSyntaxButton.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            checkBoxChanged(evt, panel, uiPanel);
        }
    });

    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = gridy++;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    getOptionPanel().add(myXmlSyntaxButton, gridBagConstraints);
    return gridy;
}
 
Example 17
private JPanel createInfoPanel() {
    final JPanel infoPanel = GridBagUtils.createDefaultEmptyBorderPanel();
    infoPanel.setBorder(UIUtils.createGroupBorder("Output Product Information"));
    final GridBagConstraints gbc2 = GridBagUtils.createDefaultConstraints();
    GridBagUtils.addToPanel(infoPanel, new JLabel("Scene Width:"), gbc2);
    GridBagUtils.addToPanel(infoPanel, labelWidthInfo, gbc2);
    GridBagUtils.addToPanel(infoPanel, new JLabel("pixel"), gbc2, "weightx=1");
    GridBagUtils.addToPanel(infoPanel, new JLabel("Scene Height:"), gbc2, "gridy=1, weightx=0");
    GridBagUtils.addToPanel(infoPanel, labelHeightInfo, gbc2);
    GridBagUtils.addToPanel(infoPanel, new JLabel("pixel"), gbc2, "weightx=1");
    GridBagUtils.addToPanel(infoPanel, new JLabel("Center Latitude:"), gbc2, "gridy=2, weightx=0");
    GridBagUtils.addToPanel(infoPanel, labelCenterLatInfo, gbc2, "weightx=1, gridwidth=2");
    GridBagUtils.addToPanel(infoPanel, new JLabel("Center Longitude:"), gbc2, "gridy=3, weightx=0, gridwidth=1");
    GridBagUtils.addToPanel(infoPanel, labelCenterLonInfo, gbc2, "weightx=1, gridwidth=2");
    return infoPanel;
}
 
Example 18
Source Project: raccoon4   Source File: LoginLogic.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected JPanel assemble() {
	progress = new JProgressBar();
	status = new HyperTextPane("                             ")
			.withTransparency().withWidth(400);

	JPanel ret = new JPanel();
	ret.setLayout(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();
	gbc.anchor = GridBagConstraints.CENTER;
	gbc.fill = GridBagConstraints.NONE;
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.insets.top = 20;
	ret.add(progress, gbc);
	gbc.weighty = 1;
	gbc.gridy++;
	gbc.fill = GridBagConstraints.BOTH;
	ret.add(status, gbc);
	return ret;
}
 
Example 19
Source Project: snap-desktop   Source File: GridBagUtils.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds a component to a panel with a grid bag layout.
 *
 * @param panel the panel to which to add the component
 * @param comp  the component to be added
 * @param gbc   the grid bag constraints to be used, can be <code>null</code> if <code>code</code> is not
 *              <code>null</code>
 */
public static void addToPanel(JPanel panel, Component comp, GridBagConstraints gbc) {
    LayoutManager layoutManager = panel.getLayout();
    if (!(layoutManager instanceof GridBagLayout)) {
        throw new IllegalArgumentException("'panel' does not have a GridBagLayout manager");
    }
    GridBagLayout gbl = (GridBagLayout) layoutManager;
    gbl.setConstraints(comp, gbc);
    panel.add(comp);
}
 
Example 20
Source Project: hottub   Source File: ServiceDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
public OrientationPanel() {
    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();
    rbPortrait = new IconRadioButton("radiobutton.portrait",
                                     "orientPortrait.png", true,
                                     bg, this);
    rbPortrait.addActionListener(this);
    addToGB(rbPortrait, this, gridbag, c);
    rbLandscape = new IconRadioButton("radiobutton.landscape",
                                      "orientLandscape.png", false,
                                      bg, this);
    rbLandscape.addActionListener(this);
    addToGB(rbLandscape, this, gridbag, c);
    rbRevPortrait = new IconRadioButton("radiobutton.revportrait",
                                        "orientRevPortrait.png", false,
                                        bg, this);
    rbRevPortrait.addActionListener(this);
    addToGB(rbRevPortrait, this, gridbag, c);
    rbRevLandscape = new IconRadioButton("radiobutton.revlandscape",
                                         "orientRevLandscape.png", false,
                                         bg, this);
    rbRevLandscape.addActionListener(this);
    addToGB(rbRevLandscape, this, gridbag, c);
}
 
Example 21
Source Project: arcusplatform   Source File: ChangePinDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected JPanel createContents() {
   submit.addActionListener((e) -> this.submit());
   Oculus.invokeOnEnter(newPin.getComponent(), () -> this.submit());

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

   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridy = 0;
   gbc.gridx = 0;
   gbc.weightx = 0;
   gbc.fill = GridBagConstraints.NONE;
   panel.add(newPin.getLabel(), gbc.clone());

   gbc.gridx = 1;
   gbc.weightx = 1.0;
   gbc.fill = GridBagConstraints.HORIZONTAL;
   panel.add(newPin.getComponent(), gbc.clone());

   gbc.gridy++;

   gbc.anchor = GridBagConstraints.NORTHEAST;
   gbc.weighty = 1.0;
   gbc.gridx = 1;
   gbc.fill = GridBagConstraints.NONE;

   panel.add(submit, gbc.clone());

   return panel;
}
 
Example 22
Source Project: openjdk-8-source   Source File: PolicyTool.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * displays a dialog box describing an error which occurred.
 */
void displayErrorDialog(Window w, String error) {
    ToolDialog ed = new ToolDialog
            (PolicyTool.getMessage("Error"), tool, this, true);

    // find where the PolicyTool gui is
    Point location = ((w == null) ?
            getLocationOnScreen() : w.getLocationOnScreen());
    //ed.setBounds(location.x + 50, location.y + 50, 600, 100);
    ed.setLayout(new GridBagLayout());

    JLabel label = new JLabel(error);
    addNewComponent(ed, label, 0,
                    0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);

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

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

    ed.pack();
    ed.setLocationRelativeTo(w);
    ed.setVisible(true);
}
 
Example 23
Source Project: openjdk-jdk9   Source File: ServiceDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
public PageSetupPanel() {
    super();

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

    setLayout(gridbag);

    c.fill = GridBagConstraints.BOTH;
    c.insets = panelInsets;
    c.weightx = 1.0;
    c.weighty = 1.0;

    c.gridwidth = GridBagConstraints.REMAINDER;
    pnlMedia = new MediaPanel();
    addToGB(pnlMedia, this, gridbag, c);

    pnlOrientation = new OrientationPanel();
    c.gridwidth = GridBagConstraints.RELATIVE;
    addToGB(pnlOrientation, this, gridbag, c);

    pnlMargins = new MarginsPanel();
    pnlOrientation.addOrientationListener(pnlMargins);
    pnlMedia.addMediaListener(pnlMargins);
    c.gridwidth = GridBagConstraints.REMAINDER;
    addToGB(pnlMargins, this, gridbag, c);
}
 
Example 24
Source Project: jdk8u-jdk   Source File: ServiceDialog.java    License: GNU General Public License v2.0 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 25
private void initialize()
{
  this.setPreferredSize(new Dimension(400, 50));
  this.setLayout(new GridBagLayout());
  GridBagConstraints c = new GridBagConstraints();
  c.fill = GridBagConstraints.HORIZONTAL;
  urlLabel = new JLabel("URL");
  c.weightx = 0.5;
  c.fill = GridBagConstraints.HORIZONTAL;
  c.gridx = 0;
  c.gridy = 0;
  this.add(urlLabel, c);
  urlTextField = new JTextField();
  c.fill = GridBagConstraints.HORIZONTAL;
  c.weightx = 0.5;
  c.gridwidth = 3;
  c.gridx = 1;
  c.gridy = 0;
  this.add(urlTextField, c);
  lock = new JButton("Lock");
  lock.addActionListener(controller);
  c.fill = GridBagConstraints.HORIZONTAL;
  c.weightx = 0.5;
  c.gridwidth = 1;
  c.gridx = 2;
  c.gridy = 1;
  this.add(lock, c);
  check = new JButton("Check");
  check.addActionListener(controller);
  c.fill = GridBagConstraints.HORIZONTAL;
  c.weightx = 0.5;
  c.gridwidth = 1;
  c.gridx = 3;
  c.gridy = 1;
  this.add(check, c);
}
 
Example 26
Source Project: Spark   Source File: HistoryWindow.java    License: Apache License 2.0 5 votes vote down vote up
private void initLayout() {
	GridBagLayout layout = new GridBagLayout();
	setLayout(layout);

	GridBagConstraints c = new GridBagConstraints();

	c.anchor = GridBagConstraints.FIRST_LINE_START;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 0;
	c.gridy = 0;
	c.insets = new Insets(13, 13, 0, 13);
	add(getLabel(), c);

	c.anchor = GridBagConstraints.NORTHWEST;
	c.fill = GridBagConstraints.BOTH;
	c.gridx = 0;
	c.gridy = 1;
	c.weightx = 1;
	c.weighty = 1;
	add(getHistoryContentPanel(), c);

	c.anchor = GridBagConstraints.WEST;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 0;
	c.gridy = 2;
	c.weighty = 0;
	c.insets = new Insets(5, 13, 0, 13);

	add(getSizePanel(), c);

	c.anchor = GridBagConstraints.LAST_LINE_END;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 0;
	c.gridy = 3;
	c.insets = new Insets(0, 13, 5, 10);
	add(getButtonsPanel(), c);
}
 
Example 27
Source Project: jdk8u-dev-jdk   Source File: ServiceDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
public MediaPanel() {
    super();

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

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

    cbSize = new JComboBox();
    cbSource = new JComboBox();

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

    c.weightx = 0.0;
    lblSize = new JLabel(getMsg("label.size"), JLabel.TRAILING);
    lblSize.setDisplayedMnemonic(getMnemonic("label.size"));
    lblSize.setLabelFor(cbSize);
    addToGB(lblSize, this, gridbag, c);
    c.weightx = 1.0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    addToGB(cbSize, this, gridbag, c);

    c.weightx = 0.0;
    c.gridwidth = 1;
    lblSource = new JLabel(getMsg("label.source"), JLabel.TRAILING);
    lblSource.setDisplayedMnemonic(getMnemonic("label.source"));
    lblSource.setLabelFor(cbSource);
    addToGB(lblSource, this, gridbag, c);
    c.gridwidth = GridBagConstraints.REMAINDER;
    addToGB(cbSource, this, gridbag, c);
}
 
Example 28
public ANOVAMatrixViewer(ANOVAMatrix matrix) {
	super(new BorderLayout());

	JPanel panel = new JPanel(new GridBagLayout());
	panel.setOpaque(true);
	panel.setBackground(Colors.WHITE);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1.0;
	gbc.weighty = 1.0;
	gbc.fill = GridBagConstraints.BOTH;
	gbc.insets = new Insets(42, 10, 20, 10);

	// table
	ANOVAMatrixViewerTable table = new ANOVAMatrixViewerTable(matrix);
	table.getTableHeader().putClientProperty(RapidLookTools.PROPERTY_TABLE_HEADER_BACKGROUND, Colors.WHITE);
	((TableHeaderUI) table.getTableHeader().getUI()).installDefaults();
	table.setRowHighlighting(true);
	table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);

	JScrollPane scrollPane = new ExtendedJScrollPane(table);
	scrollPane.setBorder(null);
	scrollPane.setBackground(Colors.WHITE);
	scrollPane.getViewport().setBackground(Colors.WHITE);
	panel.add(scrollPane, gbc);

	// info string
	JLabel infoText = new JLabel();
	infoText.setText("A colored background indicates that the probability for non-difference between the groups is less than "
			+ Tools.formatNumber(matrix.getSignificanceLevel()));
	gbc.gridy += 1;
	gbc.insets = new Insets(5, 10, 5, 10);
	gbc.weighty = 0.0;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	panel.add(infoText, gbc);

	add(panel, BorderLayout.CENTER);
}
 
Example 29
Source Project: ignite   Source File: AboutDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @return Grid bag constraints.
 */
private GridBagConstraints gbcSeparator() {
    gbc.gridx = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;

    gbc.insets = new Insets(5, 10, 10, 10);

    return gbc;
}
 
Example 30
Source Project: arcusplatform   Source File: Wizard.java    License: Apache License 2.0 5 votes vote down vote up
protected Wizard(WizardStep<I, ?> first, WizardStep<?, O> last) {
   this.first = first;
   this.current = first;
   this.last = last;

   GridBagConstraints gbc = new GridBagConstraints();
   
   gbc.gridx = 0;
   gbc.gridy = 0;
   gbc.fill = GridBagConstraints.BOTH;
   gbc.weightx = 1.0;
   gbc.weighty = 1.0;
   contents.add(new JLabel(), gbc.clone());
   
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.weightx = 1.0;
   gbc.weighty = 0.0;
   gbc.gridy++;
   contents.add(new JSeparator(JSeparator.HORIZONTAL), gbc.clone());
   
   JPanel buttons = new JPanel();
   buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
   buttons.add(back);
   buttons.add(Box.createHorizontalGlue());
   buttons.add(next);
   
   gbc.gridy++;
   contents.add(buttons, gbc.clone());
}