|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.utils.swing.SwingUtils
public class SwingUtils
Miscellaneous Swing utilities.
This static class provides various Swing utility methods.
Nested Class Summary | |
---|---|
static class |
SwingUtils.ExitListener
Quits application when main JFrame is closed. |
protected class |
SwingUtils.ExtendedEventQueue
|
Field Summary | |
---|---|
static java.lang.Thread |
awtEventThread
The AWT event thread. |
Constructor Summary | |
---|---|
protected |
SwingUtils()
Can't instantiate but can override. |
Method Summary | |
---|---|
static javax.swing.JComponent |
buildLabelOrScrollingTextArea(java.lang.String str)
Builds either a JLabel or a scrolling text area containing a string. |
static javax.swing.JComponent |
buildScrollingStyledTextArea(StyledString str)
Builds a scrolling styled text area containing a string. |
static void |
closeFrame(java.awt.Frame frame)
Close a frame. |
static void |
flushAWTEventQueue()
Flush the system event queue. |
static java.lang.Thread |
getAWTEventThread()
Get the AWT (and Swing) event thread. |
static java.awt.Component |
getFocusedComponent(java.awt.Container parent)
Get currently focused component given parent container. |
static java.awt.Window |
getParentWindow(javax.swing.JComponent c)
Get parent window for Swing component. |
static javax.swing.JFrame |
openInJFrame(java.awt.Container content,
javax.swing.JMenuBar menuBar,
int width,
int height,
java.lang.String title,
java.awt.Color backgroundColor,
java.awt.event.WindowAdapter exitListener)
Opens a container (JPanel, etc.) in a JFrame. |
static java.lang.Object |
openInSwingFrame(javax.swing.JFrame frame,
java.awt.Container content,
javax.swing.JMenuBar menuBar,
int width,
int height,
java.lang.String title,
java.awt.Color backgroundColor,
java.awt.event.WindowAdapter exitListener)
Opens a container (JPanel, etc.) in an Swing frame. |
static XFrame |
openInXFrame(java.awt.Container content,
javax.swing.JMenuBar menuBar,
int width,
int height,
java.lang.String title,
java.awt.Color backgroundColor,
java.awt.event.WindowAdapter exitListener)
Opens a container (JPanel, etc.) in an XFrame. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.Thread awtEventThread
Constructor Detail |
---|
protected SwingUtils()
Method Detail |
---|
public static javax.swing.JComponent buildLabelOrScrollingTextArea(java.lang.String str)
If the string 72 characters or less and does not contain a newline, it is wrapped in a JLabel and the JLabel is returned. Otherwise, it is wrapped in a non-editable text area with 6 rows, 72 columns, and a scroll bar and the JScrollPane is returned.
str
- The string. public static javax.swing.JComponent buildScrollingStyledTextArea(StyledString str)
str
- The styled string. public static void closeFrame(java.awt.Frame frame)
frame
- The frame (or JFrame) to close. public static void flushAWTEventQueue()
public static java.lang.Thread getAWTEventThread()
public static java.awt.Component getFocusedComponent(java.awt.Container parent)
parent
- Parent container.
public static java.awt.Window getParentWindow(javax.swing.JComponent c)
public static java.lang.Object openInSwingFrame(javax.swing.JFrame frame, java.awt.Container content, javax.swing.JMenuBar menuBar, int width, int height, java.lang.String title, java.awt.Color backgroundColor, java.awt.event.WindowAdapter exitListener)
frame
- The frame to hold the content.
If null, a new XFrame is allocated.content
- Content to place in JFrame.menuBar
- Menu bar for JFrame.width
- Width of JFrame.height
- Height of JFrame.title
- Title for JFrame.backgroundColor
- Background color for JFrame and content.
public static javax.swing.JFrame openInJFrame(java.awt.Container content, javax.swing.JMenuBar menuBar, int width, int height, java.lang.String title, java.awt.Color backgroundColor, java.awt.event.WindowAdapter exitListener)
content
- Content to place in JFrame.menuBar
- Menu bar for JFrame.width
- Width of JFrame.height
- Height of JFrame.title
- Title for JFrame.backgroundColor
- Background color for JFrame and content. public static XFrame openInXFrame(java.awt.Container content, javax.swing.JMenuBar menuBar, int width, int height, java.lang.String title, java.awt.Color backgroundColor, java.awt.event.WindowAdapter exitListener)
content
- Content to place in JFrame.menuBar
- Menu bar for JFrame.width
- Width of JFrame.height
- Height of JFrame.title
- Title for JFrame.backgroundColor
- Background color for JFrame and content.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |