[18091] | 1 | /*
|
---|
| 2 | * Sun Public License Notice
|
---|
| 3 | *
|
---|
| 4 | * The contents of this file are subject to the Sun Public License
|
---|
| 5 | * Version 1.0 (the "License"). You may not use this file except in
|
---|
| 6 | * compliance with the License. A copy of the License is available at
|
---|
| 7 | * http://www.sun.com/
|
---|
| 8 | *
|
---|
| 9 | * The Original Code is NetBeans. The Initial Developer of the Original
|
---|
| 10 | * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
|
---|
| 11 | * Microsystems, Inc. All Rights Reserved.
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 | //package org.netbeans.lib.awtextra;
|
---|
| 15 |
|
---|
| 16 | package org.greenstone.gsdl3_extension.mat;
|
---|
| 17 |
|
---|
| 18 | import java.awt.Dimension;
|
---|
| 19 | import java.awt.Point;
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | /** An object that encapsulates position and (optionally) size for
|
---|
| 23 | * Absolute positioning of components.
|
---|
| 24 | *
|
---|
| 25 | * @see AbsoluteLayout
|
---|
| 26 | * @version 1.01, Aug 19, 1998
|
---|
| 27 | */
|
---|
| 28 | public class AbsoluteConstraints implements java.io.Serializable {
|
---|
| 29 | /** generated Serialized Version UID */
|
---|
| 30 | static final long serialVersionUID = 5261460716622152494L;
|
---|
| 31 |
|
---|
| 32 | /** The X position of the component */
|
---|
| 33 | public int x;
|
---|
| 34 | /** The Y position of the component */
|
---|
| 35 | public int y;
|
---|
| 36 | /** The width of the component or -1 if the component's preferred width should be used */
|
---|
| 37 | public int width = -1;
|
---|
| 38 | /** The height of the component or -1 if the component's preferred height should be used */
|
---|
| 39 | public int height = -1;
|
---|
| 40 |
|
---|
| 41 | /** Creates a new AbsoluteConstraints for specified position.
|
---|
| 42 | * @param pos The position to be represented by this AbsoluteConstraints
|
---|
| 43 | */
|
---|
| 44 | public AbsoluteConstraints(Point pos) {
|
---|
| 45 | this(pos.x, pos.y);
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | /** Creates a new AbsoluteConstraints for specified position.
|
---|
| 49 | * @param x The X position to be represented by this AbsoluteConstraints
|
---|
| 50 | * @param y The Y position to be represented by this AbsoluteConstraints
|
---|
| 51 | */
|
---|
| 52 | public AbsoluteConstraints(int x, int y) {
|
---|
| 53 | this.x = x;
|
---|
| 54 | this.y = y;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | /** Creates a new AbsoluteConstraints for specified position and size.
|
---|
| 58 | * @param pos The position to be represented by this AbsoluteConstraints
|
---|
| 59 | * @param size The size to be represented by this AbsoluteConstraints or null
|
---|
| 60 | * if the component's preferred size should be used
|
---|
| 61 | */
|
---|
| 62 | public AbsoluteConstraints(Point pos, Dimension size) {
|
---|
| 63 | this.x = pos.x;
|
---|
| 64 | this.y = pos.y;
|
---|
| 65 | if (size != null) {
|
---|
| 66 | this.width = size.width;
|
---|
| 67 | this.height = size.height;
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | /** Creates a new AbsoluteConstraints for specified position and size.
|
---|
| 72 | * @param x The X position to be represented by this AbsoluteConstraints
|
---|
| 73 | * @param y The Y position to be represented by this AbsoluteConstraints
|
---|
| 74 | * @param width The width to be represented by this AbsoluteConstraints or -1 if the
|
---|
| 75 | * component's preferred width should be used
|
---|
| 76 | * @param height The height to be represented by this AbsoluteConstraints or -1 if the
|
---|
| 77 | * component's preferred height should be used
|
---|
| 78 | */
|
---|
| 79 | public AbsoluteConstraints(int x, int y, int width, int height) {
|
---|
| 80 | this.x = x;
|
---|
| 81 | this.y = y;
|
---|
| 82 | this.width = width;
|
---|
| 83 | this.height = height;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | /** @return The X position represented by this AbsoluteConstraints */
|
---|
| 87 | public int getX() {
|
---|
| 88 | return x;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | /** @return The Y position represented by this AbsoluteConstraints */
|
---|
| 92 | public int getY() {
|
---|
| 93 | return y;
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | /** @return The width represented by this AbsoluteConstraints or -1 if the
|
---|
| 97 | * component's preferred width should be used
|
---|
| 98 | */
|
---|
| 99 | public int getWidth() {
|
---|
| 100 | return width;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | /** @return The height represented by this AbsoluteConstraints or -1 if the
|
---|
| 104 | * component's preferred height should be used
|
---|
| 105 | */
|
---|
| 106 | public int getHeight() {
|
---|
| 107 | return height;
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | public String toString() {
|
---|
| 111 | return super.toString() + " [x=" + x + ", y=" + y + ", width=" + width + ", height=" + height + "]";
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 |
|
---|