Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit.plaf
Class LookAndFeel

java.lang.Object
  extended by com.sun.dtv.lwuit.plaf.LookAndFeel
Direct Known Subclasses:
DefaultLookAndFeel

public abstract class LookAndFeel
extends Object

Allows a UI developer to completely customize the look of the application by overriding drawing/sizing methods appropriately.


Constructor Summary
LookAndFeel()
           
 
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.
abstract  void drawButton(Graphics g, Button b)
          Invoked for drawing a button widget.
abstract  void drawCheckBox(Graphics g, CheckBox cb)
          Invoked for drawing a checkbox widget.
abstract  void drawComboBox(Graphics g, ComboBox cb)
          Invoked for drawing a combo box widget.
 void drawHorizontalScroll(Graphics g, Component c, float offsetRatio, float blockSizeRatio)
          Draws a horizontal scroll bar in the given component.
abstract  void drawLabel(Graphics g, Label l)
          Invoked for drawing a label widget.
abstract  void drawList(Graphics g, List l)
          Invoked for drawing a list widget.
abstract  void drawMonthView(Graphics g, Calendar cal, Component mv)
          Invoked for drawing a month view widget.
abstract  void drawRadioButton(Graphics g, RadioButton rb)
          Invoked for drawing the radio button widget.
abstract  void drawTabbedPane(Graphics g, TabbedPane tp)
          Invoked for drawing the Tab Pane widget.
abstract  void drawTabbedPaneContentPane(TabbedPane tp, Graphics g, Rectangle rect, Dimension cellsPreferredSize, int numOfTabs, int selectedTabIndex, Dimension tabsSize, int cellOffsetX, int cellOffsetY)
          Draws and return the TabbedPane content pane painter.
abstract  void drawTextArea(Graphics g, TextArea ta)
          Invoked for drawing the text area widget.
abstract  void drawTextField(Graphics g, TextField tf)
          Draws the text field without its cursor which is drawn in a separate method.
abstract  void drawTextFieldCursor(Graphics g, TextField tf)
          Draws the cursor of the text field, blinking is handled simply by avoiding a call to this method.
 void drawVerticalScroll(Graphics g, Component c, float offsetRatio, float blockSizeRatio)
          Draws a vertical scroll bar in the given component.
abstract  long findDayAt(int x, int y, Calendar cal, Component mv)
          Returns the day of the month in the month view at the given relative component X/Y offsets.
abstract  Dimension getButtonPreferredSize(Button b)
          Returns the preferred size for the button.
abstract  Dimension getCheckBoxPreferredSize(CheckBox cb)
          Returns the preferred size for the checkbox.
abstract  Dimension getComboBoxPreferredSize(ComboBox box)
          Returns the preferred size for the combo box.
 Transition getDefaultDialogTransitionIn()
          Retrieves default animation that will draw the transition for entering a dialog.
 Transition getDefaultDialogTransitionOut()
          Retrieves the default animation that will draw the transition for exiting a dialog.
 Color getDefaultFormTintColor()
          Tint color is set when a form is partially covered be it by a menu or by a dialog.
 Transition getDefaultFormTransitionIn()
          Retrieves the default animation that will draw the transition for entering a form.
 Transition getDefaultFormTransitionOut()
          Retrieves the default animation that will draw the transition for entering a form.
 Transition getDefaultMenuTransitionIn()
          Retrieves default animation that will draw the transition for entering a Menu.
 Transition getDefaultMenuTransitionOut()
          Retrieves default animation that will draw the transition for exiting a Menu.
 int getDefaultSmoothScrollingSpeed()
          Indicates the default speed for smooth scrolling.
 Color getDisableColor()
          This color is used to paint disable mode text color.
 int getHorizontalScrollHeight()
          Returns the default height of a horizontal scroll bar.
abstract  Dimension getLabelPreferredSize(Label l)
          Returns the preferred size for the label.
abstract  Dimension getListPreferredSize(List l)
          Returns the preferred size for the list.
 Image[] getMenuIcons()
          Simple getter for the menu icons.
 ListCellRenderer getMenuRenderer()
          Returns the Menu default renderer.
abstract  Dimension getMonthViewPreferredSize(Component mv)
          Returns the preferred size for the month view component.
