Mercurial > hg > ccmieditor
comparison java/src/uk/ac/qmul/eecs/ccmi/utils/GridBagUtilities.java @ 3:9e67171477bc
PHANTOM Omni Heptic device release
author | Fiore Martin <fiore@eecs.qmul.ac.uk> |
---|---|
date | Wed, 25 Apr 2012 17:09:09 +0100 |
parents | 9418ab7b7f3f |
children | d66dd5880081 |
comparison
equal
deleted
inserted
replaced
2:4b2f975e35fa | 3:9e67171477bc |
---|---|
33 public GridBagUtilities(){ | 33 public GridBagUtilities(){ |
34 labelPad = DEFAULT_LABEL_PAD; | 34 labelPad = DEFAULT_LABEL_PAD; |
35 row = 0; | 35 row = 0; |
36 } | 36 } |
37 | 37 |
38 /** | |
39 * Provides the {@code GridBagConstrains} for a label. The label is placed | |
40 * on the left | |
41 * @param pad the pad between the label and the left margin of the component containing | |
42 * it | |
43 * @return a {@code GridBagConstrains} object to pass to the {@code add} method of {@code JComponent} | |
44 */ | |
38 public GridBagConstraints label(int pad){ | 45 public GridBagConstraints label(int pad){ |
39 GridBagConstraints c ; | 46 GridBagConstraints c ; |
40 | 47 |
41 c = new GridBagConstraints(); | 48 c = new GridBagConstraints(); |
42 c.anchor = GridBagConstraints.WEST; | 49 c.anchor = GridBagConstraints.WEST; |
45 c.insets = new java.awt.Insets(PAD,PAD,PAD,pad); | 52 c.insets = new java.awt.Insets(PAD,PAD,PAD,pad); |
46 | 53 |
47 return c; | 54 return c; |
48 } | 55 } |
49 | 56 |
57 /** | |
58 * Equivalent to {@link #label(int)} passing as argument the value previously | |
59 * set by {@link #setLabelPad(int)} or {@link #DEFAULT_LABEL_PAD} otherwise. | |
60 * @return | |
61 */ | |
50 public GridBagConstraints label(){ | 62 public GridBagConstraints label(){ |
51 return label(labelPad); | 63 return label(labelPad); |
52 } | 64 } |
53 | 65 |
66 /** | |
67 * Sets the value used by {@link #label()} as the pad between the label | |
68 * and the left margin of the component containing it | |
69 * @param labelPad the label pad | |
70 */ | |
54 public void setLabelPad(int labelPad){ | 71 public void setLabelPad(int labelPad){ |
55 this.labelPad = labelPad; | 72 this.labelPad = labelPad; |
56 } | 73 } |
57 | 74 |
58 public GridBagConstraints field(){ | 75 public GridBagConstraints field(){ |