John W. Campbell
This class provides a framed panel for drawing on or for sub-classing to
make buttons etc.
Class, fields, constructor and methods:
Class Details
Accessible Fields
Constructors
Set/Get Framed Panel Resources
Framed Panel Drawer Methods
Standard Positioning and Sizing
Overriden Superclass Methods
- Package:
- Jdl.JdlView;
- Class name:
- JdlFramedPanel
- Class definition:
- public class JdlFramedPanel
- Extends:
- JPanel
- Implements:
- none
- Actions:
- none
The following accessible fields have been defined:
- public final static int SOLID_FRAME
- Frame type option: solid.
- public final static int RAISED_FRAME
- Frame type option: raised.
- public final static int INSET_FRAME
- Frame type option: inset.
- public final static int ETCHED_OUT_FRAME
- Frame type option: etched out.
- public final static int ETCHED_IN_FRAME
- Frame type option: etched in.
- public final static int PREFERRED
- Size Constraint: preferred size.
- public final static int FREE
- Size/Location Constraint: free.
- static final long serialVersionUID
Three constructors are available.
Constructor:
Default constructor
Constructor 2
Constructor 3
Constructs a framed panel with default resources (height=10, width=25, inset
frame, background based colours).
- Constructor Definition:
- public JdlFramedPanel ()
- Parameters List:
- none
Constructs a framed panel with a given size (inset frame, background based
colours).
- Constructor Definition:
- public JdlFramedPanel (int w, int h)
- Parameters List:
- w
- The required width in pixels (including frame).
- h
- The required height in pixels (including frame).
Constructs a framed panel with a given size and frame colours (inset frame).
- Constructor Definition:
- public JdlFramedPanel (int w, int h, Color fill, Color brdr, Color brdr_brighter, Color brdr_darker)
- Parameters List:
- w
- The required width in pixels (including frame).
- h
- The required height in pixels (including frame).
- fill
- The fill colour for the panel. If null (the default), then the
background colour will be used.
- brdr
- The border colour - sets the colour for a solid border.
- brdr_brighter
- A brighter colour for a three dimensional button border.
- brdr_darker
- A darker colour for a three dimensional button border.
This section has a series of methods to set and get values of the
objects resources including colours, border type and thickness and
panel size.
Methods:
Set border colour - setBorderColor
Set border colour - setBorderColor
Get border colour - getBorderColor
Set border thickness - setBorderThickness
Get border thickness - getBorderThickness
Set border type - setBorderType
Get border type - getBorderType
Set fill colour - setFillColor
Get fill colour - getFillColor
Set panel height - setPanelHeight
Get panel height - getPanelHeight
Set panel width - setPanelWidth
Get panel width - getPanelWidth
This method sets the border colour resource.
- Method Definition:
- public void setBorderColor (Color colr)
- Parameters List:
- colr
- The border colour - sets this colour for a solid border or
lighter and darker shades of if for a three dimensional button border.
If null (the default), use the background colour if a three dimensional
button or the foreground colour if the button has a solid border.
This method sets the border colour resources.
- Method Definition:
- public void setBorderColor (Color colr, Color brighter, Color darker)
- Parameters List:
- colr
- The border colour - sets the colour for a solid border.
- brighter
- A brighter colour for a three dimensional button border.
- darker
- A darker colour for a three dimensional button border.
This method returns the border colour resource.
- Method Definition:
- public Color getBorderColor()
- Parameters List:
- none
- Method Return:
-
Returns the border colour resource as set.
This method sets the border thickness resource.
- Method Definition:
- public void setBorderThickness (int border)
- Parameters List:
- thickness
- This is the required border thickness in pixels.
(default = 4)
This method returns the border thickness resource.
- Method Definition:
- public int getBorderThickness()
- Parameters List:
- none
- Method Return:
-
Returns the border thickness in pixels.
This method sets the border type resource.
- Method Definition:
- public void setBorderType (int type)
- Parameters List:
- type
- Border type flag:
= 0, solid
= 1, raised
= 2, inset (the default)
= 3, etched out
= 4, etched in
(May use variables SOLID_FRAME, RAISED_FRAME, INSET_FRAME, ETCHED_OUT_FRAME,
ETCHED_IN_FRAME).
This method returns the border type resource.
- Method Definition:
- public int getBorderType()
- Parameters List:
- none
- Method Return:
-
Returns the current border type flag (see setBorderType(..) method
for details).
This method sets the fill colour resource.
- Method Definition:
- public void setFillColor (Color fill_color)
- Parameters List:
- colr
- The fill colour for the panel. If null (the default), then the
background colour will be used.
This method returns the fill colour resource.
- Method Definition:
- public Color getFillColor()
- Parameters List:
- none
- Method Return:
-
Returns the current value of the fill colour resource.
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 for setting and getting the panel drawer
resources.
Methods:
Set drawer - setDrawer
Get drawer - getDrawer
Get drawer ID - getDrawerId
This method sets the JdlFramedPanelDrawer object resource.
- Method Definition:
- public void setDrawer (JdlFramedPanelDrawer dr, int id)
- Parameters List:
- dr
- A JdlFramedPanelDrawer interfaced object to carry out the
drawing on the panel (default = null). Its jdl_framed_panel_drawer method
is called from the paint routine after the border has been drawn and after
a clip area within the border has been set. Note that the coordinate
origin remains as that of the complete panel including the border.
- id
- Identifier to be passed to the drawing method when called.
This method returns the JdlFramedPanelDrawer object resource.
- Method Definition:
- public JdlFramedPanelDrawer getDrawer()
- Parameters List:
- none
- Method Return:
-
Returns the currently installed JdlFramedPanelDrawer object or
null if none has been set up.
This method returns the JdlFramedPanelDrawer identifier resource.
- Method Definition:
- public int getDrawerId()
- Parameters List:
- none
- Method Return:
-
Returns the identifier of the currently installed JdlFramedPanelDrawer
object.
This section contains the standard methods for positioning and sizing
JdlView objects and getting the current minimum height and width values.
Methods:
Set position constraints - setLocationConstraints
Set size constraints - setSizeConstraints
Set constraints on the Jdl object positioning.
- Method Definition:
- public void setLocationConstraints (int constraint_x, int constraint_y)
- Parameters List:
- constraint_x
- Constrain the Jdl Object 'x' position = the required
Jdl Object 'x' position (overrides setLocation method) or FREE if the 'x'
position may be set by the setLocation method and hence possibly by the
layout manager.
- constraint_y
- Constrain the Jdl Object 'y' position = the required
the Jdl Object 'y'position (overrides setLocation method) or FREE if the 'y'
position may be set by the setLocation method and hence possibly by the
layout manager.
Set constraints on the Jdl Object resizing permitted.
- Method Definition:
- public void setSizeConstraints (int constraint_w, int constraint_h)
- Parameters List:
- constraint_w
- Constrain the Jdl Object width = the required
Jdl Object width, or PREFERRED (default) if the width is to be calculated
from the current resources, or FREE if the width may be resized to anything
greater than the minimum width required.
- constraint_h
- Constrain the Jdl Object height = the required
Jdl Object height, or PREFERRED (default) if the height is to be calculated
from the current resources, or FREE if the height may be resized to anything
greater than the minimum height required.
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
Set size - setSize
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
This method sets the panel width and panel height.
- Method Definition:
- public void setSize(int w, int h)
- Parameters List:
- w
- The required panel width in pixels.
- h
- The required panel height in pixels.
⇑ Up 3
⇑ Up 2
⇑ Up 1
⇑ Top of this