Java Code Examples for javax.swing.BoxLayout#PAGE_AXIS
The following examples show how to use
javax.swing.BoxLayout#PAGE_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: CommonSettingsDialog.java From megamek with GNU General Public License v2.0 | 6 votes |
private JPanel createSettingsPanel(ArrayList<ArrayList<Component>> comps) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); Box innerpanel = new Box(BoxLayout.PAGE_AXIS); for (ArrayList<Component> cs : comps) { Box subPanel = new Box(BoxLayout.LINE_AXIS); for (Component c : cs) { if (c instanceof JLabel) { subPanel.add(Box.createRigidArea(LABEL_SPACER)); subPanel.add(c); subPanel.add(Box.createRigidArea(LABEL_SPACER)); } else { subPanel.add(c); } } subPanel.setAlignmentX(Component.LEFT_ALIGNMENT); innerpanel.add(subPanel); } innerpanel.add(Box.createVerticalGlue()); innerpanel.setBorder(new EmptyBorder(10,10,10,10)); panel.add(innerpanel,BorderLayout.PAGE_START); return panel; }
Example 2
Source File: TemplateParameterEditorDialog.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
private JPanel createParametersPanel() { JPanel paramsPanel = new JPanel(); BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS); paramsPanel.setLayout(layout); AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon("/org/esa/snap/resources/images/icons/Add16.png"), false); addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT); paramsPanel.add(addParamBut); this.paramsTable = new OperatorParametersTable(this.fakeOperatorDescriptor, appContext); JScrollPane tableScrollPane = new JScrollPane(paramsTable); tableScrollPane.setPreferredSize(new Dimension(500, 130)); tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT); paramsPanel.add(tableScrollPane); addParamBut.addActionListener((ActionEvent e) -> paramsTable.addParameterToTable()); TitledBorder title = BorderFactory.createTitledBorder("Template Parameters"); paramsPanel.setBorder(title); return paramsPanel; }
Example 3
Source File: ToolAdapterEditorDialog.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@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.setAlignmentX(Component.LEFT_ALIGNMENT); addParamBut.setAlignmentY(Component.TOP_ALIGNMENT); paramsPanel.add(addParamBut); int tableWidth = (formWidth - 2 * DEFAULT_PADDING); int widths[] = {27, 120, (int)(tableWidth * 0.25), (int)(tableWidth * 0.1), 100, (int)(tableWidth * 0.32), 30}; for(int i=0; i < widths.length; i++) { paramsTable.getColumnModel().getColumn(i).setPreferredWidth(widths[i]); } JScrollPane tableScrollPane = new JScrollPane(paramsTable); tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT); paramsPanel.add(tableScrollPane); addParamBut.addActionListener(e -> paramsTable.addParameterToTable(new ToolParameterDescriptor("parameterName", String.class), 0)); TitledBorder title = BorderFactory.createTitledBorder(Bundle.CTL_Panel_OpParams_Border_TitleText()); paramsPanel.setBorder(title); return paramsPanel; }
Example 4
Source File: ToolAdapterTabbedEditorDialog.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@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 5
Source File: GenericToolbar.java From netbeans with Apache License 2.0 | 5 votes |
private void tweak() { if (UIUtils.isGTKLookAndFeel() || UIUtils.isNimbusLookAndFeel()) { int axis = getOrientation() == VERTICAL ? BoxLayout.PAGE_AXIS : BoxLayout.LINE_AXIS; setLayout(new BoxLayout(this, axis)); } if (UIUtils.isNimbusLookAndFeel()) setBorder(BorderFactory.createEmptyBorder(-2, 0, -2, 0)); else if (UIUtils.isAquaLookAndFeel()) setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1)); if (UIUtils.isWindowsClassicLookAndFeel()) setRollover(true); }
Example 6
Source File: GenericToolbar.java From visualvm with GNU General Public License v2.0 | 5 votes |
private void tweak() { if (UIUtils.isGTKLookAndFeel() || UIUtils.isNimbusLookAndFeel()) { int axis = getOrientation() == VERTICAL ? BoxLayout.PAGE_AXIS : BoxLayout.LINE_AXIS; setLayout(new BoxLayout(this, axis)); } if (UIUtils.isNimbusLookAndFeel()) setBorder(BorderFactory.createEmptyBorder(-2, 0, -2, 0)); else if (UIUtils.isAquaLookAndFeel()) setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1)); if (UIUtils.isWindowsClassicLookAndFeel()) setRollover(true); }
Example 7
Source File: DragAndDropPanel.java From Briss-2.0 with GNU General Public License v3.0 | 5 votes |
private void init(ImageIcon icon, ActionListener actionListener) { BoxLayout boxLayout = new BoxLayout(this, BoxLayout.PAGE_AXIS); setLayout(boxLayout); JLabel dndText = new JLabel(icon);//"Drag and drop your PDF file here"); dndText.setAlignmentX(Component.CENTER_ALIGNMENT); loadButton = new JButton("Load file"); loadButton.addActionListener(actionListener); loadButton.setAlignmentX(Component.CENTER_ALIGNMENT); loadButton.setPreferredSize(new Dimension(100, 50)); add(Box.createVerticalGlue()); add(dndText); add(Box.createRigidArea(new Dimension(0, 40))); add(loadButton); add(Box.createVerticalGlue()); }
Example 8
Source File: RoleSetPage.java From ganttproject with GNU General Public License v3.0 | 5 votes |
@Override public Component getComponent() { Box domainBox = new Box(BoxLayout.PAGE_AXIS); JLabel label = new JLabel(GanttLanguage.getInstance().getText("chooseRoleSets")); final JList roleSetsList = new JList(myListModel); roleSetsList.setCellRenderer(myListModel.getCellRenderer()); roleSetsList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int index = roleSetsList.locationToIndex(e.getPoint()); myListModel.toggle(index); } }); roleSetsList.setAlignmentX(0); label.setLabelFor(roleSetsList); label.setAlignmentX(0); domainBox.add(label); domainBox.add(Box.createVerticalStrut(5)); domainBox.add(roleSetsList); JPanel result = new JPanel(new BorderLayout()); result.add(domainBox, BorderLayout.CENTER); // result.setBorder(LineBorder.createBlackLineBorder()); return result; }
Example 9
Source File: BoxLayoutSupport.java From netbeans with Apache License 2.0 | 4 votes |
/** Since BoxLayout is not a bean, we must specify its properties * explicitly. This method is called from getPropertySets() implementation * to obtain the default property set for the layout (assuming there's only * one property set). So it woul be also possible to override (more * generally) getPropertySets() instead. * @return array of properties of the layout manager */ @Override protected FormProperty[] getProperties() { if (properties == null) { // we cannot use RADProperty because "axis" is not a real // bean property - we must create a special FormProperty properties = new FormProperty[1]; properties[0] = new FormProperty( PROP_AXIS, Integer.TYPE, getBundle().getString("PROP_axis"), // NOI18N getBundle().getString("HINT_axis")) // NOI18N { @Override public Object getTargetValue() { return new Integer(axis); } @Override public void setTargetValue(Object value) { int ax = ((Integer)value).intValue(); if (ax == BoxLayout.X_AXIS || ax == BoxLayout.Y_AXIS || ax == BoxLayout.LINE_AXIS || ax == BoxLayout.PAGE_AXIS) { axis = ax; } } @Override public boolean supportsDefaultValue() { return true; } @Override public Object getDefaultValue() { return new Integer(BoxLayout.LINE_AXIS); } @Override public PropertyEditor getExpliciteEditor() { return new BoxAxisEditor(); } }; // [!!] // properties[0].setPropertyContext( // new FormPropertyContext.DefaultImpl(getContainer().getFormModel())); } return properties; }
Example 10
Source File: ConnectionErrorDlg.java From netbeans with Apache License 2.0 | 4 votes |
private ConnectionErrorDlg(Segment[] segments) { super(BoxLayout.PAGE_AXIS); initComponents(segments); }
Example 11
Source File: QuickSearchComboBar.java From netbeans with Apache License 2.0 | 4 votes |
public static Issue selectIssue(String message, Repository repository, JPanel caller, HelpCtx helpCtx) { QuickSearchComboBar bar = new QuickSearchComboBar(caller); bar.setRepository(repository); bar.setAlignmentX(0f); bar.setMaximumSize(new Dimension(Short.MAX_VALUE, bar.getPreferredSize().height)); JPanel panel = new JPanel(); BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS); panel.setLayout(layout); JLabel label = new JLabel(); Mnemonics.setLocalizedText(label, message); panel.add(label); label.setLabelFor(bar.getIssueComponent()); LayoutStyle layoutStyle = LayoutStyle.getInstance(); int gap = layoutStyle.getPreferredGap(label, bar, LayoutStyle.ComponentPlacement.RELATED, SwingConstants.SOUTH, panel); panel.add(Box.createVerticalStrut(gap)); panel.add(bar); panel.add(Box.createVerticalStrut(gap)); ResourceBundle bundle = NbBundle.getBundle(QuickSearchComboBar.class); JLabel hintLabel = new JLabel(bundle.getString("MSG_SelectIssueHint")); // NOI18N hintLabel.setEnabled(false); panel.add(hintLabel); panel.add(Box.createVerticalStrut(80)); panel.setBorder(BorderFactory.createEmptyBorder( layoutStyle.getContainerGap(panel, SwingConstants.NORTH, null), layoutStyle.getContainerGap(panel, SwingConstants.WEST, null), 0, layoutStyle.getContainerGap(panel, SwingConstants.EAST, null))); panel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_IssueSelector")); Issue issue = null; JButton ok = new JButton(bundle.getString("LBL_Select")); // NOI18N ok.getAccessibleContext().setAccessibleDescription(ok.getText()); JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N cancel.getAccessibleContext().setAccessibleDescription(cancel.getText()); DialogDescriptor descriptor = new DialogDescriptor( panel, bundle.getString("LBL_Issues"), // NOI18N true, NotifyDescriptor.OK_CANCEL_OPTION, ok, null); descriptor.setOptions(new Object [] {ok, cancel}); descriptor.setHelpCtx(helpCtx); DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true); if (descriptor.getValue() == ok) { issue = bar.getIssue(); } return issue; }
Example 12
Source File: MarvinAttributesPanel.java From marvinproject with GNU Lesser General Public License v3.0 | 4 votes |
public MarvinAttributesPanel(){ super(BoxLayout.PAGE_AXIS); hashComponents = new Hashtable<String, MarvinPluginWindowComponent>(10,5); newComponentRow(); }
Example 13
Source File: ToolAdapterEditorDialog.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
@Override protected JPanel createVariablesPanel() { JPanel variablesBorderPanel = new JPanel(); BoxLayout layout = new BoxLayout(variablesBorderPanel, BoxLayout.PAGE_AXIS); variablesBorderPanel.setLayout(layout); variablesBorderPanel.setBorder(BorderFactory.createTitledBorder(Bundle.CTL_Panel_SysVar_Border_TitleText())); AbstractButton addVariableButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false); addVariableButton.setText(Bundle.CTL_Button_Add_Variable_Text()); addVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT); addVariableButton.setMaximumSize(new Dimension(150, controlHeight)); AbstractButton addDependentVariableButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false); addDependentVariableButton.setText(Bundle.CTL_Button_Add_PDVariable_Text()); addDependentVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT); addDependentVariableButton.setMaximumSize(new Dimension(250, controlHeight)); JPanel buttonsPannel = new JPanel(new SpringLayout()); buttonsPannel.add(addVariableButton); buttonsPannel.add(addDependentVariableButton); SpringUtilities.makeCompactGrid(buttonsPannel, 1, 2, 0, 0, 0, 0); buttonsPannel.setAlignmentX(Component.LEFT_ALIGNMENT); variablesBorderPanel.add(buttonsPannel); varTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); varTable.setRowHeight(20); JScrollPane scrollPane = new JScrollPane(varTable); scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT); variablesBorderPanel.add(scrollPane); variablesBorderPanel.setAlignmentX(Component.LEFT_ALIGNMENT); Dimension variablesPanelDimension = new Dimension((formWidth - 3 * DEFAULT_PADDING) / 2 - 2 * DEFAULT_PADDING, 130); variablesBorderPanel.setMinimumSize(variablesPanelDimension); variablesBorderPanel.setMaximumSize(variablesPanelDimension); variablesBorderPanel.setPreferredSize(variablesPanelDimension); addVariableButton.addActionListener(e -> { newOperatorDescriptor.getVariables().add(new SystemVariable("key", "")); varTable.revalidate(); }); addDependentVariableButton.addActionListener(e -> { newOperatorDescriptor.getVariables().add(new SystemDependentVariable("key", "")); varTable.revalidate(); }); return variablesBorderPanel; }
Example 14
Source File: ToolAdapterTabbedEditorDialog.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
@Override protected JPanel createVariablesPanel() { JPanel variablesBorderPanel = new JPanel(); BoxLayout layout = new BoxLayout(variablesBorderPanel, BoxLayout.PAGE_AXIS); variablesBorderPanel.setLayout(layout); AbstractButton addVariableButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false); addVariableButton.setText(Bundle.CTL_Button_Add_Variable_Text()); addVariableButton.setMaximumSize(new Dimension(150, controlHeight)); addVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT); AbstractButton addDependentVariableButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false); addDependentVariableButton.setText(Bundle.CTL_Button_Add_PDVariable_Text()); addDependentVariableButton.setMaximumSize(new Dimension(250, controlHeight)); addDependentVariableButton.setAlignmentX(Component.LEFT_ALIGNMENT); JPanel buttonsPannel = new JPanel(new SpringLayout()); buttonsPannel.add(addVariableButton); buttonsPannel.add(addDependentVariableButton); SpringUtilities.makeCompactGrid(buttonsPannel, 1, 2, 0, 0, 0, 0); buttonsPannel.setAlignmentX(Component.LEFT_ALIGNMENT); variablesBorderPanel.add(buttonsPannel); varTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); varTable.setRowHeight(controlHeight); int widths[] = {controlHeight, 3 * controlHeight, 10 * controlHeight}; for (int i = 0; i < widths.length; i++) { TableColumn column = varTable.getColumnModel().getColumn(i); column.setPreferredWidth(widths[i]); column.setWidth(widths[i]); } JScrollPane scrollPane = new JScrollPane(varTable); scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT); variablesBorderPanel.add(scrollPane); variablesBorderPanel.setAlignmentX(Component.LEFT_ALIGNMENT); Dimension variablesPanelDimension = new Dimension((formWidth - 3 * DEFAULT_PADDING) / 2 - 2 * DEFAULT_PADDING, 130); variablesBorderPanel.setMinimumSize(variablesPanelDimension); variablesBorderPanel.setMaximumSize(variablesPanelDimension); variablesBorderPanel.setPreferredSize(variablesPanelDimension); addVariableButton.addActionListener(e -> { newOperatorDescriptor.getVariables().add(new SystemVariable("key", "")); varTable.revalidate(); }); addDependentVariableButton.addActionListener(e -> { newOperatorDescriptor.getVariables().add(new SystemDependentVariable("key", "")); varTable.revalidate(); }); return variablesBorderPanel; }