com.sun.lwuit.plaf
Class DefaultLookAndFeel

java.lang.Object
  extended by com.sun.lwuit.plaf.LookAndFeel
      extended by com.sun.lwuit.plaf.DefaultLookAndFeel
All Implemented Interfaces:
FocusListener

public class DefaultLookAndFeel
extends LookAndFeel
implements FocusListener

Used to render the default look of LWUIT


Constructor Summary
DefaultLookAndFeel()
          Creates a new instance of DefaultLookAndFeel
 
Method Summary
 void bind(Component cmp)
          Every component binds itself to the look and feel thus allowing the look and feel to customize the component.
 void drawButton(Graphics g, Button b)
          Invoked for drawing a button widget
 void drawCheckBox(Graphics g, Button cb)
          Invoked for drawing a checkbox widget
 void drawComboBox(Graphics g, List cb)
          Invoked for drawing a combo box widget
 void drawLabel(Graphics g, Label l)
          Invoked for drawing a label widget
protected  int drawLabelText(Graphics g, Label l, java.lang.String text, int x, int y, int textSpaceW)
          Draws the text of a label
 void drawList(Graphics g, List l)
          Invoked for drawing a list widget
 void drawRadioButton(Graphics g, Button rb)
          Invoked for drawing the radio button widget
 void drawTabbedPane(Graphics g, TabbedPane tp)
          Deprecated.  
 void drawTabbedPaneContentPane(TabbedPane tp, Graphics g, Rectangle rect, Dimension cellsPreferredSize, int numOfTabs, int selectedTabIndex, Dimension tabsSize, int cellOffsetX, int cellOffsetY)
          Deprecated.  
 void drawTextArea(Graphics g, TextArea ta)
          Draw the given text area
 void drawTextField(Graphics g, TextArea ta)
          Draws the text field without its cursor which is drawn in a separate method input mode indication can also be drawn using this method.
 void drawTextFieldCursor(Graphics g, TextArea ta)
          Draws the cursor of the text field, blinking is handled simply by avoiding a call to this method.
 void focusGained(Component cmp)
          Invoked when component gains focus
 void focusLost(Component cmp)
          Invoked when component loses focus
 Dimension getButtonPreferredSize(Button b)
          Calculate the preferred size of the component
 Image[] getCheckBoxFocusImages()
          Returns the images used to represent the checkbox when focused
 Image[] getCheckBoxImages()
          Returns the images used to represent the checkbox (selected followed by unselected).
 Dimension getCheckBoxPreferredSize(Button cb)
          Calculate the preferred size of the component
 Dimension getComboBoxPreferredSize(List cb)
          Calculate the preferred size of the component
 Dimension getLabelPreferredSize(Label l)
          Calculate the preferred size of the component
 Dimension getListPreferredSize(List l)
          Calculate the preferred size of the component
 Image[] getRadioButtonFocusImages()
          Returns the images used to represent the radio button when in focused mode
 Image[] getRadioButtonImages()
          Returns the images used to represent the radio button (selected followed by unselected).
 Dimension getRadioButtonPreferredSize(Button rb)
          Calculate the preferred size of the component
 Component getTabbedPaneCell(TabbedPane tp, java.lang.String text, Image icon, boolean isSelected, boolean cellHasFocus, Style cellStyle, Style cellSelectedStyle, Style tabbedPaneStyle, int cellOffsetX, int cellOffsetY, Dimension cellsPreferredSize, Dimension contentPaneSize)
          Deprecated.  
 Dimension getTextAreaSize(TextArea ta, boolean pref)
          Calculate the preferred size of the component
 Dimension getTextFieldPreferredSize(TextArea ta)
          Calculate the preferred size of the component
protected  java.lang.String getTextFieldString(TextArea ta)
          Similar to getText() but works properly with password fields
 boolean isTickWhenFocused()
          This method allows to set all Labels, Buttons, CheckBoxes, RadioButtons to start ticking when the text is too long.
 void refreshTheme()
          This method is a callback to the LookAndFeel when a theme is being changed in the UIManager
 void setCheckBoxFocusImages(Image checked, Image unchecked, Image disabledChecked, Image disabledUnchecked)
          Sets images for checkbox when in focused mode
 void setCheckBoxImages(Image checked, Image unchecked)
          Sets images for checkbox checked/unchecked modes
 void setCheckBoxImages(Image checked, Image unchecked, Image disabledChecked, Image disabledUnchecked)
          Sets images for checkbox checked/unchecked modes
 void setComboBoxImage(Image picker)
          Sets image for the combo box dropdown drawing
 void setRadioButtonFocusImages(Image selected, Image unselected, Image disabledSelected, Image disabledUnselected)
          Sets images for radio button selected/unselected and disabled modes, when the radio button has focus, these are entirely optional
 void setRadioButtonImages(Image selected, Image unselected)
          Sets images for radio button selected/unselected modes
 void setRadioButtonImages(Image selected, Image unselected, Image disabledSelected, Image disabledUnselected)
          Sets images for radio button selected/unselected modes
 void setTickWhenFocused(boolean tickWhenFocused)
          This method allows to set all Labels, Buttons, CheckBoxes, RadioButtons to start ticking when the text is too long.
 
