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:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
public class HolidayBorderPanel extends java.awt.Panel
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
alignment
static int
CENTER
Center alignment.private java.awt.Color
color
static int
DEFAULT_ALIGNMENT
Default alignment (LEFT).static java.awt.Color
DEFAULT_COLOR
Default color (black).static java.awt.Font
DEFAULT_FONT
Default font (TimesRoman,PLAIN,14).static int
DEFAULT_GAP
Default gap between border and contained component (5).static int
DEFAULT_IN_THICKNESS
Default thickness for etched-in borders (10).static int
DEFAULT_LOWERED_THICKNESS
Default thickness for lowered borders (2).static int
DEFAULT_OUT_THICKNESS
Default thickness for etched-out borders (10).static int
DEFAULT_RAISED_THICKNESS
Default thickness for raised borders (2).static int
DEFAULT_SOLID_THICKNESS
Default thickness for solid borders (4).static int
DEFAULT_STYLE
Default style (IN).static int
DEFAULT_THICKNESS
Default thickness (10).private java.awt.Font
font
private int
gap
static int
IN
An etched in border.static int
LEFT
Left alignment.static int
LOWERED
A lowered border.static int
OUT
An etched out border.static int
RAISED
A raised border.static int
RIGHT
Right alignment.private static long
serialVersionUID
For serializationstatic int
SOLID
Solid border.private int
style
private java.lang.String
text
private int
thickness
-
Constructor Summary
Constructors Constructor Description HolidayBorderPanel()
Constructor.HolidayBorderPanel(int style)
Constructor.HolidayBorderPanel(int style, int thickness)
Constructor.HolidayBorderPanel(java.awt.Color color, int thickness)
Constructor.HolidayBorderPanel(java.lang.String text)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAlignment()
Gets the text alignment.java.awt.Color
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.java.awt.Insets
getInsets()
Returns the insets of this panel..int
getStyle()
Gets the style of the borderjava.lang.String
getText()
Gets the text.java.awt.Font
getTextFont()
Gets the font of the text.int
getThickness()
Gets the thickness of the border.void
paint(java.awt.Graphics g)
Repaints the border.HolidayBorderPanel
setAlignment(int alignment)
Sets the text alignment.HolidayBorderPanel
setColor(java.awt.Color color)
Sets the current color for SOLID borders and the caption text color for etched borders.HolidayBorderPanel
setGap(int gap)
Sets the gap between the border and the contained Component.HolidayBorderPanel
setStyle(int style)
Sets the style of the borderHolidayBorderPanel
setText(java.lang.String text)
Sets the text.HolidayBorderPanel
setTextFont(java.awt.Font font)
Sets the font.HolidayBorderPanel
setThickness(int thickness)
Sets the thickness of the border.java.lang.String
toString()
Returns the settings of this HolidayBorderPanel instance as a string.-
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 Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization- See Also:
- Constant Field Values
-
SOLID
public static final int SOLID
Solid border.- See Also:
- Constant Field Values
-
RAISED
public static final int RAISED
A raised border.- See Also:
- Constant Field Values
-
LOWERED
public static final int LOWERED
A lowered border.- See Also:
- Constant Field Values
-
IN
public static final int IN
An etched in border.- See Also:
- Constant Field Values
-
OUT
public static final int OUT
An etched out border.- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
Left alignment.- See Also:
- Constant Field Values
-
CENTER
public static final int CENTER
Center alignment.- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
Right alignment.- See Also:
- Constant Field Values
-
DEFAULT_STYLE
public static final int DEFAULT_STYLE
Default style (IN).- See Also:
- Constant Field Values
-
DEFAULT_THICKNESS
public static final int DEFAULT_THICKNESS
Default thickness (10).- See Also:
- Constant Field Values
-
DEFAULT_SOLID_THICKNESS
public static final int DEFAULT_SOLID_THICKNESS
Default thickness for solid borders (4).- See Also:
- Constant Field Values
-
DEFAULT_RAISED_THICKNESS
public static final int DEFAULT_RAISED_THICKNESS
Default thickness for raised borders (2).- See Also:
- Constant Field Values
-
DEFAULT_LOWERED_THICKNESS
public static final int DEFAULT_LOWERED_THICKNESS
Default thickness for lowered borders (2).- See Also:
- Constant Field Values
-
DEFAULT_IN_THICKNESS
public static final int DEFAULT_IN_THICKNESS
Default thickness for etched-in borders (10).- See Also:
- Constant Field Values
-
DEFAULT_OUT_THICKNESS
public static final int DEFAULT_OUT_THICKNESS
Default thickness for etched-out borders (10).- See Also:
- Constant Field Values
-
DEFAULT_GAP
public static final int DEFAULT_GAP
Default gap between border and contained component (5).- See Also:
- Constant Field Values
-
DEFAULT_COLOR
public static final java.awt.Color DEFAULT_COLOR
Default color (black). Applies to SOLID and etched borders.
-
DEFAULT_FONT
public static final java.awt.Font DEFAULT_FONT
Default font (TimesRoman,PLAIN,14). Only applies to etched borders.
-
DEFAULT_ALIGNMENT
public static final int DEFAULT_ALIGNMENT
Default alignment (LEFT). Only applies to etched borders.- See Also:
- Constant Field Values
-
style
private int style
-
thickness
private int thickness
-
gap
private int gap
-
color
private java.awt.Color color
-
font
private java.awt.Font font
-
text
private java.lang.String text
-
alignment
private int alignment
-
-
Constructor Detail
-
HolidayBorderPanel
public HolidayBorderPanel()
Constructor. Makes default border.
-
HolidayBorderPanel
public HolidayBorderPanel(java.lang.String text)
Constructor. Makes an etched IN border with given text caption.- Parameters:
text
- Text caption
-
HolidayBorderPanel
public HolidayBorderPanel(java.awt.Color color, int thickness)
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 Detail
-
getInsets
public java.awt.Insets getInsets()
Returns the insets of this panel..- Overrides:
getInsets
in classjava.awt.Container
-
setStyle
public HolidayBorderPanel setStyle(int style)
Sets the style of the border- Parameters:
style
- The new style.
-
getStyle
public int getStyle()
Gets the style of the border
-
setThickness
public HolidayBorderPanel setThickness(int thickness)
Sets the thickness of the border.- Parameters:
thickness
- The new thickness
-
getThickness
public int getThickness()
Gets the thickness of the border.
-
setGap
public HolidayBorderPanel setGap(int gap)
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
public HolidayBorderPanel setColor(java.awt.Color color)
Sets the current color for SOLID borders and the caption text color for etched borders.- Parameters:
color
- The new color.
-
getColor
public java.awt.Color getColor()
Gets the current color for SOLID borders and the caption text color for etched borders.
-
setTextFont
public HolidayBorderPanel setTextFont(java.awt.Font font)
Sets the font. Only applies to etched borders.
-
getTextFont
public java.awt.Font getTextFont()
Gets the font of the text. Only applies to etched borders.
-
setText
public HolidayBorderPanel setText(java.lang.String text)
Sets the text. Only applies to etched borders.- Parameters:
text
- The new text.
-
getText
public java.lang.String getText()
Gets the text. Only applies to etched borders.
-
setAlignment
public HolidayBorderPanel setAlignment(int alignment)
Sets the text alignment. Only applies to etched borders.- Parameters:
alignment
- The new alignment.
-
getAlignment
public int getAlignment()
Gets the text alignment.
-
paint
public void paint(java.awt.Graphics g)
Repaints the border.- Overrides:
paint
in classjava.awt.Container
- Parameters:
g
- The graphics context.
-
toString
public java.lang.String toString()
Returns the settings of this HolidayBorderPanel instance as a string.- Overrides:
toString
in classjava.awt.Component
-
-