source: src/main/java/genius/gui/panels/SpinnerPanel.java@ 61

Last change on this file since 61 was 8, checked in by Wouter Pasman, 6 years ago

#3 fix labels to fixed width of 120 px to get nicer layout. Removed right alignment of some comboboxes.

File size: 892 bytes
Line 
1package genius.gui.panels;
2
3import java.awt.BorderLayout;
4import java.awt.Component;
5import java.awt.Dimension;
6
7import javax.swing.JLabel;
8import javax.swing.JPanel;
9import javax.swing.JSpinner;
10import javax.swing.SpinnerModel;
11
12/**
13 * Spinner but with text label.
14 *
15 */
16@SuppressWarnings("serial")
17public class SpinnerPanel extends JPanel {
18
19 public SpinnerPanel(String labeltext, SpinnerModel model) {
20 setLayout(new BorderLayout());
21 JLabel label = new JLabel(labeltext);
22 add(label, BorderLayout.WEST);
23 label.setPreferredSize(new Dimension(120, 10));
24
25 JSpinner spinner = new JSpinner(model);
26 spinner.setMaximumSize(new Dimension(300, 30));
27 add(spinner, BorderLayout.CENTER);
28 // aligns the RIGHT side of the panel with the center of the parent.
29 // This limits the total width
30 setAlignmentX(Component.RIGHT_ALIGNMENT);
31 setMaximumSize(new Dimension(3000000, 30));
32 }
33
34}
Note: See TracBrowser for help on using the repository browser.