public class DefaultLookAndFeel extends LookAndFeel implements FocusListener
Constructor and Description |
---|
DefaultLookAndFeel()
Creates a new instance of DefaultLookAndFeel
|
Modifier and Type | Method and Description |
---|---|
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,
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)
Invoked for drawing the Tab Pane widget
|
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 contentpane painter
|
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[] |
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[] |
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,
String text,
Image icon,
boolean isSelected,
boolean cellHasFocus,
Style cellStyle,
Style cellSelectedStyle,
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
|
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 String |
getTextFieldString(TextArea ta)
Similar to getText() but works properly with password fields
|
void |
setCheckBoxImages(Image checked,
Image unchecked)
Sets images for checkbox checked/unchecked modes
|
void |
setComboBoxImage(Image picker)
Sets image for the combo box dropdown drawing
|
void |
setRadioButtonImages(Image selected,
Image unselected)
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.
|
drawHorizontalScroll, drawVerticalScroll, getDefaultDialogTransitionIn, getDefaultDialogTransitionOut, getDefaultFormTintColor, getDefaultFormTransitionIn, getDefaultFormTransitionOut, getDefaultMenuTransitionIn, getDefaultMenuTransitionOut, getDefaultSmoothScrollingSpeed, getDisableColor, getHorizontalScrollHeight, getMenuIcons, getMenuRenderer, getTactileTouchDuration, getTickerSpeed, getVerticalScrollWidth, isDefaultEndsWith3Points, isDefaultSmoothScrolling, isDefaultTensileDrag, isFocusScrolling, isReverseSoftButtons, isRTL, isTouchMenus, refreshTheme, setDefaultDialogTransitionIn, setDefaultDialogTransitionOut, setDefaultEndsWith3Points, setDefaultFormTintColor, setDefaultFormTransitionIn, setDefaultFormTransitionOut, setDefaultMenuTransitionIn, setDefaultMenuTransitionOut, setDefaultSmoothScrolling, setDefaultSmoothScrollingSpeed, setDefaultTensileDrag, setDisableColor, setFG, setFocusScrolling, setMenuIcons, setMenuRenderer, setReverseSoftButtons, setRTL, setTactileTouchDuration, setTickerSpeed, setTouchMenus, uninstall
public DefaultLookAndFeel()
public void bind(Component cmp)
LookAndFeel
bind
in class LookAndFeel
cmp
- component instance that may be customized by the look and feelpublic void setTickWhenFocused(boolean tickWhenFocused)
tickWhenFocused
- public void setCheckBoxImages(Image checked, Image unchecked)
checked
- the image to draw in order to represent a checked checkboxunchecked
- the image to draw in order to represent an uncheck checkboxpublic void setComboBoxImage(Image picker)
picker
- picker imagepublic void setRadioButtonImages(Image selected, Image unselected)
selected
- the image to draw in order to represent a selected radio buttonunselected
- the image to draw in order to represent an unselected radio buttonpublic Image[] getRadioButtonImages()
public Image[] getCheckBoxImages()
public void drawButton(Graphics g, Button b)
LookAndFeel
drawButton
in class LookAndFeel
g
- graphics contextb
- component to drawpublic void drawCheckBox(Graphics g, Button cb)
LookAndFeel
drawCheckBox
in class LookAndFeel
g
- graphics contextcb
- component to drawpublic void drawLabel(Graphics g, Label l)
LookAndFeel
drawLabel
in class LookAndFeel
g
- graphics contextl
- component to drawpublic void drawRadioButton(Graphics g, Button rb)
LookAndFeel
drawRadioButton
in class LookAndFeel
g
- graphics contextrb
- component to drawpublic void drawComboBox(Graphics g, List cb)
LookAndFeel
drawComboBox
in class LookAndFeel
g
- graphics contextcb
- component to drawpublic void drawList(Graphics g, List l)
LookAndFeel
drawList
in class LookAndFeel
g
- graphics contextl
- component to drawpublic void drawTextArea(Graphics g, TextArea ta)
LookAndFeel
drawTextArea
in class LookAndFeel
g
- graphics contextta
- component to drawpublic Dimension getButtonPreferredSize(Button b)
LookAndFeel
getButtonPreferredSize
in class LookAndFeel
b
- component whose size should be calculatedpublic Dimension getCheckBoxPreferredSize(Button cb)
LookAndFeel
getCheckBoxPreferredSize
in class LookAndFeel
cb
- component whose size should be calculatedpublic Dimension getLabelPreferredSize(Label l)
LookAndFeel
getLabelPreferredSize
in class LookAndFeel
l
- component whose size should be calculatedpublic Dimension getListPreferredSize(List l)
LookAndFeel
getListPreferredSize
in class LookAndFeel
l
- component whose size should be calculatedpublic Dimension getRadioButtonPreferredSize(Button rb)
LookAndFeel
getRadioButtonPreferredSize
in class LookAndFeel
rb
- component whose size should be calculatedpublic Dimension getTextAreaSize(TextArea ta, boolean pref)
LookAndFeel
getTextAreaSize
in class LookAndFeel
ta
- component whose size should be calculatedpref
- indicates whether preferred or scroll size should be returnedprotected int drawLabelText(Graphics g, Label l, String text, int x, int y, int textSpaceW)
g
- graphics contextl
- label componenttext
- the text for the labelx
- position for the labely
- position for the labeltextSpaceW
- the width available for the componentpublic Dimension getComboBoxPreferredSize(List cb)
LookAndFeel
getComboBoxPreferredSize
in class LookAndFeel
cb
- component whose size should be calculatedpublic void drawTabbedPane(Graphics g, TabbedPane tp)
LookAndFeel
drawTabbedPane
in class LookAndFeel
g
- graphics contexttp
- component to drawpublic Component getTabbedPaneCell(TabbedPane tp, String text, Image icon, boolean isSelected, boolean cellHasFocus, Style cellStyle, Style cellSelectedStyle, Style tabbedPaneStyle, int cellOffsetX, int cellOffsetY, Dimension cellsPreferredSize, Dimension contentPaneSize)
LookAndFeel
getTabbedPaneCell
in class LookAndFeel
tp
- the TabbedPanetext
- the cell texticon
- the cell icon imageisSelected
- is the cell is the selected onecellHasFocus
- is the cell has focuscellStyle
- the cell Style objectcellSelectedStyle
- the selected style for the cell objecttabbedPaneStyle
- the TabbedPane Style objectcellOffsetX
- the offset when the cell is on TOP or BOTTOM orientationcellOffsetY
- the offset when the cell is on LEFT or RIGHT orientationcellsPreferredSize
- the total cells PreferredSizecontentPaneSize
- the contentPaneSizepublic void drawTabbedPaneContentPane(TabbedPane tp, Graphics g, Rectangle rect, Dimension cellsPreferredSize, int numOfTabs, int selectedTabIndex, Dimension tabsSize, int cellOffsetX, int cellOffsetY)
LookAndFeel
drawTabbedPaneContentPane
in class LookAndFeel
tp
- the TabbedPaneg
- the content pane graphicsrect
- the content pane painting rectangle areacellsPreferredSize
- the total cells PreferredSizenumOfTabs
- number of tabsselectedTabIndex
- the selected tab indextabsSize
- the tabs sizecellOffsetX
- the offset when the cell is on TOP or BOTTOM orientationcellOffsetY
- the offset when the cell is on LEFT or RIGHT orientationprotected String getTextFieldString(TextArea ta)
public void drawTextField(Graphics g, TextArea ta)
LookAndFeel
drawTextField
in class LookAndFeel
g
- graphics contextta
- component to drawpublic Dimension getTextFieldPreferredSize(TextArea ta)
LookAndFeel
getTextFieldPreferredSize
in class LookAndFeel
ta
- component whose size should be calculatedpublic void drawTextFieldCursor(Graphics g, TextArea ta)
LookAndFeel
drawTextFieldCursor
in class LookAndFeel
g
- graphics contextta
- component to drawpublic void focusGained(Component cmp)
FocusListener
focusGained
in interface FocusListener
cmp
- the component that gains focuspublic void focusLost(Component cmp)
FocusListener
focusLost
in interface FocusListener
cmp
- the component that lost focus