jdraw.drawing_options_ui
Class ForegroundColorMenu

java.lang.Object
  |
  +--mvp.View
        |
        +--jdraw.drawing_options_ui.ForegroundColorMenu
All Implemented Interfaces:
java.util.Observer

public class ForegroundColorMenu
extends mvp.View

Class ForegroundColorMenu is the pulldown menu for Foreground color selection. The ForegroundColorMenu widget is a JMenu. Anonymous instances of JMenuItem are defined for each menu item.


Field Summary
protected  BrushPatternColor bpc
          Instance of the companion Model class
protected  javax.swing.JColorChooser colorChooser
          A Generic JColorChooser for selecting foreground color.
protected  javax.swing.JDialog colorDialog
          A Dialog in which to put the Color Chooser.
 
Fields inherited from class mvp.View
editable, model, screen, shown, widget, window
 
Constructor Summary
ForegroundColorMenu(mvp.Screen screen, BrushPatternColor bpc, BrushPatternColorUI bpcUI)
          Construct the menu with the given BrushPatternColor model.
 
Method Summary
protected  void addBlack()
          Add the 'Black' menu item.
protected  void addBlue()
          Add the 'Blue' menu item.
protected  void addDarkGray()
          Add the 'Dark Gray' menu item.
protected  void addEdit()
          Add the 'Edit ...' menu item.
protected  void addGray()
          Add the 'Gray' menu item.
protected  void addGreen()
          Add the 'Green' menu item.
protected  void addLightGray()
          Add the 'Light Gray' menu item.
protected  void addPink()
          Add the 'Pink' menu item.
protected  void addRed()
          Add the 'Red' menu item.
protected  void addWhite()
          Add the 'White' menu item.
protected  void addYellow()
          Add the 'yellow' menu item.
 java.awt.Component compose()
          Compose the menu items into the pulldown.
 void okNewColor()
          This function is called by JColorChooser.okButtonClicked().
 
Methods inherited from class mvp.View
getModel, getWidget, getWindow, hide, isEditable, isShown, run, setEditable, setModel, show, show, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bpc

protected BrushPatternColor bpc
Instance of the companion Model class

colorChooser

protected javax.swing.JColorChooser colorChooser
A Generic JColorChooser for selecting foreground color.

colorDialog

protected javax.swing.JDialog colorDialog
A Dialog in which to put the Color Chooser.
Constructor Detail

ForegroundColorMenu

public ForegroundColorMenu(mvp.Screen screen,
                           BrushPatternColor bpc,
                           BrushPatternColorUI bpcUI)
Construct the menu with the given BrushPatternColor model. Also construct the local Color Chooser and Dialog.
Parameters:
screen - - The Screen object to be passed to parent constructor.
bpc - - The BrushPatternColor object to be passed to parent constructor and set as this.bpc.
bpcUI - - The BrushPatternColorUI view object.
Method Detail

compose

public java.awt.Component compose()
Compose the menu items into the pulldown.
Overrides:
compose in class mvp.View

okNewColor

public void okNewColor()
This function is called by JColorChooser.okButtonClicked(). It calls selectForeGroundColor with the current color on the colorChooser.

addGray

protected void addGray()
Add the 'Gray' menu item. Invokes BrushPatternColor.selectForegroundColor(Color.gray) method.

addWhite

protected void addWhite()
Add the 'White' menu item. Invokes BrushPatternColor.selectForegroundColor(Color.white) method.

addLightGray

protected void addLightGray()
Add the 'Light Gray' menu item. Invokes BrushPatternColor.selectForegroundColor(Color.lightGray) method.

addDarkGray

protected void addDarkGray()
Add the 'Dark Gray' menu item. Invokes BrushPatternColor.selectForegroundColor(Color.darkGray) method.

addPink

protected void addPink()
Add the 'Pink' menu item. Invokes BrushPatternColor.selectForegroundColor(new Color(255, 0, 255)) method.

addYellow

protected void addYellow()
Add the 'yellow' menu item. Invokes BrushPatternColor.selectForegroundColor(Color.yellow) method.

addGreen

protected void addGreen()
Add the 'Green' menu item. Invokes BrushPatternColor.selectForegroundColor(Color.green) method.

addBlue

protected void addBlue()
Add the 'Blue' menu item. Invokes BrushPatternColor.selectBackgroundColor(Color.blue) method.

addBlack

protected void addBlack()
Add the 'Black' menu item. Invokes BrushPatternColor.selectBackgroundColor(Color.black) method.

addRed

protected void addRed()
Add the 'Red' menu item. Invokes BrushPatternColor.selectForegroundColor(Color.red) method.

addEdit

protected void addEdit()
Add the 'Edit ...' menu item. Invokes the fileChooser dialog;