|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--org.jscroll.JScrollDesktopPane
The main scrollable desktop class.
JScrollDesktopPane builds upon JDesktopPane and JScrollPane to provide
a complete virtual desktop environment that enables easy access to internal
frames that may have been positioned offscreen. This access is made
possible via real-time creation and manipulation of the desktop preferred size.
A toolbar provides a set of buttons along the top of the screen, with each
button matched to a corresponding internal frame. When one of these buttons
is clicked, the associated frame is centered upon the virtual desktop and
selected. The buttons within the toolbar automatically resize as more buttons
are added beyond the width of the container.
A JMenuBar may be registered with the scrollable desktop so that the
application can provide access to the internal frames via its own menu bar.
When the registration is complete, a new JMenu entitled "Window" is added to
the supplied JMenuBar, a menu containing Tile
,
Cascade
, and Close
options along with dynamically
updated shortcuts to any internal frames currently upon the scrollable
desktop. The Tile
and Cascade
options provided by
the "Window" menu affect the positions of the internal frames upon the
scrollable desktop. Cascade
positions each internal frame one
after the other in a diagonal sequence crosswise the screen, while
Tile
positions and resizes the internal frames to fill up
all available screen real estate, with no single frame overlapping any other.
JScrollDesktopPane is simply a JPanel and as such may be added to any
suitable JPanel container, such as a JFrame. The addition of new internal
frames to the JScrollDesktopPane and the registration of menu bars for
use by the scrollable desktop is relatively simple: The add
method creates a new internal frame and returns a reference to the
JInternalFrame instance that was created, while the
registerMenuBar
method registers the menubar for use by the
scrollable desktop. A JMenuBar object may also be registered by passing it
as a constructor parameter to the JScrollDesktopPane.
An example usage follows:
JScrollDesktopPane has been tested under Java 2 JDK versions
1.3.1-b24 on Linux and jdk1.3.0_02 on Windows and Intel Solaris.
As of March 14, 2003 it has also been tested on JDK 1.4.1 for Windows.
JFrame f = new JFrame("Scrollable Desktop");
f.setSize(300,300);
// prepare the menuBar
JMenuBar menuBar = new JMenuBar();
f.setJMenuBar(menuBar);
// create the scrollable desktop instance and add it to the JFrame
JScrollDesktopPane scrollableDesktop =
new JScrollDesktopPane(menuBar);
f.getContentPane().add(scrollableDesktop);
f.setVisible(true);
// add a frame to the scrollable desktop
JPanel frameContents = new JPanel();
frameContents.add(
new JLabel("Hello and welcome to JScrollDesktopPane."));
scrollableDesktop.add(frameContents);
Field Summary |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface org.jscroll.widgets.DesktopConstants |
CONTENTS_CHANGED_COLOR, MAX_FRAMES, MAXIMUM_BUTTON_WIDTH, MINIMUM_BUTTON_WIDTH, X_OFFSET, Y_OFFSET |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JScrollDesktopPane()
creates the JScrollDesktopPane object. |
|
JScrollDesktopPane(JMenuBar mb)
creates the JScrollDesktopPane object and registers a menubar. |
|
JScrollDesktopPane(JMenuBar mb,
ImageIcon defaultFrameIcon)
creates the JScrollDesktopPane object, registers a menubar, and assigns a default internal frame icon. |
Method Summary | |
void |
add(JInternalFrame f)
adds a JInternalFrame to the scrollable desktop. |
void |
add(JInternalFrame f,
int x,
int y)
adds a JInternalFrame to the scrollable desktop. |
JInternalFrame |
add(JPanel frameContents)
adds an internal frame to the scrollable desktop |
JInternalFrame |
add(String title,
ImageIcon icon,
JPanel frameContents,
boolean isClosable)
adds an internal frame to the scrollable desktop |
JInternalFrame |
add(String title,
ImageIcon icon,
JPanel frameContents,
boolean isClosable,
int x,
int y)
adds an internal frame to the scrollable desktop. |
JInternalFrame |
add(String title,
JPanel frameContents)
adds an internal frame to the scrollable desktop |
JInternalFrame |
add(String title,
JPanel frameContents,
boolean isClosable)
adds an internal frame to the scrollable desktop |
void |
flagContentsChanged(JInternalFrame f)
flags the specified internal frame as "contents changed." Used to notify the user when the contents of an inactive internal frame have changed. |
JInternalFrame |
getSelectedFrame()
returns the internal frame currently selected upon the virtual desktop. |
void |
registerDefaultFrameIcon(ImageIcon defaultFrameIcon)
registers a default icon for display in the title bars of internal frames |
void |
registerMenuBar(JMenuBar mb)
registers a menubar to which the "Window" menu may be applied. |
void |
remove(JInternalFrame f)
removes the specified internal frame from the scrollable desktop |
void |
setSelectedFrame(JInternalFrame f)
selects the specified internal frame upon the virtual desktop. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JScrollDesktopPane(JMenuBar mb, ImageIcon defaultFrameIcon)
mb
- the menubar with which to register the scrollable desktopdefaultFrameIcon
- the default icon to use within the title bar of
internal frames.public JScrollDesktopPane(JMenuBar mb)
mb
- the menubar with which to register the scrollable desktoppublic JScrollDesktopPane()
Method Detail |
public JInternalFrame add(JPanel frameContents)
frameContents
- the contents of the internal frame
public JInternalFrame add(String title, JPanel frameContents)
title
- the title displayed in the title bar of the internal frameframeContents
- the contents of the internal frame
public JInternalFrame add(String title, JPanel frameContents, boolean isClosable)
title
- the title displayed in the title bar of the internal frameframeContents
- the contents of the internal frameisClosable
- boolean
indicating whether internal frame
is closable
public JInternalFrame add(String title, ImageIcon icon, JPanel frameContents, boolean isClosable)
title
- the title displayed in the title bar of the internal frameicon
- the icon displayed in the title bar of the internal frameframeContents
- the contents of the internal frameisClosable
- boolean
indicating whether internal frame
is closable
public JInternalFrame add(String title, ImageIcon icon, JPanel frameContents, boolean isClosable, int x, int y)
title
- the title displayed in the title bar of the internal frameicon
- the icon displayed in the title bar of the internal frameframeContents
- the contents of the internal frameisClosable
- boolean
indicating whether internal frame
is closablex
- x coordinates of internal frame within the scrollable desktop.y
- y coordinates of internal frame within the scrollable desktop
public void add(JInternalFrame f)
f
- the internal frame of class JScrollInternalFrame to addpublic void add(JInternalFrame f, int x, int y)
f
- the internal frame of class JScrollInternalFrame to addx
- x coordinates of internal frame within the scrollable desktop.y
- y coordinates of internal frame within the scrollable desktoppublic void remove(JInternalFrame f)
f
- the internal frame to removepublic void registerMenuBar(JMenuBar mb)
mb
- the menubar to registerpublic void registerDefaultFrameIcon(ImageIcon defaultFrameIcon)
defaultFrameIcon
- the default iconpublic JInternalFrame getSelectedFrame()
public void setSelectedFrame(JInternalFrame f)
f
- the internal frame to selectpublic void flagContentsChanged(JInternalFrame f)
f
- the internal frame to flag as "contents changed"
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |