Imported GNU Classpath 0.90
[official-gcc.git] / libjava / classpath / java / awt / GridBagConstraints.java
blob8d8b4fae534a92d6a3d03e0b9b59f99d3c4000ec
1 /* GridBagConstraints.java -- Constraints for GridBag layout manager
2 Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
4 This file is part of GNU Classpath.
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.
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.
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.
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.
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. */
39 package java.awt;
41 import java.io.Serializable;
43 /**
44 * This specifies the constraints for a component managed by the
45 * GridBagLayout layout manager.
47 public class GridBagConstraints implements Cloneable, Serializable
49 static final long serialVersionUID = -1000070633030801713L;
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;
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;
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;
84 /**
85 * Position to where the first text line would end. Equals to NORTHEAST for
86 * horizontal left-to-right orientations.
88 public static final int FIRST_LINE_END = 24;
90 /**
91 * Position to where the first text line would start. Equals to NORTHWEST for
92 * horizontal left-to-right orientations.
94 public static final int FIRST_LINE_START = 23;
96 /**
97 * Position to where the last text line would end. Equals to SOUTHEAST for
98 * horizontal left-to-right orientations.
100 public static final int LAST_LINE_END = 26;
103 * Position to where the last text line would start. Equals to SOUTHWEST for
104 * horizontal left-to-right orientations.
106 public static final int LAST_LINE_START = 25;
109 * Position to where a text line would end. Equals to EAST for
110 * left-to-right orientations.
112 public static final int LINE_END = 22;
115 * Position to where a text line would start. Equals to WEST for
116 * left-to-right orientations.
118 public static final int LINE_START = 21;
121 * Position to where a page ends. Equals SOUTH for horizontal orientations.
123 public static final int PAGE_END = 20;
126 * Position to where a page starts. Equals NORTH for horizontal orientations.
128 public static final int PAGE_START = 19;
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;
142 /** Create a copy of this object. */
143 public Object clone ()
147 GridBagConstraints g = (GridBagConstraints) super.clone ();
148 g.insets = (Insets) insets.clone ();
149 return g;
151 catch (CloneNotSupportedException _)
153 // Can't happen.
154 return null;
158 /** Create a new GridBagConstraints object with the default
159 * parameters. */
160 public GridBagConstraints ()
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;
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)
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;