Java Code Examples for javax.swing.BoxLayout#X_AXIS

The following examples show how to use javax.swing.BoxLayout#X_AXIS . 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 File: ConnectionSettingsUI.java    From LoboBrowser with MIT License 6 votes vote down vote up
private Component getProxyHostArea() {
  final Box checkBoxBox = new Box(BoxLayout.Y_AXIS);
  checkBoxBox.setPreferredSize(new Dimension(600, 200));
  checkBoxBox.add(this.bypassLocalCheckBox);
  checkBoxBox.add(this.authenticatedCheckBox);

  final Box checkBoxBoxExpander = new Box(BoxLayout.X_AXIS);
  checkBoxBoxExpander.add(checkBoxBox);
  checkBoxBoxExpander.add(Box.createHorizontalGlue());

  final Box box = this.proxyHostArea;
  box.setBorder(new EmptyBorder(8, 16, 8, 8));
  box.add(this.hostPortPanel);
  box.add(checkBoxBoxExpander);
  box.add(this.authenticationPanel);
  return box;
}
 
Example 2
Source File: AboutDialog.java    From RobotBuilder with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public AboutDialog(JFrame parent, String applicationName, String description, String version, String wpilibVersion) {
    super(parent, applicationName);
    Box aboutWindow = new Box(BoxLayout.Y_AXIS);
    JLabel productName = new JLabel(applicationName);
    Font defaultFont = productName.getFont();
    productName.setFont(new Font(defaultFont.getName(), Font.BOLD, defaultFont.getSize() + 8));
    aboutWindow.add(Box.createVerticalStrut(10));
    aboutWindow.add(productName);
    aboutWindow.add(new JLabel("Version " + version));
    aboutWindow.add(Box.createVerticalStrut(15));
    aboutWindow.add(new JLabel("Exports to WPILib Version " + wpilibVersion));
    aboutWindow.add(Box.createVerticalStrut(15));
    aboutWindow.add(new JLabel(description));
    aboutWindow.add(Box.createVerticalStrut(15));
    aboutWindow.add(new JLabel("FIRST/WPI Robotics Research Group"));
    aboutWindow.add(Box.createVerticalStrut(5));
    ButtonBox buttonBox = new ButtonBox(BoxLayout.X_AXIS);
    JButton okButton = new JButton("OK");
    this.getRootPane().setDefaultButton(okButton);
    okButton.addActionListener(e -> setVisible(false));
    buttonBox.add(okButton);
    aboutWindow.add(buttonBox);
    this.getContentPane().add(aboutWindow, "Center");
    this.pack();
}
 
Example 3
Source File: Toolbar.java    From Logisim with GNU General Public License v3.0 6 votes vote down vote up
public void setOrientation(Object value) {
	int axis;
	String position;
	if (value == HORIZONTAL) {
		axis = BoxLayout.X_AXIS;
		position = BorderLayout.LINE_START;
	} else if (value == VERTICAL) {
		axis = BoxLayout.Y_AXIS;
		position = BorderLayout.NORTH;
	} else {
		throw new IllegalArgumentException();
	}
	this.remove(subpanel);
	subpanel.setLayout(new BoxLayout(subpanel, axis));
	this.add(subpanel, position);
	this.orientation = value;
}
 
Example 4
Source File: ConnectionSettingsUI.java    From LoboBrowser with MIT License 6 votes vote down vote up
private Component getProxyBox() {
  final Box radioBox = new Box(BoxLayout.Y_AXIS);
  radioBox.setPreferredSize(new Dimension(600, 200));
  radioBox.add(this.noProxyRadioButton);
  radioBox.add(this.httpProxyRadioButton);
  radioBox.add(this.socksProxyRadioButton);

  final Box radioBoxExpander = new Box(BoxLayout.X_AXIS);
  radioBoxExpander.add(radioBox);
  radioBoxExpander.add(Box.createGlue());

  final Box box = SwingTasks.createGroupBox(BoxLayout.Y_AXIS, "Proxy");
  box.add(radioBoxExpander);
  box.add(this.getProxyHostArea());
  return box;
}
 
Example 5
Source File: SimpleTextEditDialog.java    From LoboBrowser with MIT License 5 votes vote down vote up
private Component createButtonPanel() {
  final Box panel = new Box(BoxLayout.X_AXIS);
  panel.setPreferredSize(new Dimension(Short.MAX_VALUE, 0));
  panel.setBorder(new EmptyBorder(4, 4, 4, 4));
  panel.add(Box.createGlue());
  panel.add(this.okButton);
  panel.add(Box.createRigidArea(new Dimension(4, 1)));
  panel.add(this.cancelButton);
  panel.add(Box.createGlue());
  return panel;
}
 
