home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
VerticalSpinButtonPanel.java
< prev
next >
Wrap
Text File
|
1998-08-21
|
3KB
|
102 lines
package symantec.itools.awt.util.spinner;
import java.awt.Dimension;
// 06/03/97 LAB Changed the package to symantec.itools.awt.util.spinner.
// 08/27/97 LAB Now uses the preferred sizes of the direction buttons it contains when reshaping
// or when asked it's preferred size. Updated version to 1.1.
// 08/28/97 LAB Updated version to 1.1. Updated reshape. Implemented getPreferredSize and
// getMinimumSize.
/**
* This component groups two spin buttons vertically. It is used for
* spinners with the ORIENTATION_VERTICAL attribute set.
*
* @see Spinner
* @see symantec.itools.awt.Orientation
* @see symantec.itools.awt.Orientation#ORIENTATION_VERTICAL
*
* @version 1.1, August 27, 1997
* @author Symantec
*
*/
public class VerticalSpinButtonPanel extends SpinButtonPanel
{
/**
* Constructs the default VerticalSpinButtonPanel.
*/
public VerticalSpinButtonPanel()
{
}
/**
* 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.
*
* This method is overridden to reshape the two direction buttons.
*
* @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)
{
int halfHeight = height / 2;
int calcWidth = (int)(halfHeight * widthHeightRatio);
incButton.setBounds(0, 0, calcWidth, halfHeight);
decButton.setBounds(0, halfHeight, calcWidth, halfHeight);
super.reshape(x, y, width, height);
}
/**
* 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.
*/
public Dimension getPreferredSize()
{
int height = getSize().height;
return new Dimension((int)((height / 2) * widthHeightRatio), 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.
* It simply returns the results of a call to preferedSize().
*/
public Dimension getMinimumSize()
{
return getPreferredSize();
}
/**
* @deprecated
* @see #getPreferredSize().
*/
public Dimension preferredSize()
{
return getPreferredSize();
}
/**
* @deprecated
* @see #getMinimumSize().
*/
public Dimension minimumSize()
{
return getMinimumSize();
}
/**
* The ratio of width to height of the spinner buttons. i.e. width is <ratio> * height.
*/
protected double widthHeightRatio = 1.25;
}