John W. Campbell
This class provides a simple panel for drawing on, using an object
supporting the JdlDrawPanelDrawer interface.
Class, constructor and methods:
Class Details
Accessible Fields
Constructor
Panel Drawer Methods
Panel Size Methods
Overriden Superclass Methods
- Package:
- Jdl.JdlView;
- Class name:
- JdlDrawPanel
- Class definition:
- public class JdlDrawPanel
- Extends:
- JPanel
- Implements:
- Scrollable
- Actions:
- none
The following accessible fields have been defined:
- static final long serialVersionUID
Two constructors are available.
Constructor:
Constructor 1
Default constructor
Constructs a draw panel with a requested width and height.
- Constructor Definition:
- public JdlDrawPanel (int w, int h)
- Parameters List:
- w
- The panel width required.
- h
- The panel height required.
Constructs draw with default resources (height = 25, width = 25).
- Constructor Definition:
- public JdlDrawPanel()
- Parameters List:
- none
This section contains methods for setting and getting the panel drawer
resources.
Methods:
Set drawer - setDrawer
Get drawer - getDrawer
Get drawer ID - getDrawerId
This method sets the JdlDrawPanelDrawer object resource.
- Method Definition:
- public void setDrawer (JdlDrawPanelDrawer dr, int id)
- Parameters List:
- dr
- A JdlDrawPanelDrawer interfaced object to carry out the
drawing on the panel (default = null). Its jdl_draw_panel_drawer method
is called from the paint routine after the border has been drawn.
- id
- Identifier to be passed to the drawing method when called.
This method returns the JdlDrawPanelDrawer object resource.
- Method Definition:
- public JdlDrawPanelDrawer getDrawer()
- Parameters List:
- none
- Method Return:
-
Returns the currently installed JdlDrawPanelDrawer object or
null if none has been set up.
This method returns the JdlDrawPanelDrawer identifier resource.
- Method Definition:
- public int getDrawerId()
- Parameters List:
- none
- Method Return:
-
Returns the identifier of the currently installed JdlDrawPanelDrawer
object.
This section contains methods to set and get the panel height and width
resources.
Methods:
Set panel height - setPanelHeight
Get panel height - getPanelHeight
Set panel width - setPanelWidth
Get panel width - getPanelWidth
This method sets the panel height resource.
- Method Definition:
- public void setPanelHeight (int height)
- Parameters List:
- height
- The required panel height in pixels.
This method returns the panel height resource.
- Method Definition:
- public int getPanelHeight()
- Parameters List:
- none
- Method Return:
-
Returns the requested panel height in pixels.
This method sets the panel width resource.
- Method Definition:
- public void setPanelWidth (int width)
- Parameters List:
- width
- The required panel width in pixels.
This method returns the panel width resource.
- Method Definition:
- public int getPanelWidth()
- Parameters List:
- none
- Method Return:
-
Returns the requested panel width in pixels.
This section contains methods which override the corresponding superclass
methods. These are basically standard for JdlView objects and comprise
methods to set background and foreground colours and to get the minimum
and preferred sizes for the object. (The paintComponent method is also
over-ridden but is not normally called by the user).
Methods:
Set background - setBackground
Set foreground - setForeground
Get minimum size - getMinimumSize
Get preferred size - getPreferredSize
This method sets the background colour resource.
- Method Definition:
- public void setBackground (Color c)
- Parameters List:
- c
- The color to become this object's background color.
This method sets the foreground colour resource.
- Method Definition:
- public void setForeground (Color c)
- Parameters List:
- c
- The color to become this object's foreground color.
This method returns the minimum size of the component.
- Method Definition:
- public Dimension getMinimumSize()
- Parameters List:
- none
This method returns the preferred size of the component.
- Method Definition:
- public Dimension getPreferredSize()
- Parameters List:
- none
⇑ Up 3
⇑ Up 2
⇑ Up 1
⇑ Top of this