javax.swing.BoxLayout Java Examples

The following examples show how to use javax.swing.BoxLayout. 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: TracerDataMainPanel.java    From pega-tracerviewer with Apache License 2.0 6 votes vote down vote up
private JPanel getTracerInfoJPanel() {

        JPanel infoJPanel = new JPanel();

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

        // Dimension preferredSize = new Dimension(300, 30);
        // infoJPanel.setPreferredSize(preferredSize);

        JPanel incompleteTracerJPanel = getIncompleteTracerJPanel();
        JPanel charsetJPanel = getCharsetJPanel();
        JPanel sizeJPanel = getSizeJPanel();

        infoJPanel.add(incompleteTracerJPanel);
        infoJPanel.add(charsetJPanel);
        infoJPanel.add(sizeJPanel);

        return infoJPanel;
    }
 
Example #2
Source File: EditPacketBlackList.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public EditPacketBlackList(Gui gui) {
    super("PacketLogger blacklist");
    this.gui = gui;
    this.setLayout(new BoxLayout(this.getContentPane(), 1));
    this.buttonsPanel.setLayout(new FlowLayout());
    this.construct();
    this.addToLists();
    this.reset.addActionListener(this);
    this.accept.addActionListener(this);
    this.buttonsPanel.add(this.reset);
    this.buttonsPanel.add(this.accept);
    this.add(this.buttonsPanel);
    this.pack();
    this.setLocationRelativeTo(null);
    this.setResizable(false);
    this.setAlwaysOnTop(true);
    this.setVisible(true);
}
 
Example #3
Source File: PeakSelectionComponent.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
public PeakSelectionComponent() {

    super(new BorderLayout());

    selectionListModel = new DefaultListModel<PeakSelection>();
    selectionList = new JList<>(selectionListModel);
    selectionList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    selectionList.setPreferredSize(new Dimension(200, 50));
    JScrollPane scrollPane = new JScrollPane(selectionList);
    add(scrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    addButton = GUIUtils.addButton(buttonPanel, "Add", null, this);
    removeButton = GUIUtils.addButton(buttonPanel, "Remove", null, this);
    allButton = GUIUtils.addButton(buttonPanel, "Set to all", null, this);
    clearButton = GUIUtils.addButton(buttonPanel, "Clear", null, this);

    add(buttonPanel, BorderLayout.EAST);
  }
 
Example #4
Source File: ExpressionSubPanel.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/** Sets the up literal panel. */
protected void setUpLiteralPanel() {
    panelLiteral = new JPanel();
    panelLiteral.setBorder(null);
    panelLiteral.setLayout(new BoxLayout(panelLiteral, BoxLayout.X_AXIS));

    rdbtnLiteral =
            new JRadioButton(
                    Localisation.getString(
                            ExpressionPanelv2.class, "ExpressionPanelv2.literal"));
    rdbtnLiteral.setMinimumSize(new Dimension(100, 20));
    rdbtnLiteral.setPreferredSize(new Dimension(100, 20));
    panelLiteral.add(rdbtnLiteral);
    rdbtnLiteral.setActionCommand(LITERAL);
    buttonGroup.add(rdbtnLiteral);
    box.add(panelLiteral);
}
 
Example #5
Source File: MapPanel.java    From osv with GNU General Public License v3.0 6 votes vote down vote up
public MapPanel(MainWindow mw) {

		this.mw = mw;
		this.setOpaque(false);

		cp = new JPanel();
		cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
		cp.setOpaque(false);
		verticalSpace = new OSVEmptyPanel(mw, 0, 0.28f);
		cp.add(verticalSpace);

		mapDisplay = new MapDisplay();
		mapDisplay.setOpaque(false);

		cp.add(mapDisplay);

		add(cp);
	}
 
Example #6
Source File: SeparatorTitled.java    From jdal with Apache License 2.0 6 votes vote down vote up
public SeparatorTitled(String title, boolean bold) {

	super(BoxLayout.LINE_AXIS);
	JLabel titleLabel = new JLabel(title);
	
	if (bold)
		FormUtils.setBold(titleLabel);
	
	titleLabel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
	this.add(titleLabel);
	this.add(Box.createHorizontalStrut(5));
	JSeparator separator = new JSeparator();
	separator.setAlignmentY(Container.TOP_ALIGNMENT);
	this.add(separator);
	this.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));
}
 
