List of usage examples for javax.swing BoxLayout BoxLayout
@ConstructorProperties({ "target", "axis" }) public BoxLayout(Container target, int axis)
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapsOverviewPanel.java
/** * Constructor.//from w w w . java2s . co m */ public GapsOverviewPanel(final AbstractTabView atv, final StationsDataProvider gcp) { this.atv = atv; this.gcp = gcp; this.jxp = new JXPanel(); this.jxp.setLayout(new GridLayout(2, 1)); final JXPanel highPanel = new JXPanel(); highPanel.setLayout(new BoxLayout(highPanel, BoxLayout.X_AXIS)); this.jxp.add(highPanel); this.tablePanel = new JXPanel(); this.tablePanel.setLayout(new BorderLayout()); highPanel.add(this.tablePanel); this.geomapPanel = new JXPanel(); this.geomapPanel.add(gcp.getMapPanel(new ArrayList<String>(), new ArrayList<String>(), false)); highPanel.add(this.geomapPanel); this.visualOverviewPanel = new JXPanel(); this.visualOverviewPanel.setLayout(new BorderLayout()); this.jxp.add(this.visualOverviewPanel); }
From source file:gui.SignUpGUI.java
public SignUpGUI() { super("Sign Up"); setResizable(false);/*from w w w. ja va2 s. c o m*/ setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); setSize(500, 250); JPanel panelServer = new JPanel(); addComponentToPanel(panelServer, labelServer, textFieldServer); add(panelServer); JPanel panelPort = new JPanel(); addComponentToPanel(panelPort, labelPort, textFieldPort); add(panelPort); JPanel panelID = new JPanel(); addComponentToPanel(panelID, labelID, textFieldID); add(panelID); JPanel panelPassword = new JPanel(); pwdFieldPwd.setEchoChar('*'); pwdFieldConfirmPwd.setEchoChar('*'); addComponentToPanel(panelPassword, labelPassword, pwdFieldPwd); add(panelPassword); JPanel panelConfirmPwd = new JPanel(); addComponentToPanel(panelConfirmPwd, labelConfirmPwd, pwdFieldConfirmPwd); add(panelConfirmPwd); JPanel panelNickname = new JPanel(); addComponentToPanel(panelNickname, labelNickname, textFieldNickname); add(panelNickname); JPanel panelButton = new JPanel(); panelButton.setLayout(new FlowLayout()); buttonSignUp.addActionListener(new SignUpActionListener()); panelButton.add(buttonSignUp); add(panelButton); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setVisible(true); }
From source file:components.ComboBoxDemo2.java
public ComboBoxDemo2() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z", "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" }; currentPattern = patternExamples[0]; //Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Enter the pattern string or"); JLabel patternLabel2 = new JLabel("select one from the list:"); JComboBox patternList = new JComboBox(patternExamples); patternList.setEditable(true);// w ww .ja v a 2s .c o m patternList.addActionListener(this); //Create the UI for displaying result. JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); //== LEFT result = new JLabel(" "); result.setForeground(Color.black); result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Lay out everything. JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternList.setAlignmentX(Component.LEFT_ALIGNMENT); patternPanel.add(patternList); JPanel resultPanel = new JPanel(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT); resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternPanel); add(Box.createRigidArea(new Dimension(0, 10))); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); }
From source file:MenuLayoutDemo.java
public JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); menuBar.setLayout(new BoxLayout(menuBar, BoxLayout.PAGE_AXIS)); menuBar.add(createMenu("Menu 1")); menuBar.add(createMenu("Menu 2")); menuBar.add(createMenu("Menu 3")); menuBar.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.BLACK)); return menuBar; }
From source file:gda.util.userOptions.UserOptionsDialog.java
/** * @param frame/*from ww w.j ava 2 s .c o m*/ * @param parent * @param options */ public UserOptionsDialog(JFrame frame, Component parent, UserOptions options) { super(frame, options.title, true); this.frame = frame; this.options = options; JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); label = new JLabel(options.title != null ? options.title : ""); label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); label.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel pane = makePane(); // pane.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); pane.setAlignmentX(Component.CENTER_ALIGNMENT); // pane.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); panel.add(label); panel.add(pane); JPanel btnPanel = new JPanel(); btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.X_AXIS)); JButton okButton = new JButton("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); JButton defButton = new JButton("Default"); defButton.addActionListener(this); JButton resetButton = new JButton("Reset"); resetButton.addActionListener(this); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(okButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(cancelButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(defButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(resetButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.add(btnPanel); getContentPane().add(panel); getRootPane().setDefaultButton(cancelButton); pack(); setLocationRelativeTo(parent); setVisible(true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
From source file:be.fedict.eid.tsl.tool.SignSelectPkcs11FinishablePanel.java
@Override public Component getComponent() { LOG.debug("get component"); if (null == this.component) { /*/* w w w . j a va2 s .c o m*/ * We need to return the same component each time, else the * validate() logic doesn't work as expected. */ JPanel panel = new JPanel(); BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.PAGE_AXIS); panel.setLayout(boxLayout); JPanel infoPanel = new JPanel(); infoPanel.add(new JLabel("Please select a PKCS#11 library.")); panel.add(infoPanel); JPanel browsePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); panel.add(browsePanel); browsePanel.add(new JLabel("PKCS#11 library:")); this.pkcs11TextField = new JTextField(30); browsePanel.add(this.pkcs11TextField); JButton browseButton = new JButton("Browse..."); browseButton.addActionListener(this); browsePanel.add(browseButton); JPanel slotIdxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); panel.add(slotIdxPanel); slotIdxPanel.add(new JLabel("Slot index:")); SpinnerModel spinnerModel = new SpinnerNumberModel(0, 0, 10, 1); this.slotIdxSpinner = new JSpinner(spinnerModel); slotIdxPanel.add(this.slotIdxSpinner); this.component = panel; } return this.component; }
From source file:components.ScrollDemo.java
public ScrollDemo() { setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); //Get the image to use. ImageIcon bee = createImageIcon("images/flyingBee.jpg"); //Create the row and column headers. columnView = new Rule(Rule.HORIZONTAL, true); rowView = new Rule(Rule.VERTICAL, true); if (bee != null) { columnView.setPreferredWidth(bee.getIconWidth()); rowView.setPreferredHeight(bee.getIconHeight()); } else {/*w w w. j a v a 2 s . co m*/ columnView.setPreferredWidth(320); rowView.setPreferredHeight(480); } //Create the corners. JPanel buttonCorner = new JPanel(); //use FlowLayout isMetric = new JToggleButton("cm", true); isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11)); isMetric.setMargin(new Insets(2, 2, 2, 2)); isMetric.addItemListener(this); buttonCorner.add(isMetric); //Set up the scroll pane. picture = new ScrollablePicture(bee, columnView.getIncrement()); JScrollPane pictureScrollPane = new JScrollPane(picture); pictureScrollPane.setPreferredSize(new Dimension(300, 250)); pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black)); pictureScrollPane.setColumnHeaderView(columnView); pictureScrollPane.setRowHeaderView(rowView); //Set the corners. //In theory, to support internationalization you would change //UPPER_LEFT_CORNER to UPPER_LEADING_CORNER, //LOWER_LEFT_CORNER to LOWER_LEADING_CORNER, and //UPPER_RIGHT_CORNER to UPPER_TRAILING_CORNER. In practice, //bug #4467063 makes that impossible (in 1.4, at least). pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner); pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, new Corner()); pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new Corner()); //Put it in this panel. add(pictureScrollPane); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:ec.display.chart.StatisticsChartPaneTab.java
/** * This method initializes jPanel /*from w ww.j ava2 s. co m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel(); jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.X_AXIS)); jPanel.add(Box.createHorizontalGlue()); jPanel.add(getPrintButton(), null); jPanel.add(getCloseButton(), null); } return jPanel; }
From source file:be.fedict.eid.tsl.tool.SignSelectCertificatePanel.java
public SignSelectCertificatePanel(SignSelectPkcs11FinishablePanel pkcs11Panel, TrustServiceList trustServiceList) { this.pkcs11Panel = pkcs11Panel; this.trustServiceList = trustServiceList; this.component = new JPanel(); BoxLayout boxLayout = new BoxLayout(this.component, BoxLayout.PAGE_AXIS); this.component.setLayout(boxLayout); this.component.add(new JLabel("Please select a certificate from the token: ")); DefaultListModel listModel = new DefaultListModel(); this.certificateList = new JList(listModel); this.component.add(new JScrollPane(this.certificateList)); }
From source file:gdt.jgui.base.JBasesPanel.java
/** * Default constructor * */ public JBasesPanel() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); }