3.7.5 - Split Title - JdlSplitTitle

John W. Campbell

3.7.5.1 Introduction

This class provides a horizontal title which may be split into adjustable ranges (right overlapping left).

Class, fields, constructor and methods:

Class Details
Accessible Fields
Constructor
Operational Methods
Using Scrolling
Resource Methods
Standard Positioning and Sizing
Add/Remove Action Listener
Overriden Superclass Methods

3.7.5.2 Class Details

Package:
Jdl.JdlView;
Class name:
JdlSplitTitle
Class definition:
public class JdlSplitTitle
Extends:
JPanel
Implements:
JdlDrawPanelDrawer
MouseListener
MouseMotionListener
Actions:
An action event will be generated when a boundary has been moved and the mouse button released. If required, action events may also be generated which track the boundary movement continuously. The associated object is the string "boundary change" in the former case and "boundary motion" in the latter case.

3.7.5.3 Accessible Fields

The following accessible fields have been defined:

public final static int PREFERRED
Size Constraint: preferred size.
public final static int FREE
Size/Location Constraint: free.
static final long serialVersionUID

3.7.5.4 Constructor

3.7.5.4.1 Introduction

A single constructor is available.

Constructor:

Standard constructor

3.7.5.4.2 Standard constructor

Constructs a slider with the default resources.

Constructor Definition:
public JdlSplitTitle(int w, int h, int npart, int[] start_x, Font font, boolean allow_scroll)
Parameters List:
w
Initial width
h
initial height
npart
Number of parts (>=1) (npart-1 boundaries).
start_x
Array of 'npart-1' (see constructor) boundary values (minimum separation 10 pixels).
font
Font for title.
allow_scroll
If true, allow for horizontal scrolling. If false, use the fixed width only.

3.7.5.5 Operational Methods

3.7.5.5.1 Introduction

This section contains the main methods used with normal operation of the object.

Methods:

Set boundary values - setBoundaryValues
Get boundary values - getBoundaryValues
Set titles - setTitles

3.7.5.5.2 Set boundary values - setBoundaryValues

This method sets the required boundary values.

Method Definition:
public void setBoundaryValues (int[] start_x)
Parameters List:
start_x
Array of 'npart-1' (see constructor) boundary values (minimum separation 10 pixels).

3.7.5.5.3 Get boundary values - getBoundaryValues

This method returns the current boundary values.

Method Definition:
public void getBoundaryValues (int[] start_x)
Parameters List:
start_x
Array of 'npart-1' (see constructor) boundary values returned

3.7.5.5.4 Set titles - setTitles

This method sets the required title strings.

Method Definition:
public void setTitles (String[] titles)
Parameters List:
titles
Title strings for 'npart' (see constructor) titles.

3.7.5.6 Using Scrolling

3.7.5.6.1 Introduction

These methods are used if the split title object is to be used in conjunction with an associated scrollable pane for which it is the the title line.

Methods:

Set Pane Width - setWidthFromScrollPane
Get viewport position - getViewportPosition
Set viewport position - setViewportPosition
Return viewport rectangle - getViewportRectangle
Get current width - getCurrentFullWidth

3.7.5.6.2 Set Pane Width - setWidthFromScrollPane

This method is used to pass the width of the associated scrollable pane to the JdlSplitTitle object. The maximum width for the JdlSplitTitle's title information (use getCurrentFullWidth()) and the maximum width for the associated scrollable pane should be found and the larger of these two values should be passed to the object (this method) and also to the associated scrollable pane so that both will have the same size.

Method Definition:
public void setWidthFromScrollPane (int width)
Parameters List:
width
The width of the associated scrollable pane.

3.7.5.6.3 Get viewport position - getViewportPosition

Returns the current viewport 'x' position of the JdlSplitTitle's internal JScrollPane. Will return 0 if scrolling not allowed.

Method Definition:
public int getViewportPosition()
Parameters List:
none

3.7.5.6.4 Set viewport position - setViewportPosition

Sets a new viewport 'x' position for the JdlSplitTitle's internal JScrollPane.