Example #7
Source File: Test4903007.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
protected JPanel getObject() {
    Box vBox = Box.createVerticalBox();
    vBox.add(new JButton("button"));
    vBox.add(Box.createVerticalStrut(10));
    vBox.add(new JLabel("label"));
    vBox.add(Box.createVerticalGlue());
    vBox.add(new JButton("button"));
    vBox.add(Box.createVerticalStrut(10));
    vBox.add(new JLabel("label"));

    Box hBox = Box.createHorizontalBox();
    hBox.add(new JButton("button"));
    hBox.add(Box.createHorizontalStrut(10));
    hBox.add(new JLabel("label"));
    hBox.add(Box.createHorizontalGlue());
    hBox.add(new JButton("button"));
    hBox.add(Box.createHorizontalStrut(10));
    hBox.add(new JLabel("label"));

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(vBox);
    panel.add(Box.createGlue());
    panel.add(hBox);
    return panel;
}
 
Example #8
Source File: ProgressPanel.java    From jadx with Apache License 2.0 6 votes vote down vote up
public ProgressPanel(final MainWindow mainWindow, boolean showCancelButton) {
	this.showCancelButton = showCancelButton;

	progressLabel = new JLabel();
	progressBar = new JProgressBar(0, 100);
	progressBar.setIndeterminate(true);
	progressBar.setStringPainted(false);
	progressLabel.setLabelFor(progressBar);

	setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
	setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
	setVisible(false);
	add(progressLabel);
	add(progressBar);

	cancelButton = new JButton(ICON_CANCEL);
	cancelButton.setPreferredSize(new Dimension(ICON_CANCEL.getIconWidth(), ICON_CANCEL.getIconHeight()));
	cancelButton.setToolTipText("Cancel background jobs");
	cancelButton.setBorderPainted(false);
	cancelButton.setFocusPainted(false);
	cancelButton.setContentAreaFilled(false);
	cancelButton.addActionListener(e -> mainWindow.cancelBackgroundJobs());
	cancelButton.setVisible(showCancelButton);
	add(cancelButton);
}
 
Example #9
Source File: QBNodeComponent.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public QBNodeComponent(String nodeName, QueryBuilderTableModel queryBuilderTableModel)
   {
       // Set some private variables
       _queryBuilderTableModel = queryBuilderTableModel;
_nodeName = nodeName;

       // Create a JTable component, with the specified TableModel behind it
       _qbTable = new QueryBuilderTable(_queryBuilderTableModel);
       _qbTable.setBackground(Color.white); 
       
       // Wrap the JTable in a JScrollPane
       JScrollPane sp = new JScrollPane(_qbTable);
       sp.getViewport().setBackground(Color.white); 
       
       // Wrap the JScrollPane in a JPanel
       this.add(sp,BorderLayout.CENTER);
       this.setBackground(Color.white);
       this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setPreferredSize(new Dimension(175,80));

// Only applies to JInternalFrame
       // setResizable(true);
       
       // setVisible(true);
   }
 
Example #10
Source File: ToolAdapterTabbedEditorDialog.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected JPanel createParametersPanel() {
    JPanel paramsPanel = new JPanel();
    BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS);
    paramsPanel.setLayout(layout);
    AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addParamBut.setText("New Parameter");
    addParamBut.setMaximumSize(new Dimension(150, controlHeight));
    addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT);
    addParamBut.setAlignmentY(Component.TOP_ALIGNMENT);
    paramsPanel.add(addParamBut);
    JScrollPane tableScrollPane = new JScrollPane(paramsTable);
    tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    paramsPanel.add(tableScrollPane);
    addParamBut.addActionListener(e -> paramsTable.addParameterToTable());
    return paramsPanel;
}
 
