2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / java / awt / GridBagConstraints.java
blob651cfdc199937561e9af950c97f199c3cf655737
1 // GridBagConstraints.java - Constraints for GridBag layout manager
3 /* Copyright (C) 2000, 2001, 2002 Free Software Foundation
5 This file is part of GNU Classpath.
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.
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.
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.
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.
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. */
40 package java.awt;
42 import java.io.Serializable;
44 /** This specifies the constraints for a component managed by the
45 * GridBagLayout layout manager. */
46 public class GridBagConstraints implements Cloneable, Serializable
48 static final long serialVersionUID = -1000070633030801713L;
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;
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;
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;
83 /**
84 * Position to where the first text line would end. Equals to NORTHEAST for
85 * horizontal left-to-right orientations.
87 public static final int FIRST_LINE_END = 24;
89 /**
90 * Position to where the first text line would start. Equals to NORTHWEST for
91 * horizontal left-to-right orientations.
93 public static final int FIRST_LINE_START = 23;
95 /**
96 * Position to where the last text line would end. Equals to SOUTHEAST for
97 * horizontal left-to-right orientations.
99 public static final int LAST_LINE_END = 26;
102 * Position to where the last text line would start. Equals to SOUTHWEST for
103 * horizontal left-to-right orientations.
105 public static final int LAST_LINE_START = 25;
108 * Position to where a text line would end. Equals to EAST for
109 * left-to-right orientations.
111 public static final int LINE_END = 22;
114 * Position to where a text line would start. Equals to WEST for
115 * left-to-right orientations.
117 public static final int LINE_START = 21;
120 * Position to where a page ends. Equals SOUTH for horizontal orientations.
122 public static final int PAGE_END = 20;
125 * Position to where a page starts. Equals NORTH for horizontal orientations.
127 public static final int PAGE_START = 19;
129 public int anchor;
130 public int fill;
131 public int gridheight;
132 public int gridwidth;
133 public int gridx;
134 public int gridy;
135 public Insets insets;
136 public int ipadx;
137 public int ipady;
138 public double weightx;
139 public double weighty;
141 /** Create a copy of this object. */
142 public Object clone ()
146 GridBagConstraints g = (GridBagConstraints) super.clone ();
147 g.insets = (Insets) insets.clone ();
148 return g;
150 catch (CloneNotSupportedException _)
152 // Can't happen.
153 return null;
157 /** Create a new GridBagConstraints object with the default
158 * parameters. */
159 public GridBagConstraints ()
161 this.anchor = CENTER;
162 this.fill = NONE;
163 this.gridx = RELATIVE;
164 this.gridy = RELATIVE;
165 this.gridwidth = 1;
166 this.gridheight = 1;
167 this.ipadx = 0;
168 this.ipady = 0;
169 this.insets = new Insets (0, 0, 0, 0);
170 this.weightx = 0;
171 this.weighty = 0;
174 /** Create a new GridBagConstraints object with the indicated
175 * parameters. */
176 public GridBagConstraints (int gridx, int gridy,
177 int gridwidth, int gridheight,
178 double weightx, double weighty,
179 int anchor, int fill,
180 Insets insets, int ipadx, int ipady)
182 this.anchor = anchor;
183 this.fill = fill;
184 this.gridx = gridx;
185 this.gridy = gridy;
186 this.gridwidth = gridwidth;
187 this.gridheight = gridheight;
188 this.ipadx = ipadx;
189 this.ipady = ipady;
190 this.insets = insets;
191 this.weightx = weightx;
192 this.weighty = weighty;