Methods inherited from class com.sun.lwuit.plaf.LookAndFeel
drawHorizontalScroll, drawVerticalScroll, getDefaultDialogTransitionIn, getDefaultDialogTransitionOut, getDefaultFormTintColor, getDefaultFormTransitionIn, getDefaultFormTransitionOut, getDefaultMenuTransitionIn, getDefaultMenuTransitionOut, getDefaultSmoothScrollingSpeed, getDisableColor, getFadeScrollEdgeLength, getHorizontalScrollHeight, getMenuBarClass, getMenuIcons, getMenuRenderer, getTactileTouchDuration, getTextFieldCursorColor, getTickerSpeed, getVerticalScrollWidth, isDefaultAlwaysTensile, isDefaultEndsWith3Points, isDefaultSmoothScrolling, isDefaultSnapToGrid, isDefaultTensileDrag, isDefaultTensileHighlight, isFadeScrollBar, isFadeScrollEdge, isFocusScrolling, isReverseSoftButtons, isRTL, isTouchMenus, paintTensileHighlight, setDefaultAlwaysTensile, setDefaultDialogTransitionIn, setDefaultDialogTransitionOut, setDefaultEndsWith3Points, setDefaultFormTintColor, setDefaultFormTransitionIn, setDefaultFormTransitionOut, setDefaultMenuTransitionIn, setDefaultMenuTransitionOut, setDefaultSmoothScrolling, setDefaultSmoothScrollingSpeed, setDefaultSnapToGrid, setDefaultTensileDrag, setDisableColor, setFadeScrollBar, setFadeScrollEdge, setFadeScrollEdgeLength, setFG, setFocusScrolling, setMenuBarClass, setMenuIcons, setMenuRenderer, setReverseSoftButtons, setRTL, setTactileTouchDuration, setTextFieldCursorColor, setTickerSpeed, setTouchMenus, uninstall
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLookAndFeel

public DefaultLookAndFeel()
Creates a new instance of DefaultLookAndFeel

Method Detail

bind

public void bind(Component cmp)
Description copied from class: LookAndFeel
Every component binds itself to the look and feel thus allowing the look and feel to customize the component. Binding occurs at the end of the constructor when the component is in a valid state and ready to be used. Notice that a component might be bound twice or more and it is the responsibility of the LookAndFeel to protect against that.

Overrides:
bind in class LookAndFeel
Parameters:
cmp - component instance that may be customized by the look and feel

setTickWhenFocused

public void setTickWhenFocused(boolean tickWhenFocused)
This method allows to set all Labels, Buttons, CheckBoxes, RadioButtons to start ticking when the text is too long.

Parameters:
tickWhenFocused -

isTickWhenFocused

public boolean isTickWhenFocused()
This method allows to set all Labels, Buttons, CheckBoxes, RadioButtons to start ticking when the text is too long.

Returns:
tickWhenFocused

setCheckBoxImages

public void setCheckBoxImages(Image checked,
                              Image unchecked)
Sets images for checkbox checked/unchecked modes

Parameters:
checked - the image to draw in order to represent a checked checkbox
unchecked - the image to draw in order to represent an uncheck checkbox

setCheckBoxImages

public void setCheckBoxImages(Image checked,
                              Image unchecked,
                              Image disabledChecked,
                              Image disabledUnchecked)
Sets images for checkbox checked/unchecked modes

Parameters:
checked - the image to draw in order to represent a checked checkbox
unchecked - the image to draw in order to represent an uncheck checkbox
disabledChecked - same as checked for the disabled state
disabledUnchecked - same as unchecked for the disabled state

setCheckBoxFocusImages

public void setCheckBoxFocusImages(Image checked,
                                   Image unchecked,
                                   Image disabledChecked,
                                   Image disabledUnchecked)
Sets images for checkbox when in focused mode

Parameters:
checked - the image to draw in order to represent a checked checkbox
unchecked - the image to draw in order to represent an uncheck checkbox
disabledChecked - same as checked for the disabled state
disabledUnchecked - same as unchecked for the disabled state

setComboBoxImage

public void setComboBoxImage(Image picker)
Sets image for the combo box dropdown drawing

Parameters:
picker - picker image

setRadioButtonImages

public void setRadioButtonImages(Image selected,
                                 Image unselected)
Sets images for radio button selected/unselected modes

Parameters:
selected - the image to draw in order to represent a selected radio button
unselected - the image to draw in order to represent an unselected radio button