Example #11
Source File: MeasurementSetPanel.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    measurementSetWithTitlePanel = new javax.swing.JPanel();

    measurementSetWithTitlePanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    measurementSetWithTitlePanel.setLayout(new javax.swing.BoxLayout(measurementSetWithTitlePanel, javax.swing.BoxLayout.Y_AXIS));

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
            .addContainerGap()
            .add(measurementSetWithTitlePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createSequentialGroup()
            .addContainerGap()
            .add(measurementSetWithTitlePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
            .addContainerGap())
    );
}
 
Example #12
Source File: ShapeSelectionPanel.java    From settlers-remake with MIT License 5 votes vote down vote up
/**
 * Constructor
 */
public ShapeSelectionPanel() {
	super(BoxLayout.Y_AXIS);
	JToolBar tb = new JToolBar();
	tb.setFloatable(false);

	ButtonGroup group = new ButtonGroup();

	for (EShapeType type : EShapeType.values()) {
		JToggleButton bt = new JToggleButton(type.getIcon());
		bt.setDisabledIcon(type.getIcon().createDisabledIcon());
		bt.setSelectedIcon(type.getIcon().createSelectedIcon());
		bt.setToolTipText(type.getShape().getName());
		bt.addActionListener(new ShapeActionListener(type.getShape()));
		bt.setEnabled(false);
		tb.add(bt);
		group.add(bt);
		buttons.put(type, bt);
	}

	add(tb);

	for (EShapeProperty p : EShapeProperty.values()) {
		StrokenSlider slider = new StrokenSlider(p);
		properties.put(p, slider);

		add(slider);
	}

	updateStrokeProperties();
}
 
Example #13
Source File: AgeCalculator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private void addBottomArea(Container container) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

    ItemListener listener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            updateResults();
        }
    };

    iFieldSets = new FieldSet[] {
        new FieldSet("Month Based", new FieldGroup[] {
            new FieldGroup(listener, "Years", YEARS),
            new FieldGroup(listener, "Months", MONTHS),
            new FieldGroup(listener, "Days", DAYS),
            new FieldGroup(listener, "Hours", HOURS),
            new FieldGroup(listener, "Minutes", MINUTES),
            new FieldGroup(listener, "Seconds", SECONDS)
        })
        ,
        new FieldSet("Week Based", new FieldGroup[] {
            new FieldGroup(listener, "Weekyears", WEEKYEARS),
            new FieldGroup(listener, "Weeks", WEEKS),
            new FieldGroup(listener, "Days", DAYS),
            new FieldGroup(listener, "Hours", HOURS),
            new FieldGroup(listener, "Minutes", MINUTES),
            new FieldGroup(listener, "Seconds", SECONDS)
        })
    };

    for (int i=0; i<iFieldSets.length; i++) {
        if (i > 0) {
            panel.add(Box.createHorizontalStrut(10));
        }
        iFieldSets[i].addTo(panel);
    }
    panel.add(Box.createVerticalGlue());

    container.add(fixedHeight(panel));
}
 
Example #14
Source File: TooMuchWheelRotationEventsTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static JPanel createTestPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    JTextArea textArea = new JTextArea(20, 20);
    textArea.setText(getLongString());
    JScrollPane scrollPane = new JScrollPane(textArea);
    panel.add(scrollPane);
    return panel;
}
 
