com.alee.laf.panel
Class WebPanelUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.PanelUI
          extended by javax.swing.plaf.basic.BasicPanelUI
              extended by com.alee.laf.panel.WebPanelUI
All Implemented Interfaces:
PartialDecoration, ShapeProvider, Styleable, BorderMethods, SwingMethods

public class WebPanelUI
extends javax.swing.plaf.basic.BasicPanelUI
implements Styleable, ShapeProvider, BorderMethods, PartialDecoration

Custom UI for JPanel component.

Author:
Mikle Garin

Field Summary
protected  java.awt.Insets margin
           
protected  boolean paintBottom
           
protected  boolean paintBottomLine
           
protected  PanelPainter painter
          Component painter.
protected  boolean paintFocus
           
protected  boolean paintLeft
           
protected  boolean paintLeftLine
           
protected  boolean paintRight
           
protected  boolean paintRightLine
           
protected  boolean paintTop
           
protected  boolean paintTopLine
           
protected  javax.swing.JPanel panel
           
protected  java.beans.PropertyChangeListener propertyChangeListener
          Panel listeners.
protected  java.lang.String styleId
          Runtime variables.
protected  boolean undecorated
          Style settings.
 
Constructor Summary
WebPanelUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the WebPanelUI for the specified component.
 java.awt.Color getBorderColor()
          Returns decoration border color.
 java.awt.Stroke getBorderStroke()
          Returns decoration border stroke.
 java.awt.Color getDisabledBorderColor()
          Returns decoration disabled border color.
 java.awt.Insets getMargin()
          Returns panel margin.
 Painter getPainter()
          Returns panel painter.
 int getRound()
          Returns decoration corners rounding.
 float getShadeTransparency()
          Returns decoration shade transparency.
 int getShadeWidth()
          Returns decoration shade width.
 java.lang.String getStyleId()
          Returns component style ID.
 void installUI(javax.swing.JComponent c)
          Installs UI in the specified component.
 boolean isPaintBackground()
          Returns whether should paint decoration background or not.
 boolean isPaintBottom()
          Returns whether should paint bottom side or not.
 boolean isPaintBottomLine()
          Returns whether should paint bottom side line or not.
 boolean isPaintFocus()
          Returns whether focus should be painted or not.
 boolean isPaintLeft()
          Returns whether should paint left side or not.
 boolean isPaintLeftLine()
          Returns whether should paint left side line or not.
 boolean isPaintRight()
          Returns whether should paint right side or not.
 boolean isPaintRightLine()
          Returns whether should paint right side line or not.
 boolean isPaintTop()
          Returns whether should paint top side or not.
 boolean isPaintTopLine()
          Returns whether should paint top side line or not.
 boolean isUndecorated()
          Returns whether panel is undecorated or not.
 boolean isWebColoredBackground()
          Returns whether should paint web-styled background or not.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paints panel.
 java.awt.Shape provideShape()
          Returns component shape.
 void setBorderColor(java.awt.Color color)
          Sets decoration border color.
 void setBorderStroke(java.awt.Stroke stroke)
          Sets decoration border stroke.
 void setDisabledBorderColor(java.awt.Color color)
          Sets decoration disabled border color.
 void setMargin(java.awt.Insets margin)
          Sets panel margin.
 void setPaintBackground(boolean paint)
          Sets whether should paint decoration background or not.
 void setPaintBottom(boolean bottom)
          Sets whether should paint bottom side or not.
 void setPaintBottomLine(boolean bottom)
          Sets whether should paint bottom side line or not.
 void setPainter(Painter painter)
          Sets panel painter.
 void setPaintFocus(boolean paint)
          Sets whether focus should be painted or not.
 void setPaintLeft(boolean left)
          Sets whether should paint left side or not.
 void setPaintLeftLine(boolean left)
          Sets whether should paint left side line or not.
 void setPaintRight(boolean right)
          Sets whether should paint right side or not.
 void setPaintRightLine(boolean right)
          Sets whether should paint right side line or not.
 void setPaintSideLines(boolean top, boolean left, boolean bottom, boolean right)
          Sets whether should paint specific side lines or not.
 void setPaintSides(boolean top, boolean left, boolean bottom, boolean right)
          Sets whether should paint specific sides or not.
 void setPaintTop(boolean top)
          Sets whether should paint top side or not.
 void setPaintTopLine(boolean top)
          Sets whether should paint top side line or not.
 void setRound(int round)
          Sets decoration corners rounding.
 void setShadeTransparency(float transparency)
          Sets decoration shade transparency.
 void setShadeWidth(int shadeWidth)
          Sets decoration shade width.
 void setStyleId(java.lang.String id)
          Sets custom component style ID.
 void setUndecorated(boolean undecorated)
          Sets whether panel should be undecorated or not.
 void setWebColoredBackground(boolean webColored)
          Sets whether should paint web-styled background or not.
 void uninstallUI(javax.swing.JComponent c)
          Uninstalls UI from the specified component.
 void updateBorder()
          Updates custom WebLaF border.
 
