Package com.ibm.icu.dev.demo.holiday
Class HolidayBorderPanel
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Panel
com.ibm.icu.dev.demo.holiday.HolidayBorderPanel
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
Various graphical borders. The border itself is a Panel so that it can
contain other Components (i.e. it borders something). You use the
HolidayBorderPanel like any other Panel: you set the layout that you prefer and
add Components to it. Beware that a null layout does not obey the insets
of the panel so if you use null layouts, adjust your measurements to
handle the border by calling insets().
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
static final int
Center alignment.private Color
static final int
Default alignment (LEFT).static final Color
Default color (black).static final Font
Default font (TimesRoman,PLAIN,14).static final int
Default gap between border and contained component (5).static final int
Default thickness for etched-in borders (10).static final int
Default thickness for lowered borders (2).static final int
Default thickness for etched-out borders (10).static final int
Default thickness for raised borders (2).static final int
Default thickness for solid borders (4).static final int
Default style (IN).static final int
Default thickness (10).private Font
private int
static final int
An etched in border.static final int
Left alignment.static final int
A lowered border.static final int
An etched out border.static final int
A raised border.static final int
Right alignment.private static final long
For serializationstatic final int
Solid border.private int
private String
private int
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.HolidayBorderPanel
(int style) Constructor.HolidayBorderPanel
(int style, int thickness) Constructor.HolidayBorderPanel
(Color color, int thickness) Constructor.HolidayBorderPanel
(String text) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the text alignment.getColor()
Gets the current color for SOLID borders and the caption text color for etched borders.int
getGap()
Gets the gap between the border and the contained Component.Returns the insets of this panel..int
getStyle()
Gets the style of the bordergetText()
Gets the text.Gets the font of the text.int
Gets the thickness of the border.void
Repaints the border.setAlignment
(int alignment) Sets the text alignment.Sets the current color for SOLID borders and the caption text color for etched borders.setGap
(int gap) Sets the gap between the border and the contained Component.setStyle
(int style) Sets the style of the borderSets the text.setTextFont
(Font font) Sets the font.setThickness
(int thickness) Sets the thickness of the border.toString()
Returns the settings of this HolidayBorderPanel instance as a string.Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization- See Also:
-
SOLID
public static final int SOLIDSolid border.- See Also:
-
RAISED
public static final int RAISEDA raised border.- See Also:
-
LOWERED
public static final int LOWEREDA lowered border.- See Also:
-
IN
public static final int INAn etched in border.- See Also:
-
OUT
public static final int OUTAn etched out border.- See Also:
-
LEFT
public static final int LEFTLeft alignment.- See Also:
-
CENTER
public static final int CENTERCenter alignment.- See Also:
-
RIGHT
public static final int RIGHTRight alignment.- See Also:
-
DEFAULT_STYLE
public static final int DEFAULT_STYLEDefault style (IN).- See Also:
-
DEFAULT_THICKNESS
public static final int DEFAULT_THICKNESSDefault thickness (10).- See Also:
-
DEFAULT_SOLID_THICKNESS
public static final int DEFAULT_SOLID_THICKNESSDefault thickness for solid borders (4).- See Also:
-
DEFAULT_RAISED_THICKNESS
public static final int DEFAULT_RAISED_THICKNESSDefault thickness for raised borders (2).- See Also:
-
DEFAULT_LOWERED_THICKNESS
public static final int DEFAULT_LOWERED_THICKNESSDefault thickness for lowered borders (2).- See Also:
-
DEFAULT_IN_THICKNESS
public static final int DEFAULT_IN_THICKNESSDefault thickness for etched-in borders (10).- See Also:
-
DEFAULT_OUT_THICKNESS
public static final int DEFAULT_OUT_THICKNESSDefault thickness for etched-out borders (10).- See Also:
-
DEFAULT_GAP
public static final int DEFAULT_GAPDefault gap between border and contained component (5).- See Also:
-
DEFAULT_COLOR
Default color (black). Applies to SOLID and etched borders. -
DEFAULT_FONT
Default font (TimesRoman,PLAIN,14). Only applies to etched borders. -
DEFAULT_ALIGNMENT
public static final int DEFAULT_ALIGNMENTDefault alignment (LEFT). Only applies to etched borders.- See Also:
-
style
private int style -
thickness
private int thickness -
gap
private int gap -
color
-
font
-
text
-
alignment
private int alignment
-
-
Constructor Details
-
HolidayBorderPanel
public HolidayBorderPanel()Constructor. Makes default border. -
HolidayBorderPanel
Constructor. Makes an etched IN border with given text caption.- Parameters:
text
- Text caption
-
HolidayBorderPanel
Constructor. Makes SOLID border with color and thickness given.- Parameters:
color
- The color for the border.thickness
- The thickness of the border.
-
HolidayBorderPanel
public HolidayBorderPanel(int style) Constructor. Makes a border of the given style with the default thickness for that style.- Parameters:
style
- The style for this border.
-
HolidayBorderPanel
public HolidayBorderPanel(int style, int thickness) Constructor. Makes border with given style and thickness.- Parameters:
style
- The style for this border.thickness
- The thickness for this border.
-
-
Method Details
-
getInsets
Returns the insets of this panel.. -
setStyle
Sets the style of the border- Parameters:
style
- The new style.
-
getStyle
public int getStyle()Gets the style of the border -
setThickness
Sets the thickness of the border.- Parameters:
thickness
- The new thickness
-
getThickness
public int getThickness()Gets the thickness of the border. -
setGap
Sets the gap between the border and the contained Component.- Parameters:
gap
- The new gap, in pixels.
-
getGap
public int getGap()Gets the gap between the border and the contained Component. -
setColor
Sets the current color for SOLID borders and the caption text color for etched borders.- Parameters:
color
- The new color.
-
getColor
Gets the current color for SOLID borders and the caption text color for etched borders. -
setTextFont
Sets the font. Only applies to etched borders. -
getTextFont
Gets the font of the text. Only applies to etched borders. -
setText
Sets the text. Only applies to etched borders.- Parameters:
text
- The new text.
-
getText
Gets the text. Only applies to etched borders. -
setAlignment
Sets the text alignment. Only applies to etched borders.- Parameters:
alignment
- The new alignment.
-
getAlignment
public int getAlignment()Gets the text alignment. -
paint
Repaints the border. -
toString
Returns the settings of this HolidayBorderPanel instance as a string.
-