Example #15
Source File: AddBookmarkDialog.java    From LoboBrowser with MIT License 5 votes vote down vote up
public AddBookmarkDialog(final Frame owner, final boolean modal, final BookmarkInfo existingInfo) throws HeadlessException {
  super(owner, modal);
  this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  this.url = existingInfo.getUrl();
  this.urlField.setEditable(false);
  this.tagsField.setToolTip("List of keywords separated by blanks.");
  this.urlField.setValue(existingInfo.getUrl().toExternalForm());
  this.titleField.setValue(existingInfo.getTitle());
  this.descriptionField.setValue(existingInfo.getDescription());
  this.tagsField.setValue(existingInfo.getTagsText());
  final Container contentPane = this.getContentPane();
  contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
  final FormPanel fieldsPanel = new FormPanel();
  fieldsPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  fieldsPanel.addField(this.urlField);
  fieldsPanel.addField(this.titleField);
  fieldsPanel.addField(this.descriptionField);
  fieldsPanel.addField(this.tagsField);

  final Dimension fpps = fieldsPanel.getPreferredSize();
  fieldsPanel.setPreferredSize(new Dimension(400, fpps.height));

  contentPane.add(fieldsPanel);
  final JComponent buttonsPanel = new JPanel();
  buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS));
  final JButton okButton = new JButton();
  okButton.setAction(new OkAction());
  okButton.setText("Save");
  final JButton cancelButton = new JButton();
  cancelButton.setAction(new CancelAction());
  cancelButton.setText("Cancel");
  buttonsPanel.add(Box.createHorizontalGlue());
  buttonsPanel.add(okButton);
  buttonsPanel.add(Box.createRigidArea(new Dimension(4, 1)));
  buttonsPanel.add(cancelButton);
  buttonsPanel.add(Box.createHorizontalGlue());
  contentPane.add(buttonsPanel);
  contentPane.add(Box.createRigidArea(new Dimension(1, 4)));
}
 
Example #16
Source File: InterpolateFilter.java    From GpsPrune with GNU General Public License v2.0 5 votes vote down vote up
/** Make the panel contents */
protected void makePanelContents()
{
	setLayout(new BorderLayout());
	JPanel boxPanel = new JPanel();
	boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.Y_AXIS));
	add(boxPanel, BorderLayout.NORTH);
	JLabel topLabel = new JLabel(I18nManager.getText("dialog.gpsbabel.filter.interpolate.intro"));
	topLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
	boxPanel.add(topLabel);
	boxPanel.add(Box.createVerticalStrut(18)); // spacer
	// Main three-column grid
	JPanel gridPanel = new JPanel();
	gridPanel.setLayout(new GridLayout(0, 3, 4, 4));
	gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.interpolate.distance")));
	_distField = new DecimalNumberField();
	_distField.addKeyListener(_paramChangeListener);
	gridPanel.add(_distField);
	_distUnitsCombo = new JComboBox<String>(new String[] {I18nManager.getText("units.kilometres"), I18nManager.getText("units.miles")});
	gridPanel.add(_distUnitsCombo);
	gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.interpolate.time")));
	_secondsField = new WholeNumberField(4);
	_secondsField.addKeyListener(_paramChangeListener);
	gridPanel.add(_secondsField);
	gridPanel.add(new JLabel(I18nManager.getText("units.seconds")));
	gridPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
	boxPanel.add(gridPanel);
}
 
Example #17
Source File: FlatTitlePane.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
protected void addSubComponents() {
	leftPanel = new JPanel();
	iconLabel = new JLabel();
	titleLabel = new JLabel();
	iconLabel.setBorder( new FlatEmptyBorder( UIManager.getInsets( "TitlePane.iconMargins" ) ) );
	titleLabel.setBorder( new FlatEmptyBorder( UIManager.getInsets( "TitlePane.titleMargins" ) ) );

	leftPanel.setLayout( new BoxLayout( leftPanel, BoxLayout.LINE_AXIS ) );
	leftPanel.setOpaque( false );
	leftPanel.add( iconLabel );

	menuBarPlaceholder = new JComponent() {
		@Override
		public Dimension getPreferredSize() {
			JMenuBar menuBar = rootPane.getJMenuBar();
			return (menuBar != null && isMenuBarEmbedded())
				? FlatUIUtils.addInsets( menuBar.getPreferredSize(), UIScale.scale( menuBarMargins ) )
				: new Dimension();
		}
	};
	leftPanel.add( menuBarPlaceholder );

	createButtons();

	setLayout( new BorderLayout() );
	add( leftPanel, BorderLayout.LINE_START );
	add( titleLabel, BorderLayout.CENTER );
	add( buttonPanel, BorderLayout.LINE_END );
}
 
