|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.claudio.lib.swing.SwingUtils
public final class SwingUtils
Some methods which are useful when working with swing.
Copyright (C) 2007 Claudio Nieder <private@claudio.ch>, CH-8610 Uster
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Constructor Summary | |
---|---|
SwingUtils()
|
Method Summary | |
---|---|
static void |
invokeAndWait(java.lang.Runnable r)
Calls EventQueue.invokeAndWait unless we are already in the event dispatcher thread in which case run is just executed. |
static void |
main(java.lang.String[] args)
Print license. |
static javax.swing.JButton |
newJButton(java.lang.String label,
java.awt.event.ActionListener listener)
Create a JButton with an action listener |
static javax.swing.JMenuItem |
newJMenuItem(java.lang.String label,
java.awt.event.ActionListener listener)
Create a JMenuItem with an action listener |
static javax.swing.JFrame |
newScrollWindow(java.lang.String title,
java.awt.Component windowComponent)
Create a window with a scroll pane containing tge given component. |
static javax.swing.JFrame |
newTabbedWindow(java.lang.String title,
java.awt.Component[] tabComponents,
java.lang.String[] tabTitles,
int index,
javax.swing.event.ChangeListener listener)
Create a window with some tabs in it. |
static javax.swing.JFrame |
newWindow(java.lang.String title)
Create a window with given title, default close operation set to exit and layout set to GridBagLayout. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SwingUtils()
Method Detail |
---|
public static void invokeAndWait(java.lang.Runnable r) throws java.lang.InterruptedException, java.lang.reflect.InvocationTargetException
r
- runnable
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException
public static void main(java.lang.String[] args)
args
- ignoredpublic static final javax.swing.JButton newJButton(java.lang.String label, java.awt.event.ActionListener listener)
label
- Button labellistener
- Action to perform
public static final javax.swing.JMenuItem newJMenuItem(java.lang.String label, java.awt.event.ActionListener listener)
label
- ITem labellistener
- Action to perform
public static final javax.swing.JFrame newWindow(java.lang.String title)
title
- Window title
public static final javax.swing.JFrame newScrollWindow(java.lang.String title, java.awt.Component windowComponent)
title
- Window titlewindowComponent
- Component to place in the window, typically a JPane.
public static final javax.swing.JFrame newTabbedWindow(java.lang.String title, java.awt.Component[] tabComponents, java.lang.String[] tabTitles, int index, javax.swing.event.ChangeListener listener)
title
- Window titletabComponents
- Array containing one GUI component for each tabtabTitles
- Array of titles for each tabindex
- of the tab to be selected. Set to -1 to perform no selection.listener
- to handle change events. May be null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |