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

public class HolidayBorderPanel extends 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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For serialization
      See Also:
    • SOLID

      public static final int SOLID
      Solid border.
      See Also:
    • RAISED

      public static final int RAISED
      A raised border.
      See Also:
    • LOWERED

      public static final int LOWERED
      A lowered border.
      See Also:
    • IN

      public static final int IN
      An etched in border.
      See Also:
    • OUT

      public static final int OUT
      An etched out border.
      See Also:
    • LEFT

      public static final int LEFT
      Left alignment.
      See Also:
    • CENTER

      public static final int CENTER
      Center alignment.
      See Also:
    • DEFAULT_STYLE

      public static final int DEFAULT_STYLE
      Default style (IN).
      See Also:
    • DEFAULT_THICKNESS

      public static final int DEFAULT_THICKNESS
      Default thickness (10).
      See Also:
    • DEFAULT_SOLID_THICKNESS

      public static final int DEFAULT_SOLID_THICKNESS
      Default thickness for solid borders (4).
      See Also:
    • DEFAULT_RAISED_THICKNESS

      public static final int DEFAULT_RAISED_THICKNESS
      Default thickness for raised borders (2).
      See Also:
    • DEFAULT_LOWERED_THICKNESS

      public static final int DEFAULT_LOWERED_THICKNESS
      Default thickness for lowered borders (2).
      See Also:
    • DEFAULT_IN_THICKNESS

      public static final int DEFAULT_IN_THICKNESS
      Default thickness for etched-in borders (10).
      See Also:
    • DEFAULT_OUT_THICKNESS

      public static final int DEFAULT_OUT_THICKNESS
      Default thickness for etched-out borders (10).
      See Also:
    • DEFAULT_GAP

      public static final int DEFAULT_GAP
      Default gap between border and contained component (5).
      See Also:
    • DEFAULT_COLOR

      public static final Color DEFAULT_COLOR
      Default color (black). Applies to SOLID and etched borders.
    • DEFAULT_FONT

      public static final 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:
    • style

      private int style
    • thickness

      private int thickness
    • gap

      private int gap
    • color

      private Color color
    • font

      private Font font
    • text

      private String text
    • alignment

      private int alignment
  • Constructor Details

    • HolidayBorderPanel

      public HolidayBorderPanel()
      Constructor. Makes default border.
    • HolidayBorderPanel

      public HolidayBorderPanel(String text)
      Constructor. Makes an etched IN border with given text caption.
      Parameters:
      text - Text caption
    • HolidayBorderPanel

      public HolidayBorderPanel(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 Details

    • getInsets

      public Insets getInsets()
      Returns the insets of this panel..
      Overrides:
      getInsets in class 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(Color color)
      Sets the current color for SOLID borders and the caption text color for etched borders.
      Parameters:
      color - The new color.
    • getColor

      public Color getColor()
      Gets the current color for SOLID borders and the caption text color for etched borders.
    • setTextFont

      public HolidayBorderPanel setTextFont(Font font)
      Sets the font. Only applies to etched borders.
    • getTextFont

      public Font getTextFont()
      Gets the font of the text. Only applies to etched borders.
    • setText

      public HolidayBorderPanel setText(String text)
      Sets the text. Only applies to etched borders.
      Parameters:
      text - The new text.
    • getText

      public 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(Graphics g)
      Repaints the border.
      Overrides:
      paint in class Container
      Parameters:
      g - The graphics context.
    • toString

      public String toString()
      Returns the settings of this HolidayBorderPanel instance as a string.
      Overrides:
      toString in class Component