Example #18
Source File: OpenRDBMSDialogBox.java    From ontopia with Apache License 2.0 5 votes vote down vote up
public WarningBox(String warning) {
  // Create the warning panel to hold all the other components.
  JPanel warningPanel = new JPanel();
  // Lay out the components vertically.
  warningPanel.setLayout(new BoxLayout(warningPanel, BoxLayout.Y_AXIS));
  warningPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory
      .createEtchedBorder(), Messages.getString("Viz.Warning")));

  // Create the warning message.
  JTextArea warningTextArea = new JTextArea(warning);
  warningTextArea.setLineWrap(true);
  warningTextArea.setWrapStyleWord(true);
  warningTextArea.setEditable(false);
  warningTextArea.setFont(warningTextArea.getFont().deriveFont(13f));
  warningTextArea.setBackground(warningPanel.getBackground());
  warningPanel.add(warningTextArea);
    
  // Will listen for and act upon changes to the OK button.
  ActionListener okListener = new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent action) {
        setVisible(false);
      }
    };
    
  // Create an Ok button.
  JButton okButton = new JButton(Messages.getString("Viz.OK"));
  okButton.addActionListener(okListener);
  warningPanel.add(okButton);
    
  getContentPane().add(warningPanel);
  setSize(400, 150);
}
 
Example #19
Source File: ConstructionSitesPanel.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
   * Constructor
   * @param manager the settlement construction manager.
   */
  public ConstructionSitesPanel(ConstructionManager manager) {
      // Use JPanel constructor.
      super();
      
      this.manager = manager;
      
      setLayout(new BorderLayout());
      setBorder(new MarsPanelBorder());
      
      JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
      add(titlePanel, BorderLayout.NORTH);
      
      JLabel titleLabel = new JLabel("Construction Sites");
titleLabel.setFont(new Font("Serif", Font.BOLD, 16));
      titlePanel.add(titleLabel);
      
      // Create scroll panel for sites list pane.
      sitesScrollPane = new JScrollPane();
      sitesScrollPane.setPreferredSize(new Dimension(200, 75));
      sitesScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      add(sitesScrollPane, BorderLayout.CENTER);  
      
      // Prepare sites outer list pane.
      JPanel sitesOuterListPane = new JPanel(new BorderLayout(0, 0));
      sitesScrollPane.setViewportView(sitesOuterListPane);
      
      // Prepare sites list pane.
      sitesListPane = new JPanel();
      sitesListPane.setLayout(new BoxLayout(sitesListPane, BoxLayout.Y_AXIS));
      sitesOuterListPane.add(sitesListPane, BorderLayout.NORTH);
      
      // Create the site panels.
      sitesCache = manager.getConstructionSites();
      Iterator<ConstructionSite> i = sitesCache.iterator();
      while (i.hasNext()) sitesListPane.add(new ConstructionSitePanel(i.next()));
  }
 
Example #20
Source File: CannonballExample.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public static JComponent createComponent() {
    JComponent container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS));

    Chart chart = createChart("Cannonball", LegendPosition.InsideNE);
    cannonballTest(chart);
    container.add(new XChartPanel(chart));
    
    container.setBorder(BorderFactory.createLineBorder(Color.black, 1));
    return container;
}
 
Example #21
Source File: TestBox.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    TestEncoder.test(
            new Box(BoxLayout.LINE_AXIS),
            new Box(BoxLayout.PAGE_AXIS) {
                @Override
                public FlowLayout getLayout() {
                    return new FlowLayout() {
                        private final Object axis = OBJECT;
                    };
                }
            },
            OBJECT
    );
}
 
Example #22
Source File: JFontChooser.java    From PolyGlot with MIT License 5 votes vote down vote up
/**
 * Constructs a <code>JFontChooser</code> object using the given font size array.
 * @param fontSizeStrings  the array of font size string.
 * @param _core dictionary core for styling
 **/
