Java Code Examples for java.awt.BorderLayout#setHgap()

The following examples show how to use java.awt.BorderLayout#setHgap() . 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 check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   File: SelectorUtils.java    License: Apache License 2.0 6 votes vote down vote up
/** Constructs panel. */
public ObjectNameInputPanel () {
  BorderLayout layout = new BorderLayout();
  layout.setVgap(5);
  layout.setHgap(5);
  setLayout(layout);
        
  // label and text field with mnemonic
  String labelText = I18nUtil.getBundle().getString ("LBL_TemplateName");
  JLabel label = new JLabel();
  Mnemonics.setLocalizedText(label, labelText);
  text = new JTextField();
  text.getAccessibleContext().setAccessibleDescription(I18nUtil.getBundle().getString ("ACS_TEXT_ObjectNameInputPanel"));
        
  label.setLabelFor(text);
        
  add(BorderLayout.WEST, label);
  add(BorderLayout.CENTER, text);
}
 
Example 2
/**
 * Creates a new instance of PreferencesDialog
 */
public InfoDialog(JFrame owner) {
    super(owner, "About TDA", true);  
    BorderLayout layout = new BorderLayout();
    layout.setHgap(30);
    getContentPane().setLayout(layout);
    initPanel();        
}
 
Example 3
Source Project: jdal   File: TablePanel.java    License: Apache License 2.0 5 votes vote down vote up
/** 
 * Creates new TablePanel
 */
public TablePanel() {
	BorderLayout layout = new BorderLayout();
	layout.setVgap(10);
	layout.setHgap(10);
	setLayout(layout);
}
 
Example 4
/**
 * Creates a new {@code AudioMixerOptionUI} for the given
 * {@code AudioMixerOption}.
 *
 * @param gui The GUI.
 * @param option The {@code AudioMixerOption} to make a user
 *      interface for.
 * @param editable boolean whether user can modify the setting
 */
public AudioMixerOptionUI(GUI gui, final AudioMixerOption option,
                          boolean editable) {
    super(option, editable);

    this.gui = gui;

    BorderLayout layout = new BorderLayout();
    layout.setHgap(15);
    panel.setLayout(layout);

    cbox = new JComboBox<>();
    panel.add(cbox, BorderLayout.LINE_START);

    currentMixerLabel = new JLabel();
    panel.add(currentMixerLabel, BorderLayout.LINE_END);
    updateMixerLabel();

    button1 = Utility.localizedButton("test");
    panel.add(button1);

    button2 = Utility.localizedButton("music");
    panel.add(button2);

    cbox.add(super.getJLabel());
    cbox.setModel(new DefaultComboBoxModel<>(getOption().getChoices()
            .toArray(new MixerWrapper[0])));
    reset();
    cbox.setEnabled(editable);

    ActionListener aHandler = (ActionEvent ae) -> {
        if (ae.getSource() == button1) {
            gui.playSound("sound.event.buildingComplete");
        } else if (ae.getSource() == button2) {
            gui.playSound("sound.intro.general");
        } else if (ae.getSource() == cbox) {
            MixerWrapper value = (MixerWrapper) cbox.getSelectedItem();
            if (getOption().getValue() != value) {
                getOption().setValue(value);
                updateMixerLabel();
            }
        }
    };
    button1.addActionListener(aHandler);
    button2.addActionListener(aHandler);
    cbox.addActionListener(aHandler);

    initialize();
}
 
Example 5
private void initPanel() {
    BorderLayout upperLayout = new BorderLayout();
    upperLayout.setVgap(10);
    upperLayout.setHgap(10);
    JPanel upperPane = new JPanel(upperLayout);
    upperPane.add(new JLabel(TDA.createImageIcon("tda-logo.png")), BorderLayout.CENTER);
    upperPane.add(new JLabel(" "), BorderLayout.EAST);
    upperPane.add(new JLabel(" "), BorderLayout.WEST);
    upperPane.add(new JLabel(""), BorderLayout.NORTH);
    upperPane.add(new JLabel(""), BorderLayout.SOUTH);
    getContentPane().add(upperPane, BorderLayout.NORTH);
    
    String info = "<html><body>" +
            "<p><i>Java Version: " + System.getProperty("java.version") + "<br><br>" +
            "(C) 2006-2016 by Ingo Rockel &lt;[email protected]&gt;,<br>" +
            "with contributions from Robert Whitehurst &lt;[email protected]&gt;.<br><br>" +
            "Icons used are based on Benno System Icons by Benno Meyer.<br>" +
            "Welcome screen uses icons from NuoveXT2 icon set by Alexandre Moore.<br>" +
            "Contains classes from JEdit for logfile display.</i></p><br>" +
            "<p>TDA is free software; you can redistribute it and/or modify it under<br>" +
            "the terms of the Lesser GNU General Public License as published by<br>" +
            "the Free Software Foundation; either version 2.1 of the License, or<br>" +
            "(at your option) any later version.</p><br>" +
            "TDA is distributed in the hope that it will be useful, but WITHOUT ANY<br>" +
            "WARRANTY; without even the implied warranty of MERCHANTABILITY or <br>" +
            "FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public<br>" +
            "License for more details.<p><br>";
    
    getContentPane().add(new JLabel(info), BorderLayout.CENTER);
    getContentPane().add(new JLabel(""), BorderLayout.EAST);
    getContentPane().add(new JLabel(""), BorderLayout.WEST);
    JButton okButton = new JButton("Close");
    okButton.addActionListener( new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(okButton);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);        
}
 