Example 6
Source File: DownloadDialog.java    From LoboBrowser with MIT License 5 votes vote down vote up
private Component getButtonsPanel() {
  final JButton saveButton = this.saveButton;
  saveButton.setAction(new SaveAction());
  saveButton.setText("Save As...");
  saveButton.setToolTipText("You must select a file before download begins.");

  final JButton closeButton = this.closeButton;
  closeButton.setAction(new CloseAction());
  closeButton.setText("Cancel");

  final JButton openButton = this.openButton;
  openButton.setAction(new OpenAction());
  openButton.setText("Open");

  final JButton openFolderButton = this.openFolderButton;
  openFolderButton.setAction(new OpenFolderAction());
  openFolderButton.setText("Open Folder");

  final Box box = new Box(BoxLayout.X_AXIS);
  // box.setBorder(new BevelBorder(BevelBorder.RAISED));
  box.add(Box.createGlue());
  box.add(openButton);
  box.add(Box.createHorizontalStrut(4));
  box.add(openFolderButton);
  box.add(Box.createHorizontalStrut(4));
  box.add(saveButton);
  box.add(Box.createHorizontalStrut(4));
  box.add(closeButton);
  return box;
}
 
Example 7
Source File: ToolsSettingsUI.java    From LoboBrowser with MIT License 5 votes vote down vote up
private Component getSearchEnginePane() {
  final Box innerBox = new Box(BoxLayout.X_AXIS);
  innerBox.add(new JLabel("Search Engines:"));
  innerBox.add(this.searchEngineListControl);
  final Box groupBox = SwingTasks.createGroupBox(BoxLayout.Y_AXIS, "Search");
  groupBox.add(innerBox);
  return groupBox;
}
 
Example 8
Source File: GeneralSettingsUI.java    From LoboBrowser with MIT License 5 votes vote down vote up
private Component getStartupGroupBox() {
  final Box startupGroupBox = new Box(BoxLayout.Y_AXIS);
  startupGroupBox.setBorder(new TitledBorder(new EtchedBorder(), "Startup"));
  final Box startupPagesBox = new Box(BoxLayout.X_AXIS);
  final JLabel pagesLabel = new JLabel("Pages:");
  pagesLabel.setToolTipText("Up to " + MAX_STARTUP_PAGES + " pages launched when you first run the browser.");
  startupPagesBox.add(pagesLabel);
  startupPagesBox.add(this.startupPagesStringListControl);
  startupGroupBox.add(startupPagesBox);
  return startupGroupBox;
}
 
Example 9
Source File: AutoCompleteDocument.java    From Spark with Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) {
    javax.swing.JFrame frame = new javax.swing.JFrame("foo");
    frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
    String[] dict = {"auto", "automobile", "autocrat", "graduation"};
    JTextField field =
        AutoCompleteDocument.createAutoCompleteTextField(dict);
    BoxLayout layout = new BoxLayout(frame.getContentPane(),
        BoxLayout.X_AXIS);
    frame.getContentPane().setLayout(layout);
    frame.getContentPane().add(new javax.swing.JLabel("Text Field: "));
    frame.getContentPane().add(field);
    frame.setVisible(true);
}
 
Example 10
Source File: FiltersManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Not public, instances created using factory method createPanel */
FiltersComponent(FiltersDescription descr) {
    super(BoxLayout.X_AXIS);
    this.filtersDesc = descr;
    // always create swing content in AWT thread
    if (!SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(new Runnable () {
            public void run () {
                initPanel();                        
            }
        });
    } else {
        initPanel();
    }
}
 
Example 11
Source File: CustomToolbar.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public CustomToolbar() {
    super(BoxLayout.X_AXIS);
    initPanel();
}
 
Example 12
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
protected Box createInstanceImpl() {
    return new Box(BoxLayout.X_AXIS) {
        public void layout() {}
        public void setLayout(LayoutManager l) {}
    };
}
 
Example 13
Source File: IDEFPanel.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
private BoxLayout getBoxLayout() {
    boxLayout = new BoxLayout(getJPanel2(), BoxLayout.X_AXIS);
    return boxLayout;
}
 
Example 14
Source File: LibraryTreePanel.java    From osp with GNU General Public License v3.0 4 votes vote down vote up
MetadataComboBoxEditor() {
	super(BoxLayout.X_AXIS);
	keyEditField = new MetadataEditField(keyFieldWidth) {
		protected String getDefaultText() {
			return metadata==emptyMetadata? ToolsRes.getString("LibraryTreePanel.Metadata.Name"): null; //$NON-NLS-1$
		}
  	protected Font getEmptyFont() {
  		return font.deriveFont(Font.BOLD+Font.ITALIC);
  	}     	
  	protected Font getDefaultFont() {
  		return font.deriveFont(Font.BOLD);
  	}      	
	};
  entryFields.add(keyEditField);

	keyEditField.setHorizontalAlignment(SwingConstants.RIGHT);
	keyEditField.setFont(keyEditField.getDefaultFont());
	
	valueEditField = new MetadataEditField(0) {
		protected String getDefaultText() {
			return metadata==emptyMetadata? ToolsRes.getString("LibraryTreePanel.Metadata.Value"): null; //$NON-NLS-1$
		}
  	protected Font getEmptyFont() {
  		return font.deriveFont(Font.ITALIC);
  	}     	
  	protected Font getDefaultFont() {
  		return font.deriveFont(Font.PLAIN);
  	}      	
	};
  entryFields.add(valueEditField);
	
	Border border = BorderFactory.createCompoundBorder(keyEditField.getBorder(), BorderFactory.createEmptyBorder(0, 1, 0, 1));
	keyEditField.setBorder(border);
	valueEditField.setBorder(border);

	spacer = new JLabel();
	spacer.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
	add(keyEditField);
	add(spacer);
	add(valueEditField);
}
 
