1 |
14 |
jlechner |
/* GridBagConstraints.java -- Constraints for GridBag layout manager
|
2 |
|
|
Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
|
3 |
|
|
|
4 |
|
|
This file is part of GNU Classpath.
|
5 |
|
|
|
6 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
9 |
|
|
any later version.
|
10 |
|
|
|
11 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
12 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
|
|
General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
18 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 |
|
|
02110-1301 USA.
|
20 |
|
|
|
21 |
|
|
Linking this library statically or dynamically with other modules is
|
22 |
|
|
making a combined work based on this library. Thus, the terms and
|
23 |
|
|
conditions of the GNU General Public License cover the whole
|
24 |
|
|
combination.
|
25 |
|
|
|
26 |
|
|
As a special exception, the copyright holders of this library give you
|
27 |
|
|
permission to link this library with independent modules to produce an
|
28 |
|
|
executable, regardless of the license terms of these independent
|
29 |
|
|
modules, and to copy and distribute the resulting executable under
|
30 |
|
|
terms of your choice, provided that you also meet, for each linked
|
31 |
|
|
independent module, the terms and conditions of the license of that
|
32 |
|
|
module. An independent module is a module which is not derived from
|
33 |
|
|
or based on this library. If you modify this library, you may extend
|
34 |
|
|
this exception to your version of the library, but you are not
|
35 |
|
|
obligated to do so. If you do not wish to do so, delete this
|
36 |
|
|
exception statement from your version. */
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
package java.awt;
|
40 |
|
|
|
41 |
|
|
import java.io.Serializable;
|
42 |
|
|
|
43 |
|
|
/**
|
44 |
|
|
* This specifies the constraints for a component managed by the
|
45 |
|
|
* GridBagLayout layout manager.
|
46 |
|
|
*/
|
47 |
|
|
public class GridBagConstraints implements Cloneable, Serializable
|
48 |
|
|
{
|
49 |
|
|
static final long serialVersionUID = -1000070633030801713L;
|
50 |
|
|
|
51 |
|
|
/** Fill in both directions. */
|
52 |
|
|
public static final int BOTH = 1;
|
53 |
|
|
/** Don't fill. */
|
54 |
|
|
public static final int NONE = 0;
|
55 |
|
|
/** Fill horizontally. */
|
56 |
|
|
public static final int HORIZONTAL = 2;
|
57 |
|
|
/** Fill vertically. */
|
58 |
|
|
public static final int VERTICAL = 3;
|
59 |
|
|
|
60 |
|
|
/** Position in the center. */
|
61 |
|
|
public static final int CENTER = 10;
|
62 |
|
|
/** Position to the east. */
|
63 |
|
|
public static final int EAST = 13;
|
64 |
|
|
/** Position to the north. */
|
65 |
|
|
public static final int NORTH = 11;
|
66 |
|
|
/** Position to the northeast. */
|
67 |
|
|
public static final int NORTHEAST = 12;
|
68 |
|
|
/** Position to the northwest. */
|
69 |
|
|
public static final int NORTHWEST = 18;
|
70 |
|
|
/** Position to the south. */
|
71 |
|
|
public static final int SOUTH = 15;
|
72 |
|
|
/** Position to the southeast. */
|
73 |
|
|
public static final int SOUTHEAST = 14;
|
74 |
|
|
/** Position to the southwest. */
|
75 |
|
|
public static final int SOUTHWEST = 16;
|
76 |
|
|
/** Position to the west. */
|
77 |
|
|
public static final int WEST = 17;
|
78 |
|
|
|
79 |
|
|
/** Occupy all remaining cells except last cell. */
|
80 |
|
|
public static final int RELATIVE = -1;
|
81 |
|
|
/** Occupy all remaining cells. */
|
82 |
|
|
public static final int REMAINDER = 0;
|
83 |
|
|
|
84 |
|
|
/**
|
85 |
|
|
* Position to where the first text line would end. Equals to NORTHEAST for
|
86 |
|
|
* horizontal left-to-right orientations.
|
87 |
|
|
*/
|
88 |
|
|
public static final int FIRST_LINE_END = 24;
|
89 |
|
|
|
90 |
|
|
/**
|
91 |
|
|
* Position to where the first text line would start. Equals to NORTHWEST for
|
92 |
|
|
* horizontal left-to-right orientations.
|
93 |
|
|
*/
|
94 |
|
|
public static final int FIRST_LINE_START = 23;
|
95 |
|
|
|
96 |
|
|
/**
|
97 |
|
|
* Position to where the last text line would end. Equals to SOUTHEAST for
|
98 |
|
|
* horizontal left-to-right orientations.
|
99 |
|
|
*/
|
100 |
|
|
public static final int LAST_LINE_END = 26;
|
101 |
|
|
|
102 |
|
|
/**
|
103 |
|
|
* Position to where the last text line would start. Equals to SOUTHWEST for
|
104 |
|
|
* horizontal left-to-right orientations.
|
105 |
|
|
*/
|
106 |
|
|
public static final int LAST_LINE_START = 25;
|
107 |
|
|
|
108 |
|
|
/**
|
109 |
|
|
* Position to where a text line would end. Equals to EAST for
|
110 |
|
|
* left-to-right orientations.
|
111 |
|
|
*/
|
112 |
|
|
public static final int LINE_END = 22;
|
113 |
|
|
|
114 |
|
|
/**
|
115 |
|
|
* Position to where a text line would start. Equals to WEST for
|
116 |
|
|
* left-to-right orientations.
|
117 |
|
|
*/
|
118 |
|
|
public static final int LINE_START = 21;
|
119 |
|
|
|
120 |
|
|
/**
|
121 |
|
|
* Position to where a page ends. Equals SOUTH for horizontal orientations.
|
122 |
|
|
*/
|
123 |
|
|
public static final int PAGE_END = 20;
|
124 |
|
|
|
125 |
|
|
/**
|
126 |
|
|
* Position to where a page starts. Equals NORTH for horizontal orientations.
|
127 |
|
|
*/
|
128 |
|
|
public static final int PAGE_START = 19;
|
129 |
|
|
|
130 |
|
|
public int anchor;
|
131 |
|
|
public int fill;
|
132 |
|
|
public int gridheight;
|
133 |
|
|
public int gridwidth;
|
134 |
|
|
public int gridx;
|
135 |
|
|
public int gridy;
|
136 |
|
|
public Insets insets;
|
137 |
|
|
public int ipadx;
|
138 |
|
|
public int ipady;
|
139 |
|
|
public double weightx;
|
140 |
|
|
public double weighty;
|
141 |
|
|
|
142 |
|
|
/** Create a copy of this object. */
|
143 |
|
|
public Object clone ()
|
144 |
|
|
{
|
145 |
|
|
try
|
146 |
|
|
{
|
147 |
|
|
GridBagConstraints g = (GridBagConstraints) super.clone ();
|
148 |
|
|
g.insets = (Insets) insets.clone ();
|
149 |
|
|
return g;
|
150 |
|
|
}
|
151 |
|
|
catch (CloneNotSupportedException _)
|
152 |
|
|
{
|
153 |
|
|
// Can't happen.
|
154 |
|
|
return null;
|
155 |
|
|
}
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
/** Create a new GridBagConstraints object with the default
|
159 |
|
|
* parameters. */
|
160 |
|
|
public GridBagConstraints ()
|
161 |
|
|
{
|
162 |
|
|
this.anchor = CENTER;
|
163 |
|
|
this.fill = NONE;
|
164 |
|
|
this.gridx = RELATIVE;
|
165 |
|
|
this.gridy = RELATIVE;
|
166 |
|
|
this.gridwidth = 1;
|
167 |
|
|
this.gridheight = 1;
|
168 |
|
|
this.ipadx = 0;
|
169 |
|
|
this.ipady = 0;
|
170 |
|
|
this.insets = new Insets (0, 0, 0, 0);
|
171 |
|
|
this.weightx = 0;
|
172 |
|
|
this.weighty = 0;
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
/** Create a new GridBagConstraints object with the indicated
|
176 |
|
|
* parameters. */
|
177 |
|
|
public GridBagConstraints (int gridx, int gridy,
|
178 |
|
|
int gridwidth, int gridheight,
|
179 |
|
|
double weightx, double weighty,
|
180 |
|
|
int anchor, int fill,
|
181 |
|
|
Insets insets, int ipadx, int ipady)
|
182 |
|
|
{
|
183 |
|
|
this.anchor = anchor;
|
184 |
|
|
this.fill = fill;
|
185 |
|
|
this.gridx = gridx;
|
186 |
|
|
this.gridy = gridy;
|
187 |
|
|
this.gridwidth = gridwidth;
|
188 |
|
|
this.gridheight = gridheight;
|
189 |
|
|
this.ipadx = ipadx;
|
190 |
|
|
this.ipady = ipady;
|
191 |
|
|
this.insets = insets;
|
192 |
|
|
this.weightx = weightx;
|
193 |
|
|
this.weighty = weighty;
|
194 |
|
|
}
|
195 |
|
|
}
|