uk.ac.starlink.ast.gui
Class LineControls

java.lang.Object
  extended by uk.ac.starlink.ast.gui.LineControls

public class LineControls
extends Object

LineControls add a series of controls for showing and changing the display properties of any drawn lines (the thickness, style and colour).

This class assumes that it will be laying out its components as part of a GridBagLayouter scheme. It adds the controls in a set of incrementing rows, starting from the current GridBagLayouter position.

Users of this class should register a ChangeListener to be informed when the line properties are changed (get the actual value using the get methods).

Version:
$Id$
Author:
Peter W. Draper

Field Summary
protected  JButton colourButton
          Colour button.
protected  ColourIcon colourIcon
          Colour Icon of colour button.
protected  GridBagLayouter layouter
          The GridBagLayouter.
protected  EventListenerList listeners
           
protected  AstStyleBox styleBox
          Style selection.
protected  JComboBox thickBox
          List of pre-selected thicknesses.
 
Constructor Summary
LineControls(GridBagLayouter layouter, String postfix)
          Construct an instance using the given GridBagLayouter to arrange the components.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Registers a listener who wants to be informed about changes.
protected  void changeStyle()
          Send event to signal the line style has changed.
protected  void changeThick()
          Send event to signal a line thickness change event.
protected  void chooseColour()
          Create a dialog to select a new colour.
protected  void fireChanged()
          Send ChangeEvent event to all listeners.
 Color getColour()
          Return the current colour.
 int getStyle()
          Return the current line style (as AST integer).
 int getThick()
          Return the current line thickness.
 void reset()
          Reset controls to defaults.
 void setColour(Color colour)
          Set the current colour.
 void setStyle(int style)
          Set the current line style (as AST integer).
 void setThick(int thick)
          Set the current line thickness.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colourButton

protected JButton colourButton
Colour button.


colourIcon

protected ColourIcon colourIcon
Colour Icon of colour button.


styleBox

protected AstStyleBox styleBox
Style selection.


thickBox

protected JComboBox thickBox
List of pre-selected thicknesses.


layouter

protected GridBagLayouter layouter
The GridBagLayouter. Used to get parent component access.


listeners

protected EventListenerList listeners
Constructor Detail

LineControls

public LineControls(GridBagLayouter layouter,
                    String postfix)
Construct an instance using the given GridBagLayouter to arrange the components. Use the given postfix to qualify the standard labels.

Method Detail

reset

public void reset()
Reset controls to defaults.


changeThick

protected void changeThick()
Send event to signal a line thickness change event.


setThick

public void setThick(int thick)
Set the current line thickness.


getThick

public int getThick()
Return the current line thickness.


changeStyle

protected void changeStyle()
Send event to signal the line style has changed.


setStyle

public void setStyle(int style)
Set the current line style (as AST integer).


getStyle

public int getStyle()
Return the current line style (as AST integer).


chooseColour

protected void chooseColour()
Create a dialog to select a new colour.


getColour

public Color getColour()
Return the current colour.


setColour

public void setColour(Color colour)
Set the current colour.


addChangeListener

public void addChangeListener(ChangeListener l)
Registers a listener who wants to be informed about changes.

Parameters:
l - the ChangeListener listener.

fireChanged

protected void fireChanged()
Send ChangeEvent event to all listeners.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.