abstract  Dimension getRadioButtonPreferredSize(RadioButton rb)
          Returns the preferred size for the radio button.
abstract  Component getTabbedPaneCell(TabbedPane tp, String text, Image icon, boolean isSelected, boolean cellHasFocus, Style cellStyle, Style tabbedPaneStyle, int cellOffsetX, int cellOffsetY, Dimension cellsPreferredSize, Dimension contentPaneSize)
          Draws and return the TabbedPane cell component (renderer) according to each tab orientation, the borders are getting draws.
abstract  Dimension getTextAreaPreferredSize(TextArea ta)
          Returns the preferred size for the text area.
abstract  Dimension getTextFieldPreferredSize(TextField tf)
          Returns the preferred size for the text field.
 int getVerticalScrollWidth()
          Returns the default width of a vertical scroll bar.
 boolean isDefaultSmoothScrolling()
          Indicates whether lists and containers should have smooth scrolling by default.
 boolean isReverseSoftButtons()
          Indicates whether softbuttons should be reversed from their default orientation.
 void setDefaultDialogTransitionIn(Transition defaultDialogTransitionIn)
          Allows us to define a default animation that will draw the transition for entering a dialog.
 void setDefaultDialogTransitionOut(Transition defaultDialogTransitionOut)
          Allows us to define a default animation that will draw the transition for exiting a dialog.
 void setDefaultFormTintColor(Color defaultFormTintColor)
          Tint color is set when a form is partially covered be it by a menu or by a dialog.
 void setDefaultFormTransitionIn(Transition defaultFormTransitionIn)
          Allows us to define a default animation that will draw the transition for entering a form.
 void setDefaultFormTransitionOut(Transition defaultFormTransitionOut)
          Allows us to define a default animation that will draw the transition for exiting a form.
 void setDefaultMenuTransitionIn(Transition defaultMenuTransitionIn)
          Allows us to define a default animation that will draw the transition for entering a Menu.
 void setDefaultMenuTransitionOut(Transition defaultMenuTransitionOut)
          Allows us to define a default animation that will draw the transition for exiting a Menu.
 void setDefaultSmoothScrolling(boolean defaultSmoothScrolling)
          Indicates whether lists and containers should have smooth scrolling by default.
 void setDefaultSmoothScrollingSpeed(int defaultSmoothScrollingSpeed)
          Indicates the default speed for smooth scrolling.
 void setDisableColor(Color disableColor)
          Simple setter to disable color.
 void setFG(Graphics g, Component c)
          Sets the foreground color and font for a generic component, reuse-able by most component drawing code.
 void setMenuIcons(Image select, Image cancel, Image menu)
          Sets globally the Menu icons.
 void setMenuRenderer(ListCellRenderer menuRenderer)
          Sets the Menu default renderer.
 void setReverseSoftButtons(boolean reverseSoftButtons)
          Indicates whether softbuttons should be reversed from their default orientation.
 void uninstall()
          Invoked when a look and feel is removed, allows a look and feel to release resources related to binding components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookAndFeel

public LookAndFeel()
Method Detail

bind

public void bind(Component cmp)
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.

Parameters:
cmp - component instance that may be customized by the look and feel

uninstall

public void uninstall()
Invoked when a look and feel is removed, allows a look and feel to release resources related to binding components.

See Also:
bind(Component)

drawButton

public abstract void drawButton(Graphics g,
                                Button b)
Invoked for drawing a button widget.

Parameters:
g - the Graphics object
b - the button

drawCheckBox

public abstract void drawCheckBox(Graphics g,
                                  CheckBox cb)
Invoked for drawing a checkbox widget.

Parameters:
g - the Graphics object
cb - the check box

drawComboBox

public abstract void drawComboBox(Graphics g,
                                  ComboBox cb)
Invoked for drawing a combo box widget.

Parameters:
g - the Graphics object
cb - the combo box

drawLabel

public abstract void drawLabel(Graphics g,
                               Label l)
Invoked for drawing a label widget.

Parameters:
g - the Graphics object
l - the label

drawList

public abstract void drawList(Graphics g,
                              List l)
Invoked for drawing a list widget.

Parameters:
g - the Graphics object
l - the list

drawMonthView

