List of usage examples for javax.swing BoxLayout PAGE_AXIS
int PAGE_AXIS
To view the source code for javax.swing BoxLayout PAGE_AXIS.
Click Source Link
From source file:com.idealista.solrmeter.view.statistic.PieChartPanel.java
@Inject public PieChartPanel(TimeRangeStatistic timeRangeStatistic) { super();/*from w w w. ja v a 2 s.c o m*/ setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); this.timeRangeStatistic = timeRangeStatistic; this.pieDataset = new DefaultPieDataset(); this.add(this.createChartPanel()); this.add(this.createCustomizePanel()); }
From source file:components.ListDialogRunner.java
public static JPanel createUI() { //Create the labels. JLabel intro = new JLabel("The chosen name:"); final JLabel name = new JLabel(names[1]); intro.setLabelFor(name);/*from ww w .j a v a 2 s .c o m*/ //Use a wacky font if it exists. If not, this falls //back to a font we know exists. name.setFont(getAFont()); //Create the button. final JButton button = new JButton("Pick a new name..."); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String selectedName = ListDialog.showDialog(frame, button, "Baby names ending in O:", "Name Chooser", names, name.getText(), "Cosmo "); name.setText(selectedName); } }); //Create the panel we'll return and set up the layout. JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 10, 20)); intro.setAlignmentX(JComponent.CENTER_ALIGNMENT); name.setAlignmentX(JComponent.CENTER_ALIGNMENT); button.setAlignmentX(JComponent.CENTER_ALIGNMENT); //Add the labels to the content pane. panel.add(intro); panel.add(Box.createVerticalStrut(5)); //extra space panel.add(name); //Add a vertical spacer that also guarantees us a minimum width: panel.add(Box.createRigidArea(new Dimension(150, 10))); //Add the button. panel.add(button); return panel; }
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);/*from w w w. j a v a 2 s .c om*/ 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:be.fedict.eid.tsl.tool.SignSelectPkcs11FinishablePanel.java
@Override public Component getComponent() { LOG.debug("get component"); if (null == this.component) { /*/*from w ww.j a v a 2 s. com*/ * 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: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:CoordinatesDemo.java
private void buildUI(Container container) { container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); CoordinateArea coordinateArea = new CoordinateArea(this); container.add(coordinateArea);// w w w . j a va 2 s.co m label = new JLabel(); resetLabel(); container.add(label); coordinateArea.setAlignmentX(Component.LEFT_ALIGNMENT); label.setAlignmentX(Component.LEFT_ALIGNMENT); // redundant }
From source file: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);/*from w w w . ja v a2s. c om*/ 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:layout.BoxLayoutDemo2.java
public void populateContentPane(Container contentPane) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); //Create the rectangles. int shortSideSize = 15; for (int i = 0; i < NUM_COMPONENTS; i++) { if (sizeIsRandom) { shortSideSize = (int) (30.0 * Math.random()) + 30; } else {/*from ww w. j av a 2s. c o m*/ shortSideSize += 10; } bldComponent[i] = new BLDComponent(xAlignment[i], hue[i], shortSideSize, restrictSize, sizeIsRandom, String.valueOf(i)); panel.add(bldComponent[i]); } //Create the instructions. JLabel label = new JLabel("Click a rectangle to " + "change its X alignment."); JCheckBox cb = new JCheckBox("Restrict maximum rectangle size."); cb.setSelected(restrictSize); cb.addItemListener(this); panel.setBorder(BorderFactory.createLineBorder(Color.red)); Box box = Box.createVerticalBox(); box.add(label); box.add(cb); contentPane.add(panel, BorderLayout.CENTER); contentPane.add(box, BorderLayout.PAGE_END); }
From source file:SwingTypeTester8.java
private void initComponents() { handler = new CharacterEventHandler(); producer = new RandomCharacterGenerator(); producer.setDone(true);/*from w ww. jav a 2 s . co m*/ producer.start(); displayCanvas = new AnimatedCharacterDisplayCanvas(producer); feedbackCanvas = new CharacterDisplayCanvas(this); quitButton = new JButton(); startButton = new JButton(); stopButton = new JButton(); score = new ScoreLabel(producer, this); Container pane = getContentPane(); JPanel p1 = new JPanel(); p1.setLayout(new BoxLayout(p1, BoxLayout.PAGE_AXIS)); p1.add(displayCanvas); p1.add(feedbackCanvas); JPanel p2 = new JPanel(); score.setText(" "); score.setFont(new Font("MONOSPACED", Font.BOLD, 30)); p2.add(score); startButton.setText("Start"); p2.add(startButton); stopButton.setText("Stop"); stopButton.setEnabled(false); p2.add(stopButton); quitButton.setText("Quit"); p2.add(quitButton); p1.add(p2); pane.add(p1, BorderLayout.NORTH); pack(); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { quit(); } }); feedbackCanvas.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent ke) { char c = ke.getKeyChar(); if (c != KeyEvent.CHAR_UNDEFINED) newCharacter((int) c); } }); startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { displayCanvas.setDone(false); producer.setDone(false); score.resetScore(); startButton.setEnabled(false); stopButton.setEnabled(true); feedbackCanvas.setEnabled(true); feedbackCanvas.requestFocus(); } }); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { startButton.setEnabled(true); stopButton.setEnabled(false); producer.setDone(true); displayCanvas.setDone(true); feedbackCanvas.setEnabled(false); } }); quitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { quit(); } }); }