PanelConfiguration
Class FormsMakerPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--PanelConfiguration.PanelConfiguration
                          |
                          +--PanelConfiguration.FormsMakerPanel

public class FormsMakerPanel
extends PanelConfiguration
implements MouseListener

This class create a panel that can be used to draw forms.

Version:
1.0
Author:
Sebastien baehni
See Also:
FormsMakerPanel, Serialized Form

Field Summary
protected  Button colorButton
          The color button.
protected  MouseListener colorMouseListener
          The mouse listener for the color button.
protected  Panel eastPanel
          The panel that contains the negative checkbox and the color button.
protected  Choice formsChoice
          The shape choice.
protected  Label formsLabel
          The forms label.
protected  boolean formsMakerEnable
          If the user is simulating.
protected  boolean formsMakerPaintingDisable
          If the user is drawing a form.
protected  MouseListener formsMouseListener
          The mouse listener for the shape choice.
protected  GrayColorChooser grayColorChooser
          The gray color chooser.
protected  int lastColorClicked
          The color the user has choosen.
protected  Checkbox negativeCheckbox
          The checkbox for the negative image.
protected  MouseListener negativeMouseListener
          The mouse listener for the negative checkbox.
protected  Panel northEastPanel
          The panel that contains the negative checkbox.
protected  Panel northWestPanel
          The panel that contains the shapes choice.
protected  Panel southEastPanel
          The panel that contains the color button.
protected  Panel southWestPanel
          The panel that contains the texture choice.
protected  Choice textureChoice
          The texture choice.
protected  boolean textureChoosen
          If the user has choosen a texture or a color.
protected  Label textureLabel
          The texture label.
protected  MouseListener textureMouseListener
          The mouse listener for the texture choice.
protected  ToolPanel toolPanel
          This is the panel on which we display the help message.
protected  Panel westPanel
          The panel that contains the shapes choice and the texture choice.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
FormsMakerPanel()
          The second constructor.
FormsMakerPanel(Color backgroundColor)
          The constructor.
 
Method Summary
 boolean colorButtonEnabled()
          This method return if the color button is enabled or not.
 int colorChoosen()
          Return the rgb value of the color that the user has choosen.
 void disableFormsMaker()
          This method disable the panel and all his component.
 void disableFormsMakerPainting()
          This method disable the panel and all the component but only when the user is painting forms.
 void enableFormsMaker()
          This method enable the panel and all his component.
 int formsChoice()
          Return the forms that the user has choosen.
 boolean formsMakerEnable()
          This method return if the panel is enable or not.
 boolean formsMakerPaintingDisable()
          This method return if the panel is enable or not (used when the user is painting).
 GrayColorChooser grayColorChooser()
          Return the gray color chooser.
 void init(ToolPanel toolPanel)
          Initialisation of the panel.
protected  void initMouseListener()
          Initialisation of the mouse listener.
 void mouseClicked(MouseEvent e)
          When the mouse is clicked.
 void mouseEntered(MouseEvent e)
          When the mouse enters.
 void mouseExited(MouseEvent e)
          When the mouse exits.
 void mousePressed(MouseEvent e)
          When the mouse is pressed.
 void mouseReleased(MouseEvent e)
          When the mouse is released.
 boolean negativeChoosen()
          Return the state of the checkbox.
 void setText(String string)
          This method set the help message.
 int textureChoice()
          Return the texture mode.
 boolean textureChoosen()
          Return if the user has choosen a texture or a color.
 void textureChoosen(boolean choosen)
          Assign the textureChoosen boolean to a new value.
 
Methods inherited from class PanelConfiguration.PanelConfiguration
Disable, Enable
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

formsLabel

protected Label formsLabel
The forms label.

textureLabel

protected Label textureLabel
The texture label.

colorButton

protected Button colorButton
The color button.

formsChoice

protected Choice formsChoice
The shape choice.

textureChoice

protected Choice textureChoice
The texture choice.

negativeCheckbox

protected Checkbox negativeCheckbox
The checkbox for the negative image.

eastPanel

protected Panel eastPanel
The panel that contains the negative checkbox and the color button.

westPanel

protected Panel westPanel
The panel that contains the shapes choice and the texture choice.

northEastPanel

protected Panel northEastPanel
The panel that contains the negative checkbox.

southEastPanel

protected Panel southEastPanel
The panel that contains the color button.

northWestPanel

protected Panel northWestPanel
The panel that contains the shapes choice.

southWestPanel