setRadioButtonImages

public void setRadioButtonImages(Image selected,
                                 Image unselected,
                                 Image disabledSelected,
                                 Image disabledUnselected)
Sets images for radio button selected/unselected modes

Parameters:
selected - the image to draw in order to represent a selected radio button
unselected - the image to draw in order to represent an unselected radio button
disabledSelected - same as selected for the disabled state
disabledUnselected - same as unselected for the disabled state

setRadioButtonFocusImages

public void setRadioButtonFocusImages(Image selected,
                                      Image unselected,
                                      Image disabledSelected,
                                      Image disabledUnselected)
Sets images for radio button selected/unselected and disabled modes, when the radio button has focus, these are entirely optional

Parameters:
selected - the image to draw in order to represent a selected radio button
unselected - the image to draw in order to represent an unselected radio button
disabledSelected - same as selected for the disabled state
disabledUnselected - same as unselected for the disabled state

getRadioButtonImages

public Image[] getRadioButtonImages()
Returns the images used to represent the radio button (selected followed by unselected).

Returns:
images representing the radio button or null for using the default drawing

getRadioButtonFocusImages

public Image[] getRadioButtonFocusImages()
Returns the images used to represent the radio button when in focused mode

Returns:
images representing the radio button or null for using the default drawing

getCheckBoxImages

public Image[] getCheckBoxImages()
Returns the images used to represent the checkbox (selected followed by unselected).

Returns:
images representing the check box or null for using the default drawing

getCheckBoxFocusImages

public Image[] getCheckBoxFocusImages()
Returns the images used to represent the checkbox when focused

Returns:
images representing the check box or null for using the default drawing

drawButton

public void drawButton(Graphics g,
                       Button b)
Description copied from class: LookAndFeel
Invoked for drawing a button widget

Specified by:
drawButton in class LookAndFeel
Parameters:
g - graphics context
b - component to draw

drawCheckBox

public void drawCheckBox(Graphics g,
                         Button cb)
Description copied from class: LookAndFeel
Invoked for drawing a checkbox widget

Specified by:
drawCheckBox in class LookAndFeel
Parameters:
g - graphics context
cb - component to draw

drawLabel

public void drawLabel(Graphics g,
                      Label l)
Description copied from class: LookAndFeel
Invoked for drawing a label widget

Specified by:
drawLabel in class LookAndFeel
Parameters:
g - graphics context
l - component to draw

drawRadioButton

public void drawRadioButton(Graphics g,
                            Button rb)
Description copied from class: LookAndFeel
Invoked for drawing the radio button widget

Specified by:
drawRadioButton in class LookAndFeel
Parameters:
g - graphics context
rb - component to draw

drawComboBox

public void drawComboBox(Graphics g,
                         List cb)
Description copied from class: LookAndFeel
Invoked for drawing a combo box widget

Specified by:
drawComboBox in class LookAndFeel
Parameters:
g - graphics context
cb - component to draw

drawList

public void drawList(Graphics g,
                     List l)
Description copied from class: LookAndFeel
Invoked for drawing a list widget

Specified by:
drawList in class LookAndFeel
Parameters:
g - graphics context
l - component to draw

drawTextArea

public void drawTextArea(Graphics g,
                         TextArea ta)
Description copied from class: LookAndFeel
Draw the given text area

Specified by:
drawTextArea in class LookAndFeel
Parameters:
g - graphics context
ta - component to draw

getButtonPreferredSize

public Dimension getButtonPreferredSize(Button b)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getButtonPreferredSize in class LookAndFeel
Parameters:
b - component whose size should be calculated
Returns:
the preferred size for the button

getCheckBoxPreferredSize

public Dimension getCheckBoxPreferredSize(Button cb)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getCheckBoxPreferredSize in class LookAndFeel
Parameters:
cb - component whose size should be calculated
Returns:
the preferred size for the component

getLabelPreferredSize

public Dimension getLabelPreferredSize(Label l)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getLabelPreferredSize in class LookAndFeel
Parameters:
l - component whose size should be calculated
Returns:
the preferred size for the component

getListPreferredSize

public Dimension getListPreferredSize(List l)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getListPreferredSize in class LookAndFeel
Parameters:
l - component whose size should be calculated
Returns:
the preferred size for the component

getRadioButtonPreferredSize

public Dimension getRadioButtonPreferredSize(Button rb)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getRadioButtonPreferredSize in class LookAndFeel
Parameters:
rb - component whose size should be calculated
Returns:
the preferred size for the component

getTextAreaSize

public Dimension getTextAreaSize(TextArea ta,
                                 boolean pref)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getTextAreaSize in class LookAndFeel
Parameters:
ta - component whose size should be calculated
pref - indicates whether preferred or scroll size should be returned
Returns:
the preferred size for the component

drawLabelText