Example 15
Source File: JComponentBuilders.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected Box createInstanceImpl() {
    return new Box(BoxLayout.X_AXIS) {
        public void layout() {}
        public void setLayout(LayoutManager l) {}
    };
}
 
Example 16
Source File: TracerDataMainPanel.java    From pega-tracerviewer with Apache License 2.0 4 votes vote down vote up
private JPanel getInfoJPanel(JLabel label) {

        JPanel infoJPanel = new JPanel();

        LayoutManager layout = new BoxLayout(infoJPanel, BoxLayout.X_AXIS);
        infoJPanel.setLayout(layout);

        Dimension dim = new Dimension(1, 30);

        infoJPanel.add(Box.createHorizontalGlue());
        infoJPanel.add(Box.createRigidArea(dim));
        infoJPanel.add(label);
        infoJPanel.add(Box.createHorizontalGlue());

        infoJPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));

        return infoJPanel;
    }
 
Example 17
Source File: JdotxtStatusBar.java    From jdotxt with GNU General Public License v3.0 4 votes vote down vote up
public JdotxtStatusBar(String text) {
	super(BoxLayout.X_AXIS);
	initGUI();
	setText(text);
}
 
Example 18
Source File: SelectionDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/** Constructs panel containing the main GUI components. */
private JPanel constructJComponent() {

	// Selection panel

	BoxLayout selectionPanelLayout = new BoxLayout(selectionPanel, BoxLayout.Y_AXIS);
	selectionPanel.setLayout(selectionPanelLayout);
	ButtonGroup radioButtons = new ButtonGroup();
	if (optionsToSelect != null) {
		for (int i = 0; i < optionsToSelect.size(); i++) {
			JRadioButton radioButton = new JRadioButton(getI18n(optionsToSelect.get(i)));
			radioButton.setHorizontalAlignment(JRadioButton.LEFT);
			if (i == 0) {
				radioButton.setSelected(true);
			}
			radioButtons.add(radioButton);
			selectionPanel.add(radioButton);
		}
	}

	// Checkbox panel

	BoxLayout checkboxPanelLayout = new BoxLayout(checkboxPanel, BoxLayout.Y_AXIS);
	checkboxPanel.setLayout(checkboxPanelLayout);
	if (optionsToCheck != null) {
		for (int i = 0; i < optionsToCheck.size(); i++) {
			JCheckBox jCheckBox = new JCheckBox(getI18n(optionsToCheck.get(i)));
			jCheckBox.setHorizontalAlignment(JCheckBox.LEFT);
			checkboxPanel.add(jCheckBox);
		}
	}

	// Overall panel

	JPanel panel = new JPanel();
	BoxLayout panelLayout = new BoxLayout(panel, BoxLayout.Y_AXIS);
	panel.setLayout(panelLayout);
	panel.add(selectionPanel);
	if (optionsToSelect != null && !optionsToSelect.isEmpty() && optionsToCheck != null && !optionsToCheck.isEmpty()) {
		panel.add(Box.createRigidArea(new Dimension(0, GAP_BETWEEN_SELECTIONS)));
	}
	panel.add(checkboxPanel);

	JPanel leftMarginPanel = new JPanel();
	BoxLayout leftMarginPanelLayout = new BoxLayout(leftMarginPanel, BoxLayout.X_AXIS);
	leftMarginPanel.setLayout(leftMarginPanelLayout);
	leftMarginPanel.add(Box.createRigidArea(new Dimension(getInfoIcon().getIconWidth() + BUTTON_DIALOG_LEFT_GAP, 0)));
	leftMarginPanel.add(panel);

	return leftMarginPanel;
}
 
Example 19
Source File: NavigationPanel.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
private void createUIComponents() {
  setLayout(new BorderLayout());

  Box box = new Box(BoxLayout.X_AXIS);

  add(new JSeparator(), BorderLayout.NORTH);

  box.setBorder(new EmptyBorder(new JBInsets(5, 10, 5, 10)));

  backButton.setActionCommand(BACK_ACTION);
  box.add(backButton);
  box.add(Box.createHorizontalStrut(10));

  nextButton.setActionCommand(NEXT_ACTION);
  box.add(nextButton);

  cancelButton.setActionCommand(CANCEL_ACTION);
  box.add(Box.createHorizontalStrut(10));
  box.add(cancelButton);

  add(box, BorderLayout.EAST);
}
 
Example 20
Source File: JdotxtStatusBar.java    From jdotxt with GNU General Public License v3.0 4 votes vote down vote up
public JdotxtStatusBar() {
	super(BoxLayout.X_AXIS);
	initGUI();
}