A
JSplitPane
represents a simple container that is implemented using the Java
Swing JSplitPane class.
It is used to display two components side-by-side or one over the other.
Splitpanes do not create windows, which means you only see them when
they are in a visible
JFrame,
JDialog,
or
JWindow.
Yoix programs normally interact with a
JSplitPane
using event handlers and by reading or writing the following fields:
| background |
The
Color
that is used to paint the background of the splitpane.
It is also the default background color assigned to components in the
layout
array that do not pick their own.
Reading returns a snapshot of the current color.
Writing immediately sets the splitpane's background,
and the background of components contained in the splitpane
that do not pick their own, to the new color.
| | border |
An
Object
that should be a
Border,
Insets,
Number,
or
String
that describes the border that is drawn around this splitpane.
A
NULL
value, which is the default, means no border.
A
border
that is an
Insets
or
Number
is an easy way to describe margins
(i.e., an
EmptyBorder),
in units of 72 dots per inch, that are left around the sides of this splitpane.
A
border
that is a
String
is a quick way to surround this splitpane with a border that uses the
String
as its title.
Reading returns a snapshot of the current border.
Writing immediately sets the splitpane's border to the new value.
| | components |
A
Dictionary
maintained by the interpreter's layout machinery that maps
tag
fields to actual components;
every component contained in the splitpane has an entry in the dictionary.
Add the splitpane to another container (e.g., a frame or panel)
and entries in the
components
dictionary are copied into the new container's
components
dictionary.
In addition, the
root
field in each component is automatically set to the top-level container,
so the
components
dictionary is easy to find, and that means individual components
can find each other by name using the
root.components
dictionary.
| | continuouslayout |
An
int
that indicates, when 0, that updates to the splitpane based on interactive
manipulation should only be reflected at the end of the interaction.
A non-zero value indicates that updating should occur as the interaction
is taking place.
Reading returns the current layout update mode.
Writing immediately sets the layout update mode to the new value.
| | cursor |
An
Object
that should be an
int,
Image,
or
String
that selects the cursor shown when the pointer is over the splitpane.
It is also the default cursor assigned to components in the splitpane's
layout
array that do not pick their own.
A
cursor
that is an
int
should be one of the cursors defined in the
yoix.awt.Cursor
dictionary.
A
cursor
that is an
Image
can describe the cursor using its
size
and
hotspot
fields and often draws it using its
paint
function.
A
cursor
that is a
String
should be the name of a cursor that is already defined in
yoix.awt.Cursor
or the name a local a file or URL that contains a GIF or JPEG image
that will be used as the cursor.
Reading returns the current cursor.
Writing immediately sets the splitpane's cursor,
and the cursor of components contained in the splitpane
that do not pick their own, to the new value.
A splitpane that does not set its own cursor uses
DEFAULT_CURSOR.
| | dividerlocation |
A
Number
that determines the location of the divider.
A number between 0.0 and 1.0 is interpreted as the fraction of the
splitpane's size that should be allocated to the left (or top)
component.
A number less than zero means the divider location should be reset
to best honor the preferred size of the left (or top) component,
while a number greater than 1.0 is assumed to be the desired size,
in units of 72 dots per inch, of the left (or top) component.
Reading
dividerlocation
always returns a number between 0.0 and 1.0.
| | dividersize |
A
Number
that represents the width of the divider, where 72 units is one inch.
| | doublebuffered |
An
int
that is
1
when the splitpane uses double-buffering to draw itself,
0
when it does not, and starts with a default value that is
selected by Java for the splitpane.
Reading returns the current double-buffering behavior.
Writing immediately sets the splitpane's double-buffering behavior to the new value.
Note that double-buffering may be required when transparent components are used.
| | dragenabled |
An
int
that should be set to
1
when this splitpane wants to use the automatic drag handling that Swing provides
for some components, and
0
(the default)
when it does not.
Components that do not provide automatic drag handling always return
0
when their
dragenabled
field is read, so storing
1
in
dragenabled
should only be viewed as a request for a service that may not be available.
Swing components can always take complete control of their drag and drop
handling using their
transferhandler
field or special drag and drop event handlers.
| | enabled |
An
Object
that is
1
when the splitpane can respond to user input,
0
when it can not respond, and
NULL
(the default)
when the splitpane inherits the value from the nearest lightweight container,
like a
JPanel,
that contains the splitpane and has its
enabled
field set to something other than
NULL.
The top-level application window that contains the splitpane always gets the
final say, so disabling that window always disables the splitpane.
Reading returns the current state.
Writing immediately sets the splitpane's state to the new value,
which can also change the state of the components contained
in the splitpane.
| | focusowner |
A read-only
int
that is non-zero when the splitpane has the focus.
| | font |
The
Font,
or font name if it is a
String,
that is used as the default font assigned to components in the
layout
array that do not pick their own.
Reading returns a snapshot of the current font.
Writing immediately changes the splitpane's font,
and the font used by all components contained in the splitpane
that do not pick their own, to the new font.
| | foreground |
The
Color
that is used as the default foreground color assigned to components in the
layout
array that do not pick their own.
Reading returns a snapshot of the current color.
Writing immediately sets the splitpane's foreground,
and the foreground of components contained in the splitpane
that do not pick their own, to the new color.
| | icon |
An
Image
that is displayed in the tab associated with the splitpane
when the splitpane is put in a
JTabbedPane.
Reading returns a snapshot of the current icon.
Writing immediately changes the icon displayed by the tab that a
JTabbedPane
associates with the splitpane.
| | layer |
An
int,
often a small number between 0 and 99,
that identifies the depth of this splitpane when it is added to a
JLayeredPane
or
JDesktopPane.
Components assigned to lower numbered layers are drawn before
the components in higher numbered layers.
Writing immediately changes the splitpane's layer, which usually means the
JLayeredPane
or
JDesktopPane
that contains the splitpane will be repainted.
| | layout |
An
Array
of objects that the
layoutmanager
arranges in the splitpane.
Splitpanes use a special-purpose layoutmanager that takes the first
two components from
layout
and ignores anything left in that array.
Reading returns the current array.
Writing immediately clears splitpane and then arranges the new
set of components in the splitpane.
| | layoutmanager |
A
LayoutManager
that is permanently set to
NULL,
because splitpanes use a special-purpose layout manager for
placing its components.
However, the splitpane updates its own
components
dictionary, just like other layout managers, and makes sure the
root
field in each component is set to the top-level component containing
the splitpane.
Writing is not allowed and will result in an
invalidaccess
error.
| | location |
A
Point
that determines the location of the splitpane
in a coordinate system that has its origin at the upper left corner
of the container closest to the splitpane (in the component hierarchy)
that actually contains it, positive x to the right, positive y down,
and a resolution of 72 dots per inch.
Reading returns a snapshot of the current location.
Writing is allowed, but layout managers usually get the final say, so setting
location
should be viewed as a request that may not be honored.
| | nextfocus |
An
Object
that is the component that receives the focus after this splitpane
when the focus traverses from one component to the next
(usually by means of the keyboard
TAB
character).
A
NULL
value indicates that the default Java focus traversal is in effect.
Reading returns the value last stored.
Writing immediately sets the new focus traversal behavior.
| | onetouchexpandable |
An
int
that is
1
when the splitpane divider has a user-interface widget that
quickly allows the divider to be expanded or collapsed, and
0
otherwise.
Reading returns the current user-interface state.
Writing immediately sets the splitpane's user-interface to the new state.
| | opaque |
An
Object
that is
1
when the splitpane is opaque,
0
when it is transparent, and
NULL
(the default)
when the splitpane inherits the value from the nearest component that
contains the splitpane and has its
opaque
field set to something other than
NULL.
Changing a splitpane's
opaque
field can immeddiately change the appearance of the components contained
in the splitpane.
| | orientation |
An
int
that takes the values
HORIZONTAL
or
VERTICAL,
which are both defined in
yoix.swing,
to determine the orientation of the two components in the splitpane.
The default is
HORIZONTAL.
Reading provides the current orientation of the splitpane components.
Writing immediately resets the orientation of the splitpane components.
| | popup |
A
JPopupMenu
that is associated with the splitpane.
Reading returns the current popup menu.
Writing immediately shows the popup menu at the point in the splitpane's coordinate
system specified by the popup menu's
location
field, assuming of course that the splitpane is showing on the screen.
Storing
TRUE
in the popup menu's
visible
field, which was added in release 1.2.0, is an easy way to show the
popup menu that currently belongs to the splitpane.
| | preferredsize |
A
Dimension
that is used by layout managers when they need to know the splitpane's
preferred size in units of 72 dots per inch.
A
NULL
value means the splitpane has no preference.
A non-positive height or width is allowed and simply means the splitpane
has no preference for that dimension.
Reading returns the current preferred size.
Writing changes the preferred size and immediately notifies
root.layoutmanager,
which means the components contained in
root
may be repositioned and resized.
| | requestfocus |
An
int
that can be used to request or transfer the keyboard focus.
Storing a non-zero value in
requestfocus
tries to get the focus.
Storing
0
tries to transfer the focus.
Reading
requestfocus
does not currently return any useful information.
| | requestfocusenabled |
An
int
that is
1
when actions, like mouse clicks or changes to the
requestfocus
field, can steal the keyboard focus and
0
(the default)
when they can not.
Note that this field does not affect acceptance of the keyboard focus
during normal focus traversal.
Reading returns the current state.
Writing immediately sets the splitpane's state to the new value.
| | resizeweight |
An
double
that can range between
0
(the default)
and
1,
inclusive, and indicates how extra space is distributed when the split pane is resized.
A value of
0
indicates that all extra space goes to the bottom (or right) component, while a value of
1
indicates that all extra space goes to the top (or left) component.
Values in between those limits distributes the space accordingly.
Reading returns the current weighting.
Writing immediately sets the splitpane's weighting to the new value.
| | root |
An
Object
that is automatically updated by the interpreter's layout machinery
so it is always the top-level object that contains the splitpane.
For example, put a splitpane in a panel and
root
will be set to the panel;
add that panel to a frame and the splitpane's
root
field will be set to that frame.
A splitpane's event handlers can use
root
when they need to interact with the other components in the container.
| | showing |
A read-only
int
that is non-zero when the splitpane is showing on the screen.
| | size |
A
Dimension
that determines the size of the splitpane
in units of 72 dots per inch.
Reading returns a snapshot of the current size.
Writing is allowed, but layout managers usually get the final say, so setting
size
should be viewed as a request that may not be honored.
| | tag |
A
String
used to identify the splitpane that is either supplied when
the splitpane is declared, or automatically generated otherwise.
Add a splitpane to a container, like a
JFrame
or
JPanel,
and the interpreter's layout machinery updates the
root
field so it points at the top-level container and then adds the splitpane, as
tag,
to the
root.components
dictionary.
| | title |
A
String
that is the text that the tab associated with the splitpane displays
when the splitpane is put in a
JTabbedPane.
Reading returns a snapshot of the current title.
Writing immediately changes the text displayed by the tab that a
JTabbedPane
associates with the splitpane.
| | tooltiptext |
A
String
of characters that is displayed in a tightly sized pop-up window that
appears near the cursor whenever the cursor lingers over the splitpane.
Setting this value to
NULL
(the default)
disables the tooltip mechanism.
Reading returns the current tooltip text.
Writing immediately sets the new tooltip text.
| | transferhandler |
An
Object
that should be a
TransferHandler
or
String
that determines how the splitpane handles data transfer operations
like drag and drop.
A value that is a
String
but not
""
means the field named by the
String
should be used as the source and sink of the data that is transferred by
the splitpane.
The result is the same as assigning the
String
to the
property
field in a
TransferHandler
and then assigning that
TransferHandler
to
transferhandler.
The empty
String
""
is special and refers to the
TransferHandler
that Swing uses for automatic drag handling, if there is one.
Swing components that provide automatic drag handling start out with a
transferhandler
field that is not
NULL,
but the automatic drag handling is not enabled until
1
is stored in
dragenabled.
Swing components that provide their own drag and drop event handlers
currently must store
NULL
in
transferhandler
before those event handlers will start working.
| | validate |
An
int
that is
1
when changing the
layoutmanager
field takes effect immediately, and
0
when the change is delayed, often until after the
layout,
size,
or
validate
fields change.
Storing a
1
in
validate
always runs Java's layout manager, even when nothing has changed.
| | visible |
An
int
that is
1
when the splitpane is visible, and
0
otherwise.
Reading returns the current visibility.
Writing immediately sets the splitpane's visibility to the new state.
|
Several permanent fields have not been documented and should not be
used in Yoix applications.
Event handlers are functions that must be added to a splitpane when it is
declared.
The handlers that work with splitpanes are listed below;
the names should be familiar if you have done some Java programming.
The
actionPerformed
and
itemStateChanged
event handlers are only for menus.
| |
| Event Handlers: |
actionPerformed,
componentHidden,
componentMoved,
componentResized,
componentShown,
dragDropEnd,
dragEnter,
dragExit,
dragGestureRecognized,
dragMouseMoved,
dragOver,
drop,
dropActionChanged,
focusGained,
focusLost,
invocationRun,
itemStateChanged,
keyPressed,
keyReleased,
keyTyped,
mouseClicked,
mouseDragged,
mouseEntered,
mouseExited,
mouseMoved,
mousePressed,
mouseReleased,
mouseWheelMoved
| | |
| Example: |
The program,
import yoix.*.*;
JFrame f = {
Dimension size = {
int width = 300;
int height = 200;
};
Array layout = {
new JSplitPane {
String tag = "$_pane";
String font = "TimesRoman-bold-14";
int orientation = HORIZONTAL;
Array layout = {
new JButton {
String text = "Left/Right";
actionPerformed(e) {
root.components.$_pane.orientation = HORIZONTAL;
}
},
new JButton {
String text = "Top/Bottom";
actionPerformed(e) {
root.components.$_pane.orientation = VERTICAL;
}
},
};
},
};
};
f.visible = TRUE;
presents a splitpane with two buttons that can be pressed to alter
the orientation of the splitpane.
| | |
| See Also: |
BevelBorder,
Border,
BorderLayout,
BoxLayout,
CardLayout,
CustomLayout,
EmptyBorder,
EtchedBorder,
FlowLayout,
GridBagLayout,
GridLayout,
invokeLater,
JButton,
JCanvas,
JCheckBox,
JCheckBoxMenuItem,
JChoice,
JColorChooser,
JComboBox,
JDesktopPane,
JDialog,
JFileChooser,
JFileDialog,
JFrame,
JInternalFrame,
JLabel,
JLayeredPane,
JList,
JMenu,
JMenuBar,
JMenuItem,
JPanel,
JPasswordField,
JPopupMenu,
JProgressBar,
JRadioButton,
JRadioButtonMenuItem,
JScrollBar,
JScrollPane,
JSeparator,
JSlider,
JTabbedPane,
JTable,
JTextArea,
JTextCanvas,
JTextField,
JTextPane,
JTextTerm,
JToggleButton,
JToolBar,
JTree,
JWindow,
LayoutManager,
LineBorder,
MatteBorder,
postEvent,
SoftBevelBorder,
TransferHandler
|
|