public JFontChooser(String[] fontSizeStrings, DictCore _core)
{
    core = _core;
    if (fontSizeStrings == null)
    {
        fontSizeStrings = DEFAULT_FONT_SIZE_STRINGS;
    }
    this.fontSizeStrings = fontSizeStrings;

    JPanel selectPanel = new JPanel();
    selectPanel.setBackground(Color.white);
    selectPanel.setLayout(new BoxLayout(selectPanel, BoxLayout.X_AXIS));
    selectPanel.add(getFontFamilyPanel());
    selectPanel.add(getFontStylePanel());
    selectPanel.add(getFontSizePanel());

    JPanel contentsPanel = new JPanel();
    contentsPanel.setBackground(Color.white);
    contentsPanel.setLayout(new GridLayout(2, 1));
    contentsPanel.add(selectPanel, BorderLayout.NORTH);
    contentsPanel.add(getSamplePanel(), BorderLayout.CENTER);

    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    this.add(contentsPanel);
    this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    this.setSelectedFont(DEFAULT_SELECTED_FONT);
}
 
Example #23
Source File: TestBox.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    TestEncoder.test(
            new Box(BoxLayout.LINE_AXIS),
            new Box(BoxLayout.PAGE_AXIS) {
                @Override
                public FlowLayout getLayout() {
                    return new FlowLayout() {
                        private final Object axis = OBJECT;
                    };
                }
            },
            OBJECT
    );
}
 
Example #24
Source File: TableExample.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the connectionPanel, which will contain all the fields for
 * the connection information.
 */
public void createConnectionDialog() {
    // Create the labels and text fields.
    userNameLabel = new JLabel("User name: ", JLabel.RIGHT);
    userNameField = new JTextField("app");

    passwordLabel = new JLabel("Password: ", JLabel.RIGHT);
    passwordField = new JTextField("app");

    serverLabel = new JLabel("Database URL: ", JLabel.RIGHT);
    serverField = new JTextField("jdbc:derby://localhost:1527/sample");

    driverLabel = new JLabel("Driver: ", JLabel.RIGHT);
    driverField = new JTextField("org.apache.derby.jdbc.ClientDriver");


    connectionPanel = new JPanel(false);
    connectionPanel.setLayout(new BoxLayout(connectionPanel,
            BoxLayout.X_AXIS));

    JPanel namePanel = new JPanel(false);
    namePanel.setLayout(new GridLayout(0, 1));
    namePanel.add(userNameLabel);
    namePanel.add(passwordLabel);
    namePanel.add(serverLabel);
    namePanel.add(driverLabel);

    JPanel fieldPanel = new JPanel(false);
    fieldPanel.setLayout(new GridLayout(0, 1));
    fieldPanel.add(userNameField);
    fieldPanel.add(passwordField);
    fieldPanel.add(serverField);
    fieldPanel.add(driverField);

    connectionPanel.add(namePanel);
    connectionPanel.add(fieldPanel);
}
 
Example #25
Source File: AddClassMapping.java    From AML-Project with Apache License 2.0 5 votes vote down vote up
private void buildTargetResultsPanel()
{
       //Results panel: contains the list of all classes that match que query
       tResults = new JPanel();
       tResults.setLayout(new BoxLayout(tResults, BoxLayout.PAGE_AXIS));
       //Create a label
       JLabel tLabel = new JLabel("Select a target class from the list of search results or go back to the full class list:");
       JPanel tLPanel = new JPanel();
       tLPanel.add(tLabel);
       tResults.add(tLPanel);
       Vector<String> sNames = new Vector<String>(targetRes.size());
       for(int i : targetRes)
       	sNames.add(target.getBestName(i));
       //Create the search area and button
	targetResult = new JTextArea(1,37);
	targetResult.setText(targetSearch.getText());
	targetResult.setEditable(false);
	targetResult.setBackground(Color.LIGHT_GRAY);
	backT = new JButton("Back");
	backT.setPreferredSize(new Dimension(70,28));
	backT.addActionListener(this);
	//Put them in a subpanel, side by side
	JPanel tSearchPanel = new JPanel();
	tSearchPanel.add(targetResult);
       tSearchPanel.add(backT);
       tResults.add(tSearchPanel);
       //Build the combo box with all the primary class names from the results
       targetResults = new JComboBox<String>(sNames);
       targetResults.setPreferredSize(new Dimension(500,28));
       //Put it in a subpanel so that it doesn't resize automatically
       JPanel tClassPanel = new JPanel();
       tClassPanel.add(targetResults);
       tResults.add(tClassPanel);
}
 
