: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
Screen Shots
On-line Demos
Requirements
Further Plans
Docs
Tutorial
How-to (PDF)
API
FAQ
Download
Latest version

Home > J2SE > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

org.zaval.lw
Class LwColorPanel

java.lang.Object
  |
  +--org.zaval.lw.LwCanvas
        |
        +--org.zaval.lw.LwPanel
              |
              +--org.zaval.lw.LwColorPanel
All Implemented Interfaces:
java.util.EventListener, Layoutable, LayoutContainer, LwActionListener, LwComponent, LwContainer, TextListener, Validationable

public class LwColorPanel
extends LwPanel
implements LwActionListener, TextListener

This panel provides ability to customize color using different ways :

  • By the specifying RGB color components in the text fields.
  • By the specifying RGB color components using sliders.
  • By the selecting one of the predefined color. The predefined colors set is specified by the properties. The properties has the following format:
             colors.rows=[number of rows]
             colors.cols=[number of columns]
    
             colors.row.[row number]=[red1],[green1],[blue1];[red2],[green2],[blue2]...[redN],[greenN],[blueN]
             ...
          
Register an action listener to be notified whenever a selected color has been changed.

The panel reads fields titles as the following LwVCL resources:
cd.predef predefined color panel title
cd.selected selected color field title
cd.red red color field title
cd.green green color field title
cd.blue blue color field title


Fields inherited from class org.zaval.lw.LwPanel
children
 
Fields inherited from class org.zaval.lw.LwCanvas
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y
 
Constructor Summary
LwColorPanel()
          Constructs a color panel.
LwColorPanel(java.awt.Color c, java.util.Properties p)
          Constructs a color panel with the given selected color and the given properties to specify a predefined colors set.
LwColorPanel(java.awt.Color c, java.lang.String props)
          Constructs a color panel with the given selected color and the given properties file to specify a predefined colors set.
 
Method Summary
 void actionPerformed(java.lang.Object target, java.lang.Object data)
          Invoked when an action event occurred.
 void addActionListener(LwActionListener l)
          Adds the specified action listener to receive action events from this component.
protected  LwLayout getDefaultLayout()
          Gets the default layout manager that is set with the container during initialization.
 java.awt.Color getSelectedColor()
          Gets the current selected color.
 void removeActionListener(LwActionListener l)
          Removes the specified action listener so it no longer receives action events from this component.
 void setSelectedColor(java.awt.Color c)
          Sets the specified color as the selected color.
 void textInserted(TextEvent e)
          Invoked when a new text has been inserted in the text.
 void textRemoved(TextEvent e)
          Invoked when a part of the text has been removed.
 void textUpdated(TextEvent e)
          Invoked when the text has been updated.
 
Methods inherited from class org.zaval.lw.LwPanel
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, getPreferredSize, indexOf, insert, insert, invalidate, isInvalidatedByChild, laidout, paintOnTop, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, setSize, toFront, updateCashedPs, validate
 
Methods inherited from class org.zaval.lw.LwCanvas
calcInsets, canHaveFocus, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwParent, getOrigin, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isValid, isVisible, paint, recalc, repaint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setViewMan, setVisible, update, viewManChanged, vrp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.LwComponent
canHaveFocus, getBackground, getLwParent, getOrigin, getViewMan, getVisiblePart, isEnabled, isOpaque, paint, repaint, repaint, repaint, setEnabled, setInsets, setLwParent, setViewMan, setVisible, update
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getSize, getWidth, getX, getY, isVisible, setLocation
 
Methods inherited from interface org.zaval.util.Validationable
isValid
 

Constructor Detail

LwColorPanel

public LwColorPanel()
Constructs a color panel. In this case the predefined colors set is loaded by "colors.properties" properties file.

LwColorPanel

public LwColorPanel(java.awt.Color c,
                    java.lang.String props)
Constructs a color panel with the given selected color and the given properties file to specify a predefined colors set. The properties file will be fetched relatively LwVCL base (the current base can be got by the LwToolkit.getResourcesBase method) directory.
Parameters:
c - the given selected color.
props - the given properties file.

LwColorPanel

public LwColorPanel(java.awt.Color c,
                    java.util.Properties p)
Constructs a color panel with the given selected color and the given properties to specify a predefined colors set.
Parameters:
c - the given selected color.
p - the given properties.
Method Detail

addActionListener

public void addActionListener(LwActionListener l)
Adds the specified action listener to receive action events from this component. The action event is performed whenever a selected color has been changed. The action event stores the new color value in the event data field.
Parameters:
l - the specified action listener.

removeActionListener

public void removeActionListener(LwActionListener l)
Removes the specified action listener so it no longer receives action events from this component.
Parameters:
l - the specified action listener.

actionPerformed

public void actionPerformed(java.lang.Object target,
                            java.lang.Object data)
Description copied from interface: LwActionListener
Invoked when an action event occurred.
Specified by:
actionPerformed in interface LwActionListener
Following copied from interface: org.zaval.lw.event.LwActionListener
Parameters:
src - the specified source where the event has been originated.
data - the event data.

setSelectedColor

public void setSelectedColor(java.awt.Color c)
Sets the specified color as the selected color.
Parameters:
c - the specified color to set as selected.

getSelectedColor

public java.awt.Color getSelectedColor()
Gets the current selected color.
Returns:
a current selected color.

textRemoved

public void textRemoved(TextEvent e)
Description copied from interface: TextListener
Invoked when a part of the text has been removed.
Specified by:
textRemoved in interface TextListener
Following copied from interface: org.zaval.data.event.TextListener
Parameters:
e - the text event.

textInserted

public void textInserted(TextEvent e)
Description copied from interface: TextListener
Invoked when a new text has been inserted in the text.
Specified by:
textInserted in interface TextListener
Following copied from interface: org.zaval.data.event.TextListener
Parameters:
e - the text event.

textUpdated

public void textUpdated(TextEvent e)
Description copied from interface: TextListener
Invoked when the text has been updated.
Specified by:
textUpdated in interface TextListener
Following copied from interface: org.zaval.data.event.TextListener
Parameters:
e - the text event.

getDefaultLayout

protected LwLayout getDefaultLayout()
Description copied from class: LwPanel
Gets the default layout manager that is set with the container during initialization. This implementation of the method returns LwRastLayout as the default layout manager, the layout manager is got as a static object by "def.lay" key.
Overrides:
getDefaultLayout in class LwPanel
Following copied from class: org.zaval.lw.LwPanel
Returns:
a layout manager.


: up