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

The following are Jave code examples for showing how to use setHgap() of the java.awt.BorderLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: SelectorUtils.java   View Source Code Vote up 6 votes
/** 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
Project: AgentWorkbench   File: OntologyTab.java   View Source Code Vote up 5 votes
/**
 * This method initializes this
 * @return void
 */
private void initialize() {
	
	BorderLayout borderLayout = new BorderLayout();
	borderLayout.setHgap(50);
	borderLayout.setVgap(50);
	
	this.setLayout(borderLayout);
	this.setSize(850, 500);
	this.setAutoscrolls(true);		
	this.setBorder(null);
	this.setFocusable(true);
	this.setVisible(true);
	this.add(getOntoSplitPane(), BorderLayout.CENTER);
}
 
Example 3
Project: AgentWorkbench   File: JPanel4Visualisation.java   View Source Code Vote up 5 votes
/**
 * Instantiates a new j panel4 visualization.
 *
 * @param tabName the tab name
 */
public JPanel4Visualisation(Project project, String tabName) {
	super();
	this.currProject = project;
	this.tabName = tabName;
	
	BorderLayout borderLayout = new BorderLayout();
	borderLayout.setHgap(10);
	borderLayout.setVgap(10);
	this.setLayout(borderLayout);
	
}
 
Example 4
Project: freecol   File: AudioMixerOptionUI.java   View Source Code Vote up 4 votes
/**
 * 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
Project: FreeCol   File: AudioMixerOptionUI.java   View Source Code Vote up 4 votes
/**
 * 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 6
Project: scorekeeperfrontend   File: ChallengeGUI.java   View Source Code Vote up 4 votes
/**
 * Create the main GUI window.
 */
public ChallengeGUI()
{
	super("Challenge");
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	setJMenuBar(new Menus());
			
	model = new ChallengeModel();
	bracket = new BracketPane(model);
	bracketScroll = new JScrollPane(bracket);
	bracketScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	bracketScroll.getViewport().setBackground(Color.WHITE);
	bracketScroll.getViewport().setLayout(new BetterViewportLayout());
	
	tree = new EntrantTree();
	tree.setDragEnabled(true);
	
	bonusSelect = new JComboBox<String>(new String[] { "Bonus", "Regular" });
	bonusSelect.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			tree.useBonusDialins(bonusSelect.getSelectedItem().equals("Bonus"));
		}
	});
	bonusSelect.setSelectedItem("Bonus");  // just to make sure everyone is on the same page
	
	SelectionBar selectBar = new SelectionBar();

	JScrollPane tpane = new JScrollPane(tree);
	tpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	tpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

	JPanel main = new JPanel(new MigLayout("fill", "[grow 0][fill]", "[grow 0][]"));
	
	main.add(new JLabel("Drag drives with"), "split 3");
	main.add(bonusSelect, "");
	main.add(new JLabel("dialins"), "");
	main.add(bracketScroll, "spany 2, grow, wrap");
	main.add(tpane, "growy, w 200!");

	BorderLayout layout = new BorderLayout();
	layout.setHgap(5);
	layout.setVgap(5);
	JPanel content = new JPanel(layout);
	content.add(selectBar, BorderLayout.NORTH);
	content.add(main, BorderLayout.CENTER);
	
	setContentPane(content);
	setSize(1024,768);
	setVisible(true);
	
    Database.openDefault();
}