com.alee.extended.painter
Class TitledBorderPainter<E extends javax.swing.JComponent>

java.lang.Object
  extended by com.alee.extended.painter.AbstractPainter<E>
      extended by com.alee.extended.painter.BorderPainter<E>
          extended by com.alee.extended.painter.TitledBorderPainter<E>
Type Parameters:
E - component type
All Implemented Interfaces:
Painter<E>, javax.swing.SwingConstants

public class TitledBorderPainter<E extends javax.swing.JComponent>
extends BorderPainter<E>
implements javax.swing.SwingConstants

Titled border painter.

Author:
Mikle Garin
See Also:
BorderPainter, AbstractPainter, Painter

Field Summary
protected  java.awt.Color background
          Painter background.
protected  double borderCenter
           
protected  double borderPosition
           
protected  java.awt.Shape borderShape
           
protected  boolean clipTitleBackground
          Whether to clip background under the title or not.
protected  boolean doClip
           
protected  boolean emptyTitle
           
protected  java.awt.FontMetrics fontMetrics
           
protected  java.awt.Color foreground
          Title foreground.
protected  int h
           
protected  int titleAlignment
          Title text alignment.
protected  int titleAreaHeight
           
protected  int titleBorderGap
          Gap between title and border line.
protected  int titleOffset
          Title side offset.
protected  TitlePosition titlePosition
          Title position relative to border.
protected  int titleSide
          Title text display side.
protected  java.lang.String titleText
          Title text.
protected  int titleWidth
           
protected  int titleX
           
protected  int titleY
           
protected  int w
          Runtime variables.
 
Fields inherited from class com.alee.extended.painter.BorderPainter
color, round, stroke, width
 
Fields inherited from class com.alee.extended.painter.AbstractPainter
listeners, margin, opaque, preferredSize
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
TitledBorderPainter()
           
TitledBorderPainter(java.lang.String titleText)
           
TitledBorderPainter(java.lang.String titleText, int titleAlignment)
           
TitledBorderPainter(java.lang.String titleText, int titleAlignment, int titleSide)
           
 
Method Summary
 java.awt.Color getBackground()
           
protected  java.awt.Shape getBorderClipShape()
           
protected  double getBorderPosition()
           
protected  java.awt.Shape getBorderShape()
           
 java.awt.Color getForeground()
           
 java.awt.Insets getMargin(E c)
          Returns margin required for visual data provided by this painter.
 java.awt.Dimension getPreferredSize(E c)
          Returns preferred size required for proper painting of visual data provided by this painter.
 int getTitleAlignment()
           
protected  int getTitleAreaHeight(E c)
           
 int getTitleBorderGap()
           
 int getTitleOffset()
           
 TitlePosition getTitlePosition()
           
 int getTitleSide()
           
 java.lang.String getTitleText()
           
protected  int getTitleX(E c)
           
protected  int getTitleY()
           
 boolean isClipTitleBackground()
           
protected  boolean isEmptyTitle()
           
 void paint(java.awt.Graphics2D g2d, java.awt.Rectangle bounds, E c)
          Paints visual data onto the component graphics.
 void setBackground(java.awt.Color background)
           
 void setClipTitleBackground(boolean clipTitleBackground)
           
 void setForeground(java.awt.Color foreground)
           
 void setTitleAlignment(int titleAlignment)
           
 void setTitleBorderGap(int titleBorderGap)
           
 void setTitleOffset(int titleOffset)
           
 void setTitlePosition(TitlePosition titlePosition)
           
 void setTitleSide(int titleSide)
           
 void setTitleText(java.lang.String titleText)
           
 
Methods inherited from class com.alee.extended.painter.BorderPainter
getBorderShape, getColor, getRound, getStroke, getWidth, setColor, setRound, setStroke, setWidth, updateStroke
 
Methods inherited from class com.alee.extended.painter.AbstractPainter
addPainterListener, install, isOpaque, p, removePainterListener, repaint, repaint, repaint, revalidate, setMargin, setMargin, setMargin, setOpaque, setPreferredSize, uninstall, updateAll, updateOpacity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

titleOffset

protected int titleOffset
Title side offset.


titleBorderGap

protected int titleBorderGap
Gap between title and border line.


titlePosition

protected TitlePosition titlePosition
Title position relative to border.