protected Panel southWestPanel
The panel that contains the texture choice.

formsMouseListener

protected MouseListener formsMouseListener
The mouse listener for the shape choice.

textureMouseListener

protected MouseListener textureMouseListener
The mouse listener for the texture choice.

colorMouseListener

protected MouseListener colorMouseListener
The mouse listener for the color button.

negativeMouseListener

protected MouseListener negativeMouseListener
The mouse listener for the negative checkbox.

toolPanel

protected ToolPanel toolPanel
This is the panel on which we display the help message.
See Also:
ToolPanel

grayColorChooser

protected GrayColorChooser grayColorChooser
The gray color chooser.
See Also:
GrayColorChooser

textureChoosen

protected boolean textureChoosen
If the user has choosen a texture or a color.

formsMakerEnable

protected boolean formsMakerEnable
If the user is simulating.

formsMakerPaintingDisable

protected boolean formsMakerPaintingDisable
If the user is drawing a form.

lastColorClicked

protected int lastColorClicked
The color the user has choosen.
Constructor Detail

FormsMakerPanel

public FormsMakerPanel(Color backgroundColor)
The constructor.
Parameters:
backgroundColor - The background color of the panel.

FormsMakerPanel

public FormsMakerPanel()
The second constructor. The background color is white.
Method Detail

initMouseListener

protected void initMouseListener()
Initialisation of the mouse listener.

init

public void init(ToolPanel toolPanel)
Initialisation of the panel. We add the different button, choice and label component. We add also the the mouse listener to the components.
Parameters:
toolPanel - The panel on which we display the help.
See Also:
ToolPanel

enableFormsMaker

public void enableFormsMaker()
This method enable the panel and all his component.

disableFormsMaker

public void disableFormsMaker()
This method disable the panel and all his component.

disableFormsMakerPainting

public void disableFormsMakerPainting()
This method disable the panel and all the component but only when the user is painting forms.

formsMakerEnable

public boolean formsMakerEnable()
This method return if the panel is enable or not.
Returns:
True if the panel is enable.

formsMakerPaintingDisable

public boolean formsMakerPaintingDisable()
This method return if the panel is enable or not (used when the user is painting).
Returns:
True if the user is painting a form. False otherwise.

textureChoosen

public boolean textureChoosen()
Return if the user has choosen a texture or a color.
Returns:
True if the user has choosen a texture, false if he has choosen a color.

textureChoice

public int textureChoice()
Return the texture mode.
Returns:
The texture mode.

formsChoice

public int formsChoice()
Return the forms that the user has choosen.
Returns:
0 for the rectangle, 1 for the circle and 2 for the polygon.

colorChoosen

public int colorChoosen()
Return the rgb value of the color that the user has choosen.
Returns:
The rgb value of the gray color the user has choosen.

grayColorChooser

public GrayColorChooser grayColorChooser()
Return the gray color chooser. Very useful to acceed the gray color chooser in the internal mouse listener.
Returns:
The GrayColorChooser.
See Also:
GrayColorChooser

textureChoosen

public void textureChoosen(boolean choosen)
Assign the textureChoosen boolean to a new value.
Parameters:
choosen - The new value we want to set the boolean textureChoosen

colorButtonEnabled

public boolean colorButtonEnabled()
This method return if the color button is enabled or not. Very useful for the mouselistener.
Returns:
True is the button is enabled, false otherwise.

negativeChoosen

public boolean negativeChoosen()
Return the state of the checkbox.
Returns:
True is the checkbox is checked, false otherwise.

setText

public void setText(String string)
This method set the help message.
Parameters:
string - The help message.

mouseClicked

public void mouseClicked(MouseEvent e)
When the mouse is clicked.
Specified by:
mouseClicked in interface MouseListener
Parameters:
e - The MouseEvent.

mouseEntered

public void mouseEntered(MouseEvent e)
When the mouse enters.
Specified by:
mouseEntered in interface MouseListener
Parameters:
e - The MouseEvent.

mouseExited

public void mouseExited(MouseEvent e)
When the mouse exits.
Specified by:
mouseExited in interface MouseListener
Parameters:
e - The MouseEvent.

mousePressed

public void mousePressed(MouseEvent e)
When the mouse is pressed.
Specified by:
mousePressed in interface MouseListener
Parameters:
e - The MouseEvent.

mouseReleased

public void mouseReleased(MouseEvent e)
When the mouse is released.
Specified by:
mouseReleased in interface MouseListener
Parameters:
e - The MouseEvent.