home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
VerticalLine.java
< prev
next >
Wrap
Text File
|
1998-10-02
|
3KB
|
98 lines
package symantec.itools.awt.shape;
import java.beans.PropertyVetoException;
import java.awt.Dimension;
import java.awt.Rectangle;
// 07/30/97 LAB Updated version to 1.1. Line can now be 1 pixel thick if it is
// in BEVEL_LINE or BEVEL_NONE mode.
// 08/13/97 LAB Overrode setBevelStyle to reshape the component to have a thickness
// of two pixels if the bevel style was rasied or lowered. Addresses Mac
// Bug #3571
// 10/01/98 EB Overrode getMinimumSize and getPreferredSize
/**
* This is a vertical line component.
* @version 1.2, October 1, 1998
* @author Symantec
*/
public class VerticalLine extends Rect
{
/**
* Constructs a default VerticalLine. The line width is 2.
*/
public VerticalLine()
{
width = 2;
}
/**
* Sets the border style of the shape.
* @see symantec.itools.awt.shape.Shape#getBevelStyle
*
* @exception PropertyVetoException
* if the specified property value is unacceptable
*/
public void setBevelStyle(int s) throws PropertyVetoException
{
if(style != s)
{
super.setBevelStyle(s);
Rectangle r = getBounds();
reshape(r.x, r.y, r.width == 1 ? 1 : 2, r.height);
validate();
}
}
/**
* Moves and/or resizes this component.
* This is a standard Java AWT method which gets called to move and/or
* resize this component. Components that are in containers with layout
* managers should not call this method, but rely on the layout manager
* instead.
*
* @param x horizontal position in the parent's coordinate space
* @param y vertical position in the parent's coordinate space
* @param width the new width
* @param height the new height
*/
public void reshape(int x, int y, int width, int height)
{
this.height = height;
//Allow a 1 pixel width if the bevel style is line or none.
if (width == 1 && (style == BEVEL_LINE || style == BEVEL_NONE))
this.width = 1;
else
this.width = 2;
super.reshape(x, y, this.width, height);
}
/**
* Returns the minimum dimensions to properly display this component.
* This is a standard Java AWT method which gets called to determine
* the minimum size of this component.
* @see #getPreferredSize
*/
public Dimension getMinimumSize()
{
return new Dimension(1, 2);
}
/**
* Returns the recommended dimensions to properly display this component.
* This is a standard Java AWT method which gets called to determine
* the recommended size of this component.
*
* @see java.awt.Component#minimumSize
*/
public Dimension getPreferredSize()
{
Dimension dim = getSize();
Dimension min = getMinimumSize();
return new Dimension(Math.max(dim.width, min.width), Math.max(dim.height, min.height));
}
}