protected int drawLabelText(Graphics g,
                            Label l,
                            java.lang.String text,
                            int x,
                            int y,
                            int textSpaceW)
Draws the text of a label

Parameters:
g - graphics context
l - label component
text - the text for the label
x - position for the label
y - position for the label
textSpaceW - the width available for the component
Returns:
the space used by the drawing

getComboBoxPreferredSize

public Dimension getComboBoxPreferredSize(List cb)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getComboBoxPreferredSize in class LookAndFeel
Parameters:
cb - component whose size should be calculated
Returns:
the preferred size for the component

drawTabbedPane

public void drawTabbedPane(Graphics g,
                           TabbedPane tp)
Deprecated. 

Description copied from class: LookAndFeel
Invoked for drawing the Tab Pane widget

Specified by:
drawTabbedPane in class LookAndFeel
Parameters:
g - graphics context
tp - component to draw

getTabbedPaneCell

public Component getTabbedPaneCell(TabbedPane tp,
                                   java.lang.String text,
                                   Image icon,
                                   boolean isSelected,
                                   boolean cellHasFocus,
                                   Style cellStyle,
                                   Style cellSelectedStyle,
                                   Style tabbedPaneStyle,
                                   int cellOffsetX,
                                   int cellOffsetY,
                                   Dimension cellsPreferredSize,
                                   Dimension contentPaneSize)
Deprecated. 

Description copied from class: LookAndFeel
Draws and return the TabbedPane cell component (renderer) according to each tab orientation, the borders are getting draws

Specified by:
getTabbedPaneCell in class LookAndFeel
Parameters:
tp - the TabbedPane
text - the cell text
icon - the cell icon image
isSelected - is the cell is the selected one
cellHasFocus - is the cell has focus
cellStyle - the cell Style object
cellSelectedStyle - the selected style for the cell object
tabbedPaneStyle - the TabbedPane Style object
cellOffsetX - the offset when the cell is on TOP or BOTTOM orientation
cellOffsetY - the offset when the cell is on LEFT or RIGHT orientation
cellsPreferredSize - the total cells PreferredSize
contentPaneSize - the contentPaneSize
Returns:
A TabbedPane cell component

drawTabbedPaneContentPane

public void drawTabbedPaneContentPane(TabbedPane tp,
                                      Graphics g,
                                      Rectangle rect,
                                      Dimension cellsPreferredSize,
                                      int numOfTabs,
                                      int selectedTabIndex,
                                      Dimension tabsSize,
                                      int cellOffsetX,
                                      int cellOffsetY)
Deprecated. 

Description copied from class: LookAndFeel
Draws and return the TabbedPane contentpane painter

Specified by:
drawTabbedPaneContentPane in class LookAndFeel
Parameters:
tp - the TabbedPane
g - the content pane graphics
rect - the content pane painting rectangle area
cellsPreferredSize - the total cells PreferredSize
numOfTabs - number of tabs
selectedTabIndex - the selected tab index
tabsSize - the tabs size
cellOffsetX - the offset when the cell is on TOP or BOTTOM orientation
cellOffsetY - the offset when the cell is on LEFT or RIGHT orientation

getTextFieldString

protected java.lang.String getTextFieldString(TextArea ta)
Similar to getText() but works properly with password fields


drawTextField

public void drawTextField(Graphics g,
                          TextArea ta)
Description copied from class: LookAndFeel
Draws the text field without its cursor which is drawn in a separate method input mode indication can also be drawn using this method.

Specified by:
drawTextField in class LookAndFeel
Parameters:
g - graphics context
ta - component to draw

getTextFieldPreferredSize

public Dimension getTextFieldPreferredSize(TextArea ta)
Description copied from class: LookAndFeel
Calculate the preferred size of the component

Specified by:
getTextFieldPreferredSize in class LookAndFeel
Parameters:
ta - component whose size should be calculated
Returns:
the preferred size for the component

drawTextFieldCursor

public void drawTextFieldCursor(Graphics g,
                                TextArea ta)
Description copied from class: LookAndFeel
Draws the cursor of the text field, blinking is handled simply by avoiding a call to this method.

Specified by:
drawTextFieldCursor in class LookAndFeel
Parameters:
g - graphics context
ta - component to draw

focusGained

public void focusGained(Component cmp)
Description copied from interface: FocusListener
Invoked when component gains focus

Specified by:
focusGained in interface FocusListener
Parameters:
cmp - the component that gains focus

focusLost

public void focusLost(Component cmp)
Description copied from interface: FocusListener
Invoked when component loses focus

Specified by:
focusLost in interface FocusListener
Parameters:
cmp - the component that lost focus

refreshTheme

public void refreshTheme()
Description copied from class: LookAndFeel
This method is a callback to the LookAndFeel when a theme is being changed in the UIManager

Overrides:
refreshTheme in class LookAndFeel