Example 6
@Override
public void initialize() {

    Font buttonFont = viewSource.getFont();
    viewSource.setFont(buttonFont.deriveFont(buttonFont.getSize() / 2));
    viewSource.setPreferredSize(new Dimension(150, 15));
    viewSource.setEnabled(false);

    topLeftSPane = frame.mainFrameTree.bugListPanel();

    JPanel sourceTitlePanel = new JPanel();
    sourceTitlePanel.setLayout(new BorderLayout());

    JPanel sourcePanel = new JPanel();
    BorderLayout sourcePanelLayout = new BorderLayout();
    sourcePanelLayout.setHgap(3);
    sourcePanelLayout.setVgap(3);
    sourcePanel.setLayout(sourcePanelLayout);
    sourceTitle = new JLabel();
    sourceTitle.setText(L10N.getLocalString("txt.source_listing", ""));

    sourceTitlePanel.setBorder(new EmptyBorder(3, 3, 3, 3));
    sourceTitlePanel.add(viewSource, BorderLayout.EAST);
    sourceTitlePanel.add(sourceTitle, BorderLayout.CENTER);

    sourcePanel.setBorder(new LineBorder(Color.GRAY));
    sourcePanel.add(sourceTitlePanel, BorderLayout.NORTH);
    sourcePanel.add(frame.createSourceCodePanel(), BorderLayout.CENTER);
    sourcePanel.add(frame.createSourceSearchPanel(), BorderLayout.SOUTH);
    topSPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, topLeftSPane, sourcePanel);
    topSPane.setOneTouchExpandable(true);
    topSPane.setContinuousLayout(true);
    topSPane.setDividerLocation(GUISaveState.getInstance().getSplitTop());
    removeSplitPaneBorders(topSPane);

    summarySPane = frame.summaryTab();
    mainSPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topSPane, summarySPane);
    mainSPane.setOneTouchExpandable(true);
    mainSPane.setContinuousLayout(true);
    mainSPane.setDividerLocation(GUISaveState.getInstance().getSplitMain());
    removeSplitPaneBorders(mainSPane);

    frame.setLayout(new BorderLayout());
    frame.add(mainSPane, BorderLayout.CENTER);
    frame.add(frame.statusBar(), BorderLayout.SOUTH);

}
 
Example 7
JTextAreaOptionPane(
    final JFrame parentComponent,
    final String initialEditorText,
    final String labelText,
    final String title,
    final Image icon,
    final int editorSizeX,
    final int editorSizeY,
    final int latchCount,
    final CountDownLatch countDownLatch) {
  counter = latchCount;
  this.parentComponent = parentComponent;
  windowFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  if (icon != null) {
    windowFrame.setIconImage(icon);
  } else if (parentComponent != null && parentComponent.getIconImage() != null) {
    windowFrame.setIconImage(parentComponent.getIconImage());
  }
  final BorderLayout layout = new BorderLayout();
  layout.setHgap(30);
  layout.setVgap(30);
  windowFrame.setLayout(layout);
  windowFrame.setTitle(title);
  final JLabel label = new JLabel();
  label.setText(labelText);
  okButton.setText("OK");
  okButton.setEnabled(false);
  editor.setEditable(false);
  editor.setText(initialEditorText);
  log.info(initialEditorText);
  editor.setCaretPosition(0);

  windowFrame.setPreferredSize(new Dimension(editorSizeX, editorSizeY));
  windowFrame.getContentPane().add(label, BorderLayout.NORTH);
  windowFrame.getContentPane().add(new JScrollPane(editor), BorderLayout.CENTER);
  windowFrame.getContentPane().add(okButton, BorderLayout.SOUTH);

  okButton.addActionListener(
      e -> {
        if (countDownLatch != null) {
          countDownLatch.countDown();
        }
        dispose();
      });
}