Methods inherited from class javax.swing.plaf.basic.BasicPanelUI
getBaseline, getBaselineResizeBehavior, installDefaults, uninstallDefaults
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

undecorated

protected boolean undecorated
Style settings.


paintFocus

protected boolean paintFocus

margin

protected java.awt.Insets margin

paintTop

protected boolean paintTop

paintLeft

protected boolean paintLeft

paintBottom

protected boolean paintBottom

paintRight

protected boolean paintRight

paintTopLine

protected boolean paintTopLine

paintLeftLine

protected boolean paintLeftLine

paintBottomLine

protected boolean paintBottomLine

paintRightLine

protected boolean paintRightLine

painter

protected PanelPainter painter
Component painter.


propertyChangeListener

protected java.beans.PropertyChangeListener propertyChangeListener
Panel listeners.


styleId

protected java.lang.String styleId
Runtime variables.


panel

protected javax.swing.JPanel panel
Constructor Detail

WebPanelUI

public WebPanelUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the WebPanelUI for the specified component. This tricky method is used by UIManager to create component UIs when needed.

Parameters:
c - component that will use UI instance
Returns:
instance of the WebPanelUI

installUI

public void installUI(javax.swing.JComponent c)
Installs UI in the specified component.

Overrides:
installUI in class javax.swing.plaf.basic.BasicPanelUI
Parameters:
c - component for this UI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Uninstalls UI from the specified component.

Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicPanelUI
Parameters:
c - component with this UI

getStyleId

public java.lang.String getStyleId()
Returns component style ID. Custom ID can be specified to override default component style using "setStyleId" method. If style for such custom ID is not found in skin descriptor then default style for that component is used.

Specified by:
getStyleId in interface Styleable
Returns:
component style ID

setStyleId

public void setStyleId(java.lang.String id)
Sets custom component style ID. If style for such custom ID is not found in skin descriptor default style will be used for that component. This method forces component to instantly use component style with the specified ID.

Specified by:
setStyleId in interface Styleable
Parameters:
id - custom component style ID

provideShape

public java.awt.Shape provideShape()
Returns component shape.

Specified by:
provideShape in interface ShapeProvider
Returns:
component shape

updateBorder

public void updateBorder()
Updates custom WebLaF border.

Specified by:
updateBorder in interface BorderMethods

isUndecorated

public boolean isUndecorated()
Returns whether panel is undecorated or not.

Returns:
true if panel is undecorated, false otherwise

setUndecorated

public void setUndecorated(boolean undecorated)
Sets whether panel should be undecorated or not.

Parameters:
undecorated - whether panel should be undecorated or not

isPaintFocus

public boolean isPaintFocus()
Returns whether focus should be painted or not. Panel focus is displayed when either panel or one of its children are focused.

Returns:
true if focus should be painted, false otherwise

setPaintFocus

public void setPaintFocus(boolean paint)
Sets whether focus should be painted or not. Panel focus is displayed when either panel or one of its children are focused.

Parameters:
paint - whether focus should be painted or not

getMargin

public java.awt.Insets getMargin()
Returns panel margin.

Returns:
panel margin

setMargin

public void setMargin(java.awt.Insets margin)
Sets panel margin.

Parameters:
margin - new panel margin

isPaintTop

public boolean isPaintTop()
Returns whether should paint top side or not.

Returns:
true if should paint top side, false otherwise

setPaintTop

public void setPaintTop(boolean top)
Sets whether should paint top side or not.

Specified by:
setPaintTop in interface PartialDecoration
Parameters:
top - whether should paint top side or not

isPaintLeft

public boolean isPaintLeft()
Returns whether should paint left side or not.

Returns:
true if should paint left side, false otherwise

setPaintLeft

public void setPaintLeft(boolean left)
Sets whether should paint left side or not.

Specified by:
setPaintLeft in interface PartialDecoration
Parameters:
left - whether should paint left side or not

isPaintBottom

public boolean isPaintBottom()
Returns whether should paint bottom side or not.

Returns:
true if should paint bottom side, false otherwise

setPaintBottom

public void setPaintBottom(boolean bottom)
Sets whether should paint bottom side or not.

Specified by:
setPaintBottom in interface PartialDecoration
Parameters:
bottom - whether should paint bottom side or not

isPaintRight

public boolean isPaintRight()
Returns whether should paint right side or not.

Returns:
true if should paint right side, false otherwise

setPaintRight

public void setPaintRight(boolean right)
Sets whether should paint right side or not.

Specified by:
setPaintRight in interface PartialDecoration
Parameters:
right - whether should paint right side or not

setPaintSides

public void setPaintSides(boolean top,
                          boolean left,
                          boolean bottom,
                          boolean right)
Sets whether should paint specific sides or not.

Specified by:
setPaintSides in interface PartialDecoration
Parameters:
top - whether should paint top side or not
left - whether should paint left side or not
bottom - whether should paint bottom side or not
right - whether should paint right side or not

isPaintTopLine

public boolean isPaintTopLine()
Returns whether should paint top side line or not.

Returns:
true if should paint top side line, false otherwise

setPaintTopLine

public void setPaintTopLine(boolean top)
Sets whether should paint top side line or not.

Specified by:
setPaintTopLine in interface PartialDecoration
Parameters:
top - whether should paint top side line or not

isPaintLeftLine

public boolean isPaintLeftLine()
Returns whether should paint left side line or not.

Returns:
true if should paint left side line, false otherwise

setPaintLeftLine

public void setPaintLeftLine(boolean left)
Sets whether should paint left side line or not.

Specified by:
setPaintLeftLine in interface PartialDecoration
Parameters:
left - whether should paint left side line or not

isPaintBottomLine

public boolean isPaintBottomLine()
Returns whether should paint bottom side line or not.

Returns:
true if should paint bottom side line, false otherwise

setPaintBottomLine

public void setPaintBottomLine(boolean bottom)
Sets whether should paint bottom side line or not.

Specified by:
setPaintBottomLine in interface PartialDecoration
Parameters:
bottom - whether should paint bottom side line or not

isPaintRightLine

public boolean isPaintRightLine()
Returns whether should paint right side line or not.

Returns:
true if should paint right side line, false otherwise

setPaintRightLine

public void setPaintRightLine(boolean right)
Sets whether should paint right side line or not.

Specified by:
setPaintRightLine in interface PartialDecoration
Parameters:
right - whether should paint right side line or not

setPaintSideLines

public void setPaintSideLines(boolean top,
                              boolean left,
                              boolean bottom,
                              boolean right)
Sets whether should paint specific side lines or not.

Specified by:
setPaintSideLines in interface PartialDecoration
Parameters:
top - whether should paint top side line or not
left - whether should paint left side line or not
bottom - whether should paint bottom side line or not
right - whether should paint right side line or not

getRound

public int getRound()
Returns decoration corners rounding.

Returns:
decoration corners rounding

setRound

public void setRound(int round)
Sets decoration corners rounding.

Parameters:
round - decoration corners rounding

getShadeWidth

public int getShadeWidth()
Returns decoration shade width.

Returns:
decoration shade width

setShadeWidth

public void setShadeWidth(int shadeWidth)
Sets decoration shade width.

Parameters:
shadeWidth - decoration shade width

getShadeTransparency

public float getShadeTransparency()
Returns decoration shade transparency.

Returns:
decoration shade transparency

setShadeTransparency

public void setShadeTransparency(float transparency)
Sets decoration shade transparency.

Parameters:
transparency - new decoration shade transparency

getBorderStroke

public java.awt.Stroke getBorderStroke()
Returns decoration border stroke.

Returns:
decoration border stroke

setBorderStroke

public void setBorderStroke(java.awt.Stroke stroke)
Sets decoration border stroke.

Parameters:
stroke - decoration border stroke

getBorderColor

public java.awt.Color getBorderColor()
Returns decoration border color.

Returns:
decoration border color

setBorderColor

public void setBorderColor(java.awt.Color color)
Sets decoration border color.

Parameters:
color - decoration border color

getDisabledBorderColor

public java.awt.Color getDisabledBorderColor()
Returns decoration disabled border color.

Returns:
decoration disabled border color

setDisabledBorderColor

public void setDisabledBorderColor(java.awt.Color color)
Sets decoration disabled border color.

Parameters:
color - decoration disabled border color

isPaintBackground

public boolean isPaintBackground()
Returns whether should paint decoration background or not.

Returns:
true if should paint decoration background, false otherwise

setPaintBackground

public void setPaintBackground(boolean paint)
Sets whether should paint decoration background or not.

Parameters:
paint - whether should paint decoration background or not

isWebColoredBackground

public boolean isWebColoredBackground()
Returns whether should paint web-styled background or not.

Returns:
true if should paint web-styled background, false otherwise

setWebColoredBackground

public void setWebColoredBackground(boolean webColored)
Sets whether should paint web-styled background or not.

Parameters:
webColored - whether should paint web-styled background or not

getPainter

public Painter getPainter()
Returns panel painter.

Returns:
panel painter

setPainter

public void setPainter(Painter painter)
Sets panel painter. Pass null to remove panel painter.

Parameters:
painter - new panel painter

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paints panel.

Overrides:
paint in class javax.swing.plaf.ComponentUI
Parameters:
g - graphics
c - component