Example #26
Source File: AbstractAdapterEditor.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private AbstractAdapterEditor(AppContext appContext, JDialog parent, String title) {
    super(parent.getOwner(), title, ID_OK_CANCEL_HELP, new Object[] { new JButton(Bundle.CTL_Button_Export_Text()) }, helpID);
    this.context = appContext;
    this.logger = Logger.getLogger(ToolAdapterEditorDialog.class.getName());
    this.registerButton(ID_OTHER, new JButton(Bundle.CTL_Button_Export_Text()));
    controlHeight = (getJDialog().getFont().getSize() + 1) * 2;
    errorPanel = new JPanel();
    errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.Y_AXIS));
    getButtonPanel().add(errorPanel, 0);
}
 
Example #27
Source File: ExpandableMessage.java    From netbeans with Apache License 2.0 5 votes vote down vote up
ExpandableMessage(String topMsgKey,
                  Collection<String> messages,
                  String bottomMsgKey,
                  JButton toggleButton) {
    super(null);
    this.messages = messages;
    this.toggleButton = toggleButton;
    lblTopMsg = new JLabel(getMessage(topMsgKey));
    lblBotMsg = (bottomMsgKey != null)
                ? new JLabel(getMessage(bottomMsgKey))
                : null;

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    add(lblTopMsg);
    lblTopMsg.setAlignmentX(LEFT_ALIGNMENT);

    if (lblBotMsg != null) {
        add(makeVerticalStrut(lblTopMsg, lblBotMsg));
        add(lblBotMsg);
        lblBotMsg.setAlignmentX(LEFT_ALIGNMENT);
    }

    Mnemonics.setLocalizedText(toggleButton,
                               getMessage("LBL_ShowMoreInformation")); //NOI18N
    toggleButton.addActionListener(this);
}
 
Example #28
Source File: SettingsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static int defaultHeight() {
    if (DEFAULT_HEIGHT == -1) {
        JPanel ref = new JPanel(null);
        ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
        ref.setOpaque(false);
        
        ref.add(new JLabel("XXX")); // NOI18N
        
        ref.add(new JButton("XXX")); // NOI18N
        ref.add(new PopupButton("XXX")); // NOI18N
        
        ref.add(new JCheckBox("XXX")); // NOI18N
        ref.add(new JRadioButton("XXX")); // NOI18N
        
        ref.add(new JTextField("XXX")); // NOI18N
        
        ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));
        
        Component separator = Box.createHorizontalStrut(1);
        Dimension d = separator.getMaximumSize(); d.height = 20;
        separator.setMaximumSize(d);
        ref.add(separator);
        
        DEFAULT_HEIGHT = ref.getPreferredSize().height;
    }
    return DEFAULT_HEIGHT;
}
 
Example #29
Source File: GUIFilterConfigEditDialog.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private JComponent label_and_object(String label_name, JComponent object, int height) {
	JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    JLabel label = new JLabel(label_name);
    label.setPreferredSize(new Dimension(150, label.getMaximumSize().height));
    panel.add(label);
    object.setMaximumSize(new Dimension(Short.MAX_VALUE, label.getMaximumSize().height * height));
    panel.add(object);
	return panel;
}
 
Example #30
Source File: LegendBuilder.java    From geomajas-project-server with GNU Affero General Public License v3.0 5 votes vote down vote up
public void addLayer(String title, Font font, RenderedImage image) {
	JPanel panel = new JPanel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
	RenderedImageIcon icon = new RenderedImageIcon(image,
			LegendGraphicMetadata.DEFAULT_WIDTH, LegendGraphicMetadata.DEFAULT_HEIGHT);
	JLabel label = new JLabel(icon);
	label.setBorder(new EmptyBorder(ICON_PADDING, ICON_PADDING, ICON_PADDING, ICON_PADDING));
	panel.add(label);
	panel.add(Box.createRigidArea(new Dimension(MEMBER_MARGIN, 0)));
	JLabel itemText = new JLabel(title);
	itemText.setFont(font);
	panel.add(itemText);
	panel.setAlignmentX(JPanel.LEFT_ALIGNMENT);
	legendPanel.add(panel);
}