home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
HorizontalSpinButtonPanel.java
< prev
next >
Wrap
Text File
|
1998-08-21
|
3KB
|
103 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 Removed unnecessary imports. 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.
// 10/12/97 LAB Changed reshape and getPreferredSize to follow changes with Spinner.java.
/**
* This component groups two spin buttons horizontally. It is used for
* spinners with the ORIENTATION_HORIZONTAL attribute set.
*
* @see Spinner
* @see symantec.itools.awt.Orientation
* @see symantec.itools.awt.Orientation#ORIENTATION_HORIZONTAL
*
* @version 1.1, August 27, 1997
* @author Symantec
*/
public class HorizontalSpinButtonPanel extends SpinButtonPanel
{
/**
* Constructs the default HorizontalSpinButtonPanel.
*/
public HorizontalSpinButtonPanel()
{
}
/**
* 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 calcDim = (int)(height * heightWidthRatio);
int yAdj = (height - calcDim) / 2;
incButton.setBounds(0, yAdj, calcDim, calcDim);
decButton.setBounds(calcDim, yAdj, calcDim, calcDim);
super.reshape(x, y, width + 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;
int calcDim = (int)(height * heightWidthRatio);
return new Dimension(calcDim + calcDim, 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 height to width of the spinner buttons. i.e. height is <ratio> * width.
*/
protected double heightWidthRatio = 0.75;
}