public abstract void drawMonthView(Graphics g,
                                   Calendar cal,
                                   Component mv)
Invoked for drawing a month view widget.

Parameters:
g - the Graphics object
cal - the calendar
mv - the month view component

findDayAt

public abstract long findDayAt(int x,
                               int y,
                               Calendar cal,
                               Component mv)
Returns the day of the month in the month view at the given relative component X/Y offsets. This is important for touch screen interaction.

Parameters:
x - x coordinate of offset
y - y coordinate of offset
cal - the calendar
mv - the month view component
Returns:
the day of the month

drawRadioButton

public abstract void drawRadioButton(Graphics g,
                                     RadioButton rb)
Invoked for drawing the radio button widget.

Parameters:
g - the Graphics object
rb - the radio button

drawTextArea

public abstract void drawTextArea(Graphics g,
                                  TextArea ta)
Invoked for drawing the text area widget.

Parameters:
g - the Graphics object
ta - the text area

drawTextField

public abstract void drawTextField(Graphics g,
                                   TextField tf)
Draws the text field without its cursor which is drawn in a separate method. Input mode indication can also be drawn using this method.

Parameters:
g - the Graphics object
tf - the text field

drawTextFieldCursor

public abstract void drawTextFieldCursor(Graphics g,
                                         TextField tf)
Draws the cursor of the text field, blinking is handled simply by avoiding a call to this method.

Parameters:
g - the Graphics object
tf - the text field

drawTabbedPane

public abstract void drawTabbedPane(Graphics g,
                                    TabbedPane tp)
Invoked for drawing the Tab Pane widget.

Parameters:
g - the Graphics object
tp - the tabbed pane

getButtonPreferredSize

public abstract Dimension getButtonPreferredSize(Button b)
Returns the preferred size for the button.

Parameters:
b - the button
Returns:
the preferred size for the button

getCheckBoxPreferredSize

public abstract Dimension getCheckBoxPreferredSize(CheckBox cb)
Returns the preferred size for the checkbox.

Parameters:
cb - the checkbox
Returns:
the preferred size for the checkbox

getLabelPreferredSize

public abstract Dimension getLabelPreferredSize(Label l)
Returns the preferred size for the label.

Parameters:
l - the label
Returns:
the preferred size for the label

getListPreferredSize

public abstract Dimension getListPreferredSize(List l)
Returns the preferred size for the list.

Parameters:
l - the list
Returns:
the preferred size for the list

getMonthViewPreferredSize

public abstract Dimension getMonthViewPreferredSize(Component mv)
Returns the preferred size for the month view component.

Parameters:
mv - the month view component
Returns:
the preferred size for the month view component

getRadioButtonPreferredSize

public abstract Dimension getRadioButtonPreferredSize(RadioButton rb)
Returns the preferred size for the radio button.

Parameters:
rb - the radio button
Returns:
the preferred size for the radio button

getTextAreaPreferredSize

public abstract Dimension getTextAreaPreferredSize(TextArea ta)
Returns the preferred size for the text area.

Parameters:
ta - the text area
Returns:
the preferred size for the text area

getTextFieldPreferredSize

public abstract Dimension getTextFieldPreferredSize(TextField tf)
Returns the preferred size for the text field.

Parameters:
tf - the text field
Returns:
the preferred size for the text field

getComboBoxPreferredSize

public abstract Dimension getComboBoxPreferredSize(ComboBox box)
Returns the preferred size for the combo box.

Parameters:
box - the combo box
Returns:
the preferred size for the combo box

drawVerticalScroll

public void drawVerticalScroll(Graphics g,
                               Component c,
                               float offsetRatio,
                               float blockSizeRatio)
Draws a vertical scroll bar in the given component.

Parameters:
g - the Graphics object
c - the component
offsetRatio - the offset ratio
blockSizeRatio - the block size ratio

drawHorizontalScroll

public void drawHorizontalScroll(Graphics g,
                                 Component c,
                                 float offsetRatio,
                                 float blockSizeRatio)
Draws a horizontal scroll bar in the given component.

Parameters:
g - the Graphics object
c - the component
offsetRatio - the offset ratio
blockSizeRatio - the block size ratio

setFG

public void setFG(Graphics g,
                  Component c)