foreground

protected java.awt.Color foreground
Title foreground.


background

protected java.awt.Color background
Painter background.


clipTitleBackground

protected boolean clipTitleBackground
Whether to clip background under the title or not.


titleAlignment

protected int titleAlignment
Title text alignment.


titleSide

protected int titleSide
Title text display side.


titleText

protected java.lang.String titleText
Title text.


w

protected int w
Runtime variables.


h

protected int h

emptyTitle

protected boolean emptyTitle

fontMetrics

protected java.awt.FontMetrics fontMetrics

titleAreaHeight

protected int titleAreaHeight

titleWidth

protected int titleWidth

titleX

protected int titleX

titleY

protected int titleY

borderCenter

protected double borderCenter

borderPosition

protected double borderPosition

borderShape

protected java.awt.Shape borderShape

doClip

protected boolean doClip
Constructor Detail

TitledBorderPainter

public TitledBorderPainter()

TitledBorderPainter

public TitledBorderPainter(java.lang.String titleText)

TitledBorderPainter

public TitledBorderPainter(java.lang.String titleText,
                           int titleAlignment)

TitledBorderPainter

public TitledBorderPainter(java.lang.String titleText,
                           int titleAlignment,
                           int titleSide)
Method Detail

getTitleOffset

public int getTitleOffset()

setTitleOffset

public void setTitleOffset(int titleOffset)

getTitleBorderGap

public int getTitleBorderGap()

setTitleBorderGap

public void setTitleBorderGap(int titleBorderGap)

getTitleSide

public int getTitleSide()

setTitleSide

public void setTitleSide(int titleSide)

getTitleAlignment

public int getTitleAlignment()

setTitleAlignment

public void setTitleAlignment(int titleAlignment)

getTitlePosition

public TitlePosition getTitlePosition()

setTitlePosition

public void setTitlePosition(TitlePosition titlePosition)

getForeground

public java.awt.Color getForeground()

setForeground

public void setForeground(java.awt.Color foreground)

getBackground

public java.awt.Color getBackground()

setBackground

public void setBackground(java.awt.Color background)

isClipTitleBackground

public boolean isClipTitleBackground()

setClipTitleBackground

public void setClipTitleBackground(boolean clipTitleBackground)

getTitleText

public java.lang.String getTitleText()

setTitleText

public void setTitleText(java.lang.String titleText)

getMargin

public java.awt.Insets getMargin(E c)
Description copied from class: BorderPainter
Returns margin required for visual data provided by this painter. This margin is usually added to component's margin when the final component border is calculated.

Specified by:
getMargin in interface Painter<E extends javax.swing.JComponent>
Overrides:
getMargin in class BorderPainter<E extends javax.swing.JComponent>
Parameters:
c - component to process
Returns:
margin required for visual data provided by this painter

getPreferredSize

public java.awt.Dimension getPreferredSize(E c)
Description copied from class: BorderPainter
Returns preferred size required for proper painting of visual data provided by this painter. This should not take into account any sizes not related to this painter settings (for example text size on button).

Specified by:
getPreferredSize in interface Painter<E extends javax.swing.JComponent>
Overrides:
getPreferredSize in class BorderPainter<E extends javax.swing.JComponent>
Parameters:
c - component to process
Returns:
preferred size required for proper painting of visual data provided by this painter

paint

public void paint(java.awt.Graphics2D g2d,
                  java.awt.Rectangle bounds,
                  E c)
Description copied from class: BorderPainter
Paints visual data onto the component graphics. Provided graphics and component are taken directly from component UI paint method. Provided bounds are usually fake (zero location, component size) but in some cases it might be specified by componentUI.

Specified by:
paint in interface Painter<E extends javax.swing.JComponent>
Overrides:
paint in class BorderPainter<E extends javax.swing.JComponent>
Parameters:
g2d - component graphics
bounds - bounds for painter visual data
c - component to process

getTitleX

protected int getTitleX(E c)

getTitleY

protected int getTitleY()

getBorderPosition

protected double getBorderPosition()

getTitleAreaHeight

protected int getTitleAreaHeight(E c)

isEmptyTitle

protected boolean isEmptyTitle()

getBorderShape

protected java.awt.Shape getBorderShape()

getBorderClipShape

protected java.awt.Shape getBorderClipShape()