Method Definition:
public void setViewportPosition(int x)
Parameters List:
x
the new start position for the viewport

3.7.5.6.5 Return viewport rectangle - getViewportRectangle

Returns the current viewport rectangle of the JdlSplitTitle's internal JScrollPane. (null if no scrolling).

Method Definition:
public Rectangle getViewportRectangle()
Parameters List:
none

3.7.5.6.6 Get current width - getCurrentFullWidth

This method returns the width currently required to output all the title information with the boundaries in their current position. If the width required is less than the current width of the title area, the current width of the title_area will be returned.

Method Definition:
public int getCurrentFullWidth()
Parameters List:
none

3.7.5.7 Resource Methods

3.7.5.7.1 Introduction

This section has methods to set/get the resources associated with the object determining its appearance and mode of action.

Methods:

Set monitor mode - setContinuousMonitor
Get monitor mode - getContinuousMonitor

3.7.5.7.2 Set monitor mode - setContinuousMonitor

This method sets the continuous monitor resource.

Method Definition:
public void setContinuousMonitor(boolean flag)
Parameters List:
flag
Set to true for continuous monitoring of boundary values (via action events) as the boundary is dragged (default = false).

3.7.5.7.3 Get monitor mode - getContinuousMonitor

This method returns the continuous monitor resource.

Method Definition:
public boolean getContinuousMonitor()
Parameters List:
none
Method Return:
Returns the current value of the continuous monitor resource flag.

3.7.5.8 Standard Positioning and Sizing

3.7.5.8.1 Introduction

This section contains the standard methods for positioning and sizing the object.

Methods:

Set position constraints - setLocationConstraints
Set size constraints - setSizeConstraints
Set minimum height - setMinimumHeight
Set minimum width - setMinimumWidth

3.7.5.8.2 Set position constraints - setLocationConstraints

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.

3.7.5.8.3 Set size constraints - setSizeConstraints

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.

3.7.5.8.4 Set minimum height - setMinimumHeight

Set the minimum height resource.

Method Definition:
public void setMinimumHeight(int minh)
Parameters List:
minh
The minimum height required for the object (ignored if less than that required by the minimum layout) (default = 0).

3.7.5.8.5 Set minimum width - setMinimumWidth

Set the minimum width resource.

Method Definition:
public void setMinimumWidth(int minw)
Parameters List:
minh
The minimum width required for the object (ignored if less than that required by the minimum layout) (default = 0).

3.7.5.9 Add/Remove Action Listener

3.7.5.9.1 Introduction

This section has methods to add or remove an action listener.

Methods:

Add action listener - addActionListener
Remove action listener - removeActionListener

3.7.5.9.2 Add action listener - addActionListener

This adds the specified action listener to receive action events from this object.

Method Definition:
public void addActionListener(ActionListener listener)
Parameters List:
listener
The action listener to be added.

3.7.5.9.3 Remove action listener - removeActionListener

This removes the specified action listener so that it no longer receives action events from this object.

Method Definition:
public void removeActionListener(ActionListener listener)
Parameters List:
listener
The action listener to be removed.

3.7.5.10 Overriden Superclass Methods

3.7.5.10.1 Introduction

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 background colours - setBackground
Set foreground - setForeground
Get minimum size - getMinimumSize
Get preferred size - getPreferredSize

3.7.5.10.2 Set background - setBackground

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.

3.7.5.10.3 Set background colours - setBackground

This method sets the background colour resource and brighter and darker shades of that colour (e.g. for 3-D frames).

Method Definition:
public void setBackground (Color c, Color brighter, Color darker)
Parameters List:
c
The background colour.
brighter
A brighter shade of the background colour.
darker
A darker shade of the background colour.

3.7.5.10.4 Set foreground - setForeground

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.

3.7.5.10.5 Get minimum size - getMinimumSize

This method returns the minimum size of the component.

Method Definition:
public Dimension getMinimumSize()
Parameters List:
none

3.7.5.10.6 Get preferred size - getPreferredSize

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