Sets the foreground color and font for a generic component, reuse-able by most component drawing code.

Parameters:
g - the Graphics object
c - the component

getVerticalScrollWidth

public int getVerticalScrollWidth()
Returns the default width of a vertical scroll bar.

Returns:
default width of a vertical scroll bar

getHorizontalScrollHeight

public int getHorizontalScrollHeight()
Returns the default height of a horizontal scroll bar.

Returns:
default height of a horizontal scroll bar

getTabbedPaneCell

public abstract Component getTabbedPaneCell(TabbedPane tp,
                                            String text,
                                            Image icon,
                                            boolean isSelected,
                                            boolean cellHasFocus,
                                            Style cellStyle,
                                            Style tabbedPaneStyle,
                                            int cellOffsetX,
                                            int cellOffsetY,
                                            Dimension cellsPreferredSize,
                                            Dimension contentPaneSize)
Draws and return the TabbedPane cell component (renderer) according to each tab orientation, the borders are getting draws.

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
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 abstract void drawTabbedPaneContentPane(TabbedPane tp,
                                               Graphics g,
                                               Rectangle rect,
                                               Dimension cellsPreferredSize,
                                               int numOfTabs,
                                               int selectedTabIndex,
                                               Dimension tabsSize,
                                               int cellOffsetX,
                                               int cellOffsetY)
Draws and return the TabbedPane content pane painter.

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

getDefaultFormTransitionIn

public Transition getDefaultFormTransitionIn()
Retrieves the default animation that will draw the transition for entering a form.

Returns:
a Transition object
See Also:
setDefaultFormTransitionIn(com.sun.dtv.lwuit.animations.Transition)

setDefaultFormTransitionIn

public void setDefaultFormTransitionIn(Transition defaultFormTransitionIn)
Allows us to define a default animation that will draw the transition for entering a form.

Parameters:
defaultFormTransitionIn - the default animation
See Also:
getDefaultFormTransitionIn()

getDefaultFormTransitionOut

public Transition getDefaultFormTransitionOut()
Retrieves the default animation that will draw the transition for entering a form.

Returns:
a Transition object
See Also:
setDefaultFormTransitionOut(com.sun.dtv.lwuit.animations.Transition)

setDefaultFormTransitionOut

public void setDefaultFormTransitionOut(Transition defaultFormTransitionOut)
Allows us to define a default animation that will draw the transition for exiting a form.

Parameters:
defaultFormTransitionOut - the default animation
See Also:
getDefaultFormTransitionOut()

getDefaultMenuTransitionIn

public Transition getDefaultMenuTransitionIn()
Retrieves default animation that will draw the transition for entering a Menu.

Returns:
a Transition object
See Also:
setDefaultMenuTransitionIn(com.sun.dtv.lwuit.animations.Transition)

setDefaultMenuTransitionIn

public void setDefaultMenuTransitionIn(Transition defaultMenuTransitionIn)
Allows us to define a default animation that will draw the transition for entering a Menu.

Parameters:
defaultMenuTransitionIn - the default animation
See Also:
getDefaultMenuTransitionIn()

getDefaultMenuTransitionOut

public Transition getDefaultMenuTransitionOut()
Retrieves default animation that will draw the transition for exiting a Menu.

Returns:
a Transition object
See Also:
setDefaultMenuTransitionOut(com.sun.dtv.lwuit.animations.Transition)

setDefaultMenuTransitionOut

public void setDefaultMenuTransitionOut(Transition defaultMenuTransitionOut)
Allows us to define a default animation that will draw the transition for exiting a Menu.

Parameters:
defaultMenuTransitionOut - the default animation
See Also:
getDefaultMenuTransitionOut()

getDefaultDialogTransitionIn

public Transition getDefaultDialogTransitionIn()
Retrieves default animation that will draw the transition for entering a dialog.

Returns:
a Transition object
See Also:
setDefaultDialogTransitionIn(com.sun.dtv.lwuit.animations.Transition)

setDefaultDialogTransitionIn

public void setDefaultDialogTransitionIn(Transition defaultDialogTransitionIn)
Allows us to define a default animation that will draw the transition for entering a dialog.

Parameters:
defaultDialogTransitionIn - the default animation
See Also:
getDefaultDialogTransitionIn()

getDefaultDialogTransitionOut

public Transition getDefaultDialogTransitionOut()
Retrieves the default animation that will draw the transition for exiting a dialog.

Returns:
a Transition object
See Also:
setDefaultDialogTransitionOut(com.sun.dtv.lwuit.animations.Transition)

setDefaultDialogTransitionOut

public void setDefaultDialogTransitionOut(Transition defaultDialogTransitionOut)
Allows us to define a default animation that will draw the transition for exiting a dialog.

Parameters:
defaultDialogTransitionOut - the default animation
See Also:
getDefaultDialogTransitionOut()

getDefaultFormTintColor

public Color getDefaultFormTintColor()
Tint color is set when a form is partially covered be it by a menu or by a dialog. A look and feel can override this default value.

Returns:
the tint color
See Also:
setDefaultFormTintColor(java.awt.Color)

setDefaultFormTintColor

public void setDefaultFormTintColor(Color defaultFormTintColor)
Tint color is set when a form is partially covered be it by a menu or by a dialog. A look and feel can override this default value.

Parameters:
defaultFormTintColor - the tint color
See Also:
getDefaultFormTintColor()

getDisableColor

public Color getDisableColor()
This color is used to paint disable mode text color.

Returns:
the color value
See Also:
setDisableColor(java.awt.Color)

setDisableColor

public void setDisableColor(Color disableColor)
Simple setter to disable color.

Parameters:
disableColor - the disable color value
See Also:
getDisableColor()

isDefaultSmoothScrolling

public boolean isDefaultSmoothScrolling()
Indicates whether lists and containers should have smooth scrolling by default.

Returns:
true if smooth scrolling is active
See Also:
setDefaultSmoothScrolling(boolean)

setDefaultSmoothScrolling

public void setDefaultSmoothScrolling(boolean defaultSmoothScrolling)
Indicates whether lists and containers should have smooth scrolling by default.

Parameters:
defaultSmoothScrolling - Indicates whether lists and containers should have smooth scrolling by default
See Also:
isDefaultSmoothScrolling()

getDefaultSmoothScrollingSpeed

public int getDefaultSmoothScrollingSpeed()
Indicates the default speed for smooth scrolling.

Returns:
the default speed
See Also:
setDefaultSmoothScrollingSpeed(int)

setDefaultSmoothScrollingSpeed

public void setDefaultSmoothScrollingSpeed(int defaultSmoothScrollingSpeed)
Indicates the default speed for smooth scrolling.

Parameters:
defaultSmoothScrollingSpeed - the default speed
See Also:
getDefaultSmoothScrollingSpeed()

isReverseSoftButtons

public boolean isReverseSoftButtons()
Indicates whether softbuttons should be reversed from their default orientation.

Returns:
true is reverse soft button is active
See Also:
setReverseSoftButtons(boolean)

setReverseSoftButtons

public void setReverseSoftButtons(boolean reverseSoftButtons)
Indicates whether softbuttons should be reversed from their default orientation.

Parameters:
reverseSoftButtons - Indicates whether softbuttons should be reversed from their default orientation
See Also:
isReverseSoftButtons()

getMenuRenderer

public ListCellRenderer getMenuRenderer()
Returns the Menu default renderer.

Returns:
the Menu default renderer
See Also:
setMenuRenderer(com.sun.dtv.lwuit.list.ListCellRenderer)

setMenuRenderer

public void setMenuRenderer(ListCellRenderer menuRenderer)
Sets the Menu default renderer.

Parameters:
menuRenderer - the Menu default renderer
See Also:
getMenuRenderer()

setMenuIcons

public void setMenuIcons(Image select,
                         Image cancel,
                         Image menu)
Sets globally the Menu icons.

Parameters:
select - the select icon
cancel - the cancel icon
menu - the menu icon
See Also:
getMenuIcons()

getMenuIcons

public Image[] getMenuIcons()
Simple getter for the menu icons.

Returns:
an Image array at size of 3, where the first is the select image the second is the cancel image and the last is the menu image.
See Also:
setMenuIcons(com.sun.dtv.lwuit.Image, com.sun.dtv.lwuit.Image, com.sun.dtv.lwuit.Image)

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.