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