source: trunk/gcc/libjava/java/awt/GridBagConstraints.java

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.6 KB
Line 
1// GridBagConstraints.java - Constraints for GridBag layout manager
2
3/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
4
5This file is part of GNU Classpath.
6
7GNU Classpath is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU Classpath is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Classpath; see the file COPYING. If not, write to the
19Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2002111-1307 USA.
21
22Linking this library statically or dynamically with other modules is
23making a combined work based on this library. Thus, the terms and
24conditions of the GNU General Public License cover the whole
25combination.
26
27As a special exception, the copyright holders of this library give you
28permission to link this library with independent modules to produce an
29executable, regardless of the license terms of these independent
30modules, and to copy and distribute the resulting executable under
31terms of your choice, provided that you also meet, for each linked
32independent module, the terms and conditions of the license of that
33module. An independent module is a module which is not derived from
34or based on this library. If you modify this library, you may extend
35this exception to your version of the library, but you are not
36obligated to do so. If you do not wish to do so, delete this
37exception statement from your version. */
38
39
40package java.awt;
41
42import java.io.Serializable;
43
44/** This specifies the constraints for a component managed by the
45 * GridBagLayout layout manager. */
46public 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}
Note: See TracBrowser for help on using the repository browser.