com.alee.laf.rootpane
Class WebRootPaneUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.RootPaneUI
          extended by javax.swing.plaf.basic.BasicRootPaneUI
              extended by com.alee.laf.rootpane.WebRootPaneUI
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.SwingConstants

public class WebRootPaneUI
extends javax.swing.plaf.basic.BasicRootPaneUI
implements javax.swing.SwingConstants

Custom UI for JRootPane component. This UI also includes custom frame and dialog decorations.

Author:
Mikle Garin

Nested Class Summary
protected  class WebRootPaneUI.TitleLabel
           
 
Field Summary
protected  boolean attachButtons
           
protected  java.awt.Color borderColor
           
static javax.swing.ImageIcon closeActiveIcon
           
static javax.swing.ImageIcon closeIcon
           
protected  java.awt.Dialog dialog
           
protected  boolean drawWatermark
           
protected  java.lang.String emptyTitleText
           
protected  java.awt.Frame frame
           
protected  boolean groupButtons
           
protected  int inactiveShadeWidth
           
protected  java.awt.Color innerBorderColor
           
protected  java.awt.LayoutManager layoutManager
           
protected  java.awt.Insets margin
           
static javax.swing.ImageIcon maximizeActiveIcon
           
static javax.swing.ImageIcon maximizeIcon
           
protected  int maxTitleWidth
           
protected  java.awt.Color middleBg
           
static javax.swing.ImageIcon minimizeActiveIcon
           
static javax.swing.ImageIcon minimizeIcon
          Root pane styling icons.
protected  java.beans.PropertyChangeListener resizableChangeListener
           
protected  WebResizeCorner resizeCorner
           
static javax.swing.ImageIcon restoreActiveIcon
           
static javax.swing.ImageIcon restoreIcon
           
protected  javax.swing.JRootPane root
           
protected  int round
           
protected  java.awt.LayoutManager savedOldLayout
           
protected  int shadeWidth
           
protected  boolean showCloseButton
           
protected  boolean showMaximizeButton
           
protected  boolean showMenuBar
           
protected  boolean showMinimizeButton
           
protected  boolean showResizeCorner
           
protected  boolean showTitleComponent
          Displayed window elements.
protected  boolean showWindowButtons
           
protected  int state
           
protected  boolean styled
          Runtime variables
protected  java.beans.PropertyChangeListener titleChangeListener
           
protected  javax.swing.JComponent titleComponent
           
protected  java.awt.Color topBg
          Style settings.
protected  javax.swing.ImageIcon watermark
           
protected  java.awt.Window window
           
protected  WebButtonGroup windowButtons
           
protected  java.awt.event.WindowFocusListener windowFocusListener
           
protected  java.awt.event.WindowStateListener windowStateListener
           
 
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
WebRootPaneUI()
           
 
Method Summary
protected  void close()
          Closes the Window.
protected  javax.swing.JComponent createDefaultTitleComponent()
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the WebRootPaneUI for the specified component.
protected  javax.swing.ImageIcon generateProperIcon(java.awt.Image image)
           
 java.awt.Color getBorderColor()
           
 java.lang.String getEmptyTitleText()
           
 int getInactiveShadeWidth()
           
 java.awt.Color getInnerBorderColor()
           
 java.awt.Insets getMargin()
           
 int getMaxTitleWidth()
           
 java.awt.Color getMiddleBg()
           
 WebResizeCorner getResizeCorner()
           
 int getRound()
           
protected  NinePatchIcon getShadeIcon(javax.swing.JComponent c)
           
 int getShadeWidth()
           
protected  int getShadeWidth(javax.swing.JComponent c)
           
 javax.swing.JComponent getTitleComponent()
           
 java.awt.Color getTopBg()
           
 javax.swing.ImageIcon getWatermark()
           
protected  java.awt.geom.RoundRectangle2D.Double getWatermarkClip(javax.swing.JComponent c)
           
 WebButtonGroup getWindowButtons()
           
protected  javax.swing.ImageIcon getWindowIcon()
          Finds a frame image with most suitable size
protected  java.lang.String getWindowTitle()
          Returns window title
protected  void iconify()
          Iconifies the Frame.
protected  void installBorder()
          Decoration border install and uninstall methods
protected  void installDecorationComponents()
          Resize corner
protected  void installLayout()
          Appropriate LayoutManager for the window decorations install and uninstall methods
protected  void installListeners()
          Listeners
protected  void installProperties()
          Specific properties
protected  void installTransparency()
          Window transparency
 void installUI(javax.swing.JComponent c)
           
protected  void installWindowDecorations()
          Decoration install and uninstall methods
protected  boolean isActive(javax.swing.JComponent c)
           
 boolean isAttachButtons()
           
protected  boolean isDialog()
          Checks if root pane is inside a dialog
 boolean isDrawWatermark()
           
protected  boolean isFrame()
          Checks if root pane is inside a frame
protected  boolean isFrameMaximized()
          Checks if frame is maximized
 boolean isGroupButtons()
           
protected  boolean isResizable()
          Checks if root pane's window is resizable
 boolean isShowCloseButton()
           
 boolean isShowMaximizeButton()
           
 boolean isShowMenuBar()
           
 boolean isShowMinimizeButton()
           
 boolean isShowResizeCorner()
          Window elements settings
 boolean isShowTitleComponent()
           
 boolean isShowWindowButtons()
           
 boolean isStyled()
          UI parameters
protected  void maximize()
          Maximizes the Frame.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Custom window decoration
 void propertyChange(java.beans.PropertyChangeEvent e)
          Listening to decoration changes
protected  void restore()
          Restores the Frame size.
 void setAttachButtons(boolean attachButtons)
           
 void setBorderColor(java.awt.Color borderColor)
           
 void setDrawWatermark(boolean drawWatermark)
           
 void setEmptyTitleText(java.lang.String emptyTitleText)
           
 void setGroupButtons(boolean groupButtons)
           
 void setInactiveShadeWidth(int inactiveShadeWidth)
           
 void setInnerBorderColor(java.awt.Color innerBorderColor)
           
 void setMargin(java.awt.Insets margin)
           
 void setMaxTitleWidth(int maxTitleWidth)
           
 void setMiddleBg(java.awt.Color middleBg)
           
 void setRound(int round)
           
 void setShadeWidth(int shadeWidth)
           
 void setShowCloseButton(boolean showCloseButton)
           
 void setShowMaximizeButton(boolean showMaximizeButton)
           
 void setShowMenuBar(boolean showMenuBar)
           
 void setShowMinimizeButton(boolean showMinimizeButton)
           
 void setShowResizeCorner(boolean showResizeCorner)
           
 void setShowTitleComponent(boolean showTitleComponent)
           
 void setShowWindowButtons(boolean showWindowButtons)
           
 void setTitleComponent(javax.swing.JComponent titleComponent)
           
 void setTopBg(java.awt.Color topBg)
           
 void setWatermark(javax.swing.ImageIcon watermark)
           
protected  void uninstallBorder()
           
protected  void uninstallDecorationComponents()
           
protected  void uninstallLayout()
           
protected  void uninstallListeners()
           
protected  void uninstallProperties()
           
protected  void uninstallTransparency()
           
 void uninstallUI(javax.swing.JComponent c)
           
protected  void uninstallWindowDecorations()
           
protected  void updateButtons()
           
protected  void updateWindowButtonsStyle()
           
 
Methods inherited from class javax.swing.plaf.basic.BasicRootPaneUI
installComponents, installDefaults, installKeyboardActions, installListeners, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minimizeIcon

public static javax.swing.ImageIcon minimizeIcon
Root pane styling icons.


minimizeActiveIcon

public static javax.swing.ImageIcon minimizeActiveIcon

maximizeIcon

public static javax.swing.ImageIcon maximizeIcon

maximizeActiveIcon

public static javax.swing.ImageIcon maximizeActiveIcon

restoreIcon

public static javax.swing.ImageIcon restoreIcon

restoreActiveIcon

public static javax.swing.ImageIcon restoreActiveIcon

closeIcon

public static javax.swing.ImageIcon closeIcon

closeActiveIcon

public static javax.swing.ImageIcon closeActiveIcon

topBg

protected java.awt.Color topBg
Style settings.


middleBg

protected java.awt.Color middleBg

borderColor

protected java.awt.Color borderColor

innerBorderColor

protected java.awt.Color innerBorderColor

shadeWidth

protected int shadeWidth

inactiveShadeWidth

protected int inactiveShadeWidth

round

protected int round

margin

protected java.awt.Insets margin

drawWatermark

protected boolean drawWatermark

watermark

protected javax.swing.ImageIcon watermark

maxTitleWidth

protected int maxTitleWidth

emptyTitleText

protected java.lang.String emptyTitleText

showTitleComponent

protected boolean showTitleComponent
Displayed window elements.


showMenuBar

protected boolean showMenuBar

showWindowButtons

protected boolean showWindowButtons

showMinimizeButton

protected boolean showMinimizeButton

showMaximizeButton

protected boolean showMaximizeButton

showCloseButton

protected boolean showCloseButton

groupButtons

protected boolean groupButtons

attachButtons

protected boolean attachButtons

showResizeCorner

protected boolean showResizeCorner

styled

protected boolean styled
Runtime variables


root

protected javax.swing.JRootPane root

window

protected java.awt.Window window

frame

protected java.awt.Frame frame

dialog

protected java.awt.Dialog dialog

state

protected int state

layoutManager

protected java.awt.LayoutManager layoutManager

savedOldLayout

protected java.awt.LayoutManager savedOldLayout

windowFocusListener

protected java.awt.event.WindowFocusListener windowFocusListener

titleChangeListener

protected java.beans.PropertyChangeListener titleChangeListener

resizableChangeListener

protected java.beans.PropertyChangeListener resizableChangeListener

windowStateListener

protected java.awt.event.WindowStateListener windowStateListener

titleComponent

protected javax.swing.JComponent titleComponent

windowButtons

protected WebButtonGroup windowButtons

resizeCorner

protected WebResizeCorner resizeCorner
Constructor Detail

WebRootPaneUI

public WebRootPaneUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the WebRootPaneUI 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 WebRootPaneUI

installUI

public void installUI(javax.swing.JComponent c)
Overrides:
installUI in class javax.swing.plaf.basic.BasicRootPaneUI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicRootPaneUI

isStyled

public boolean isStyled()
UI parameters


getTopBg

public java.awt.Color getTopBg()

setTopBg

public void setTopBg(java.awt.Color topBg)

getMiddleBg

public java.awt.Color getMiddleBg()

setMiddleBg

public void setMiddleBg(java.awt.Color middleBg)

getBorderColor

public java.awt.Color getBorderColor()

setBorderColor

public void setBorderColor(java.awt.Color borderColor)

getInnerBorderColor

public java.awt.Color getInnerBorderColor()

setInnerBorderColor

public void setInnerBorderColor(java.awt.Color innerBorderColor)

getShadeWidth

public int getShadeWidth()

setShadeWidth

public void setShadeWidth(int shadeWidth)

getInactiveShadeWidth

public int getInactiveShadeWidth()

setInactiveShadeWidth

public void setInactiveShadeWidth(int inactiveShadeWidth)

getRound

public int getRound()

setRound

public void setRound(int round)

getMargin

public java.awt.Insets getMargin()

setMargin

public void setMargin(java.awt.Insets margin)

isDrawWatermark

public boolean isDrawWatermark()

setDrawWatermark

public void setDrawWatermark(boolean drawWatermark)

getWatermark

public javax.swing.ImageIcon getWatermark()

setWatermark

public void setWatermark(javax.swing.ImageIcon watermark)

getMaxTitleWidth

public int getMaxTitleWidth()

setMaxTitleWidth

public void setMaxTitleWidth(int maxTitleWidth)

getEmptyTitleText

public java.lang.String getEmptyTitleText()

setEmptyTitleText

public void setEmptyTitleText(java.lang.String emptyTitleText)

getTitleComponent

public javax.swing.JComponent getTitleComponent()

setTitleComponent

public void setTitleComponent(javax.swing.JComponent titleComponent)

getWindowButtons

public WebButtonGroup getWindowButtons()

getResizeCorner

public WebResizeCorner getResizeCorner()

isShowResizeCorner

public boolean isShowResizeCorner()
Window elements settings


setShowResizeCorner

public void setShowResizeCorner(boolean showResizeCorner)

isShowTitleComponent

public boolean isShowTitleComponent()

setShowTitleComponent

public void setShowTitleComponent(boolean showTitleComponent)

isShowWindowButtons

public boolean isShowWindowButtons()

setShowWindowButtons

public void setShowWindowButtons(boolean showWindowButtons)

isShowMinimizeButton

public boolean isShowMinimizeButton()

setShowMinimizeButton

public void setShowMinimizeButton(boolean showMinimizeButton)

isShowMaximizeButton

public boolean isShowMaximizeButton()

setShowMaximizeButton

public void setShowMaximizeButton(boolean showMaximizeButton)

isShowCloseButton

public boolean isShowCloseButton()

setShowCloseButton

public void setShowCloseButton(boolean showCloseButton)

isGroupButtons

public boolean isGroupButtons()

setGroupButtons

public void setGroupButtons(boolean groupButtons)

isAttachButtons

public boolean isAttachButtons()

setAttachButtons

public void setAttachButtons(boolean attachButtons)

isShowMenuBar

public boolean isShowMenuBar()

setShowMenuBar

public void setShowMenuBar(boolean showMenuBar)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Listening to decoration changes

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class javax.swing.plaf.basic.BasicRootPaneUI

installWindowDecorations

protected void installWindowDecorations()
Decoration install and uninstall methods


uninstallWindowDecorations

protected void uninstallWindowDecorations()

installProperties

protected void installProperties()
Specific properties


uninstallProperties

protected void uninstallProperties()

installListeners

protected void installListeners()
Listeners


uninstallListeners

protected void uninstallListeners()

installTransparency

protected void installTransparency()
Window transparency


uninstallTransparency

protected void uninstallTransparency()

installBorder

protected void installBorder()
Decoration border install and uninstall methods


uninstallBorder

protected void uninstallBorder()

installLayout

protected void installLayout()
Appropriate LayoutManager for the window decorations install and uninstall methods


uninstallLayout

protected void uninstallLayout()

installDecorationComponents

protected void installDecorationComponents()
Resize corner


createDefaultTitleComponent

protected javax.swing.JComponent createDefaultTitleComponent()

updateButtons

protected void updateButtons()

updateWindowButtonsStyle

protected void updateWindowButtonsStyle()

uninstallDecorationComponents

protected void uninstallDecorationComponents()

getWindowTitle

protected java.lang.String getWindowTitle()
Returns window title


getWindowIcon

protected javax.swing.ImageIcon getWindowIcon()
Finds a frame image with most suitable size


generateProperIcon

protected javax.swing.ImageIcon generateProperIcon(java.awt.Image image)

close

protected void close()
Closes the Window.


iconify

protected void iconify()
Iconifies the Frame.


maximize

protected void maximize()
Maximizes the Frame.


restore

protected void restore()
Restores the Frame size.


isResizable

protected boolean isResizable()
Checks if root pane's window is resizable


isFrame

protected boolean isFrame()
Checks if root pane is inside a frame


isFrameMaximized

protected boolean isFrameMaximized()
Checks if frame is maximized


isDialog

protected boolean isDialog()
Checks if root pane is inside a dialog


paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Custom window decoration

Overrides:
paint in class javax.swing.plaf.ComponentUI

getWatermarkClip

protected java.awt.geom.RoundRectangle2D.Double getWatermarkClip(javax.swing.JComponent c)

getShadeIcon

protected NinePatchIcon getShadeIcon(javax.swing.JComponent c)

getShadeWidth

protected int getShadeWidth(javax.swing.JComponent c)

isActive

protected boolean isActive(javax.swing.JComponent c)