org.universAAL.ui.gui.swing.bluesteelLAF.support
Class ComponentBorder

Package class diagram package ComponentBorder
java.lang.Object
  extended by javax.swing.border.AbstractBorder
      extended by org.universAAL.ui.gui.swing.bluesteelLAF.support.ComponentBorder
All Implemented Interfaces:
Serializable, Border

public class ComponentBorder
extends AbstractBorder

A Border that paints as title a Component. TODO: only checked default positions.

Author:
amedrano
See Also:
Serialized Form

Field Summary
static int ABOVE_BOTTOM
          Position the title above the border's bottom line.
static int ABOVE_TOP
          Position the title above the border's top line.
static int BELOW_BOTTOM
          Position the title below the border's bottom line.
static int BELOW_TOP
          Position the title below the border's top line.
protected  Border border
           
static int BOTTOM
          Position the title in the middle of the border's bottom line.
static int CENTER
          Position title text in the center of the border line.
static int DEFAULT_JUSTIFICATION
          Use the default justification for the title text.
static int DEFAULT_POSITION
          Use the default vertical orientation for the title text.
protected static int EDGE_SPACING
           
static int LEADING
          Position title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation.
static int LEFT
          Position title text at the left side of the border line.
static int RIGHT
          Position title text at the right side of the border line.
protected static int TEXT_INSET_H
           
protected static int TEXT_SPACING
           
protected  Component title
           
protected  int titleJustification
           
protected  int titlePosition
           
static int TOP
          Position the title in the middle of the border's top line.
static int TRAILING
          Position title text at the right side of the border line for left to right orientation, at the left side of the border line for right to left orientation.
 
Constructor Summary
ComponentBorder(Border border)
          Creates a TitledBorder instance with the specified border and an empty title.
ComponentBorder(Border border, Component title)
          Creates a TitledBorder instance with the specified border and title.
ComponentBorder(Border border, Component title, int titleJustification, int titlePosition)
          Creates a TitledBorder instance with the specified border, title, title-justification, and title-position.
ComponentBorder(Component title)
          Creates a TitledBorder instance.
 
Method Summary
static void addLabeledBorder(JLabel label, JComponent jc, ColorLAF color)
           
 int getBaseline(Component c, int width, int height)
          Returns the baseline.
 Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c)
          Returns an enum indicating how the baseline of the border changes as the size changes.
 Border getBorder()
          Returns the border of the titled border.
 Insets getBorderInsets(Component c)
          Returns the insets of the border.
 Insets getBorderInsets(Component c, Insets insets)
          Reinitialize the insets parameter with this Border's current Insets.
 Dimension getMinimumSize(Component c)
          Returns the minimum dimensions this border requires in order to fully display the border and title.
 Component getTitle()
          Returns the title of the titled border.
 int getTitleJustification()
          Returns the title-justification of the titled border.
 int getTitlePosition()
          Returns the title-position of the titled border.
 boolean isBorderOpaque()
          Returns whether or not the border is opaque.
 void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
          Paints the border for the specified component with the specified position and size.
 void setBorder(Border border)
          Sets the border of the titled border.
 void setTitle(Component title)
          Sets the title of the titled border.
 void setTitleJustification(int titleJustification)
          Sets the title-justification of the titled border.
 void setTitlePosition(int titlePosition)
          Sets the title-position of the titled border.
 
Methods inherited from class javax.swing.border.AbstractBorder
getInteriorRectangle, getInteriorRectangle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

title

protected Component title

border

protected Border border

titlePosition

protected int titlePosition

titleJustification

protected int titleJustification

DEFAULT_POSITION

public static final int DEFAULT_POSITION
Use the default vertical orientation for the title text.

See Also:
Constant Field Values

ABOVE_TOP

public static final int ABOVE_TOP
Position the title above the border's top line.

See Also:
Constant Field Values

TOP

public static final int TOP
Position the title in the middle of the border's top line.

See Also:
Constant Field Values

BELOW_TOP

public static final int BELOW_TOP
Position the title below the border's top line.

See Also:
Constant Field Values

ABOVE_BOTTOM

public static final int ABOVE_BOTTOM
Position the title above the border's bottom line.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Position the title in the middle of the border's bottom line.

See Also:
Constant Field Values

BELOW_BOTTOM

public static final int BELOW_BOTTOM
Position the title below the border's bottom line.

See Also:
Constant Field Values

DEFAULT_JUSTIFICATION

public static final int DEFAULT_JUSTIFICATION
Use the default justification for the title text.

See Also:
Constant Field Values

LEFT

public static final int LEFT
Position title text at the left side of the border line.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Position title text in the center of the border line.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Position title text at the right side of the border line.

See Also:
Constant Field Values

LEADING

public static final int LEADING
Position title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation.

See Also:
Constant Field Values

TRAILING

public static final int TRAILING
Position title text at the right side of the border line for left to right orientation, at the left side of the border line for right to left orientation.

See Also:
Constant Field Values

EDGE_SPACING

protected static final int EDGE_SPACING
See Also:
Constant Field Values

TEXT_SPACING

protected static final int TEXT_SPACING
See Also:
Constant Field Values

TEXT_INSET_H

protected static final int TEXT_INSET_H
See Also:
Constant Field Values
Constructor Detail

ComponentBorder

public ComponentBorder(Component title)
Creates a TitledBorder instance.

Parameters:
title - the title the border should display

ComponentBorder

public ComponentBorder(Border border)
Creates a TitledBorder instance with the specified border and an empty title.

Parameters:
border - the border

ComponentBorder

public ComponentBorder(Border border,
                       Component title)
Creates a TitledBorder instance with the specified border and title.

Parameters:
border - the border
title - the title the border should display

ComponentBorder

public ComponentBorder(Border border,
                       Component title,
                       int titleJustification,
                       int titlePosition)
Creates a TitledBorder instance with the specified border, title, title-justification, and title-position.

Parameters:
border - the border
title - the title the border should display
titleJustification - the justification for the title
titlePosition - the position for the title
Method Detail

paintBorder

public void paintBorder(Component c,
                        Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Paints the border for the specified component with the specified position and size.

Specified by:
paintBorder in interface Border
Overrides:
paintBorder in class AbstractBorder
Parameters:
c - the component for which this border is being painted
g - the paint graphics
x - the x position of the painted border
y - the y position of the painted border
width - the width of the painted border
height - the height of the painted border

getBorderInsets

public Insets getBorderInsets(Component c)
Returns the insets of the border.

Specified by:
getBorderInsets in interface Border
Overrides:
getBorderInsets in class AbstractBorder
Parameters:
c - the component for which this border insets value applies

getBorderInsets

public Insets getBorderInsets(Component c,
                              Insets insets)
Reinitialize the insets parameter with this Border's current Insets.

Overrides:
getBorderInsets in class AbstractBorder
Parameters:
c - the component for which this border insets value applies
insets - the object to be reinitialized

isBorderOpaque

public boolean isBorderOpaque()
Returns whether or not the border is opaque.

Specified by:
isBorderOpaque in interface Border
Overrides:
isBorderOpaque in class AbstractBorder

getTitle

public Component getTitle()
Returns the title of the titled border.


getBorder

public Border getBorder()
Returns the border of the titled border.


getTitlePosition

public int getTitlePosition()
Returns the title-position of the titled border.


getTitleJustification

public int getTitleJustification()
Returns the title-justification of the titled border.


setTitle

public void setTitle(Component title)
Sets the title of the titled border. param title the title for the border


setBorder

public void setBorder(Border border)
Sets the border of the titled border.

Parameters:
border - the border

setTitlePosition

public void setTitlePosition(int titlePosition)
Sets the title-position of the titled border.

Parameters:
titlePosition - the position for the border

setTitleJustification

public void setTitleJustification(int titleJustification)
Sets the title-justification of the titled border.

Parameters:
titleJustification - the justification for the border

getMinimumSize

public Dimension getMinimumSize(Component c)
Returns the minimum dimensions this border requires in order to fully display the border and title.

Parameters:
c - the component where this border will be drawn

getBaseline

public int getBaseline(Component c,
                       int width,
                       int height)
Returns the baseline.

Overrides:
getBaseline in class AbstractBorder
Throws:
NullPointerException
IllegalArgumentException
Since:
1.6
See Also:
JComponent.getBaseline(int, int)

getBaselineResizeBehavior

public Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c)
Returns an enum indicating how the baseline of the border changes as the size changes.

Overrides:
getBaselineResizeBehavior in class AbstractBorder
Throws:
NullPointerException
Since:
1.6
See Also:
JComponent.getBaseline(int, int)

addLabeledBorder

public static void addLabeledBorder(JLabel label,
                                    JComponent jc,
                                    ColorLAF color)


Copyright © 2014 universAAL Consortium. All Rights Reserved.