|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tbee.swing.SwingUtilities
public class SwingUtilities
Some swing utilites waitForThreadToFinish has been moved to the FoxtrotUtils
| Field Summary | |
|---|---|
static java.awt.Insets |
EMPTY_INSETS
|
static java.lang.String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
SwingUtilities()
|
|
| Method Summary | |
|---|---|
static void |
centerOnScreen(java.awt.Window jwindow)
Center a frame to the screen |
static java.awt.Component |
cloneComponent(java.awt.Component component)
Create a clone of a component |
static javax.swing.border.Border |
createCompoundedBorder(javax.swing.border.Border... borders)
Merge borders using CompoundBorders; first border is outside, last border is inside |
static java.awt.image.BufferedImage |
createDesktopImage()
Convenience method to create a BufferedImage of the desktop |
static java.awt.image.BufferedImage |
createImage(java.awt.Component component)
Create a BufferedImage for AWT components. |
static java.awt.image.BufferedImage |
createImage(javax.swing.JComponent component)
|
static java.awt.image.BufferedImage |
createImage(javax.swing.JComponent component,
java.awt.Rectangle region)
|
static java.awt.image.BufferedImage |
createImage(java.awt.Rectangle region)
Create a BufferedImage from a rectangular region on the screen. |
static java.awt.image.BufferedImage |
createImageFromComponent(java.awt.Component comp)
Create an image of a component, by having the component paint onto the image |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
boolean modal)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
boolean modal,
java.awt.Container container)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.awt.Container container)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.awt.Dialog.ModalityType modal)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.lang.String title)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.lang.String title,
boolean modal)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.lang.String title,
boolean modal,
java.awt.Container container)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Container container)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Dialog.ModalityType modality)
|
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Dialog.ModalityType modality,
boolean maximize)
create a JDialog |
static javax.swing.JDialog |
createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Dialog.ModalityType modal,
java.awt.Container container)
create a JDialog |
static javax.swing.JFrame |
createJFrame()
|
static javax.swing.JFrame |
createJFrame(java.awt.Component... component)
|
static javax.swing.JFrame |
createJFrame(java.awt.Component component,
int width,
int height)
|
static javax.swing.JFrame |
createJFrame(java.awt.Container container)
|
static javax.swing.JFrame |
createJFrame(java.awt.Container container,
int width,
int height)
|
static javax.swing.JFrame |
createJFrame(java.lang.String name,
java.awt.Component... component)
|
static javax.swing.JFrame |
createJFrame(java.lang.String name,
java.awt.Component component,
int width,
int height)
|
static javax.swing.JFrame |
createJFrame(java.lang.String name,
java.awt.Container container)
|
static javax.swing.JFrame |
createJFrame(java.lang.String name,
java.awt.Container container,
int width,
int height)
|
static javax.swing.JScrollPane |
createTransparentJScrollpane()
|
static javax.swing.JScrollPane |
createTransparentJScrollpane(java.awt.Component c)
|
static java.lang.String |
describe(java.awt.Component c)
|
static java.lang.Thread |
detachFromAwt(java.lang.Runnable runnable)
Detach from AWT thread; if already detached, just run. |
static java.lang.Thread |
detachFromAwtShowExceptions(java.awt.Component c,
java.lang.Runnable runnable)
|
static void |
disableAllComponents(java.awt.Container container)
Disable all components in a container (recusively) |
static java.awt.event.ActionListener |
exceptionsAsJOptionPane(java.awt.event.ActionListener actionListener)
Show IllegalArgumentExceptions and IllegalStateExceptions in a JOptionPane and then discard |
static java.awt.event.ActionListener |
exceptionsAsStatusBarAndJOptionPane(StatusBar statusBar,
java.awt.event.ActionListener actionListener)
Show IllegalArgumentExceptions and IllegalStateExceptions in a JOptionPane and then discard |
static java.awt.Container |
findContainer(java.awt.Component c,
java.lang.Class containerClass)
Find the toplevel container, whether that is a dialog or frame |
static java.awt.Container |
findToplevelContainer(java.awt.Component c)
Find the toplevel container, whether that is a dialog or frame |
static void |
fitInScreen(java.awt.Window window)
|
static void |
fix16DialogMemoryLeak()
In java 1.6 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6497929 |
static javax.swing.JDialog |
fixDecoratedJDialogProblem(javax.swing.JDialog dialog)
This is something that should be hooked in to the "new JFrame" with AOP? |
static javax.swing.JFrame |
fixDecoratedJFrameProblem(javax.swing.JFrame frame)
This is something that should be hooked in to the "new JFrame" with AOP? |
static java.util.List<java.awt.Component> |
flattenComponentTree(javax.swing.JComponent c)
Flatten the whole component tree into a list, so it is easily possible to search if some component is present |
static java.awt.Component |
forceRefresh(java.awt.Component c)
Code to force a component to refresh its contents |
static java.awt.Component |
forceRelayout(java.awt.Component c)
Code to force a component to relayout |
static int |
getBorderSizeBottom(javax.swing.JComponent c)
|
static int |
getBorderSizeLeft(javax.swing.JComponent c)
|
static int |
getBorderSizeRight(javax.swing.JComponent c)
|
static int |
getBorderSizeTop(javax.swing.JComponent c)
return the border size |
static java.awt.Dimension |
getScreenSize(java.awt.Window window)
Gets the maximum working screen size. |
static boolean |
hasFocusElseRequestAndReclick(javax.swing.JButton button)
When a keyboard shortcut is used to trigger a button, the focus is not moved. |
static void |
invokeAndWait(java.lang.Runnable runnable)
Run a runnable as part of the EDT; if already on the EDT just run try { SwingUtilities.invokeAndWait( new Runnable() { public void run() { ... } } ); } catch (InvocationTargetException e) {e.printStackTrace(); } catch (InterruptedException e) {e.printStackTrace(); } |
static void |
invokeAndWait2(java.lang.Runnable runnable)
Run a runnable as part of the EDT; if already on the EDT just run This method also catches the exceptions and dumps them to stderr. SwingUtilities.invokeAndWait2( new Runnable() { public void run() { ... } } ); |
static void |
invokeAndWait2ShowExceptions(java.awt.Component c,
java.lang.Runnable runnable)
|
static void |
invokeLater(int milliseconds,
java.lang.Runnable runnable)
Execute in swing thread after a delay |
static void |
invokeLater(java.lang.Runnable runnable)
Run later in the EDT; if already on the EDT just run |
static void |
invokeLaterShowExceptions(java.awt.Component c,
java.lang.Runnable runnable)
|
static boolean |
isComponentVisibleToUser(java.awt.Component c)
See if this container is still visible to the user (any component in the path toward a window or applet must be visible). |
static void |
jumpTo(javax.swing.JComponent component,
javax.swing.JScrollPane jscrollpane)
|
static void |
jumpToComponentInScrollpane(javax.swing.JComponent component)
|
static void |
makeWindowAtLeastTheWidthOfComponent(java.awt.Window window,
java.awt.Component component)
Make a window at least the size of the component (combined with placeAtComponent you can make popups) |
static void |
paintImmediately(javax.swing.JComponent c)
Force a repaint within the EDT (normally a repaint places a new event on the EDT queue). |
static void |
placeAtComponent(java.awt.Window window,
java.awt.Component component)
Place a window at the same position as a component |
static void |
placeBelowComponent(java.awt.Window window,
java.awt.Component component)
Place a window at the same position as a component |
static boolean |
pointIsInComponent(java.awt.Component c,
java.awt.Point p)
Check to see if a point falls within the component's boundary |
static boolean |
print(java.awt.Component component)
print a component TODO: the print now printers in the length over multiple pages, we also need a way to print in the width |
static void |
quickKeybind(javax.swing.JComponent c,
javax.swing.KeyStroke k,
javax.swing.Action a)
Quickly bind a keystroke to an action |
static void |
registerEnterAsFocusTravelsalKey()
As you've noticed, when you press Enter on fields like JTextField et al, an ActionEvent is generated, and focus is not transferred to the next field in the focus cycle. |
static void |
setAntiAlias(boolean value)
Tell swing to anti alias text |
static void |
setDefaultFont(java.lang.String fontname)
Change the default font on all swing components |
static void |
setDefaultFont(java.lang.String fontname,
double scale)
Change the default font on all swing components |
static void |
setEnableAll(java.awt.Container container,
java.util.List ignoredComponents,
boolean enable)
enable all components in a container (recusively) |
static void |
setHorizontalAlignment(javax.swing.JSpinner spinner,
int aligment)
Set the alignment of a spinner |
static void |
setup()
Some generic setup (must be called immediatly in the main) |
static void |
setupLAF()
Setup the JVM to do full LAF |
static java.lang.Runnable |
showExceptions(java.awt.Component c,
java.lang.Runnable runnable)
Any exception throw in the runnable's run() will be shown in an error optionpane |
static javax.swing.ProgressMonitor |
showProgressMonitorImmediately(javax.swing.ProgressMonitor progressMonitor)
|
static void |
synchronizeTwoScrollbars(javax.swing.JScrollBar sb1,
javax.swing.JScrollBar sb2)
Two scrollbars scrolling simultaniously. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SOURCECODE_VERSION
public static final java.awt.Insets EMPTY_INSETS
| Constructor Detail |
|---|
public SwingUtilities()
| Method Detail |
|---|
public static void setup()
public static void fix16DialogMemoryLeak()
public static void setupLAF()
public static void setAntiAlias(boolean value)
fontname - public static void setDefaultFont(java.lang.String fontname)
fontname -
public static void setDefaultFont(java.lang.String fontname,
double scale)
fontname - scale - public static void invokeLater(java.lang.Runnable runnable)
runnable -
public static void invokeLaterShowExceptions(java.awt.Component c,
java.lang.Runnable runnable)
public static void invokeLater(int milliseconds,
java.lang.Runnable runnable)
milliseconds - runnable -
public static void invokeAndWait(java.lang.Runnable runnable)
throws java.lang.reflect.InvocationTargetException,
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException
java.lang.InterruptedExceptionpublic static void invokeAndWait2(java.lang.Runnable runnable)
public static void invokeAndWait2ShowExceptions(java.awt.Component c,
java.lang.Runnable runnable)
public static java.lang.Thread detachFromAwt(java.lang.Runnable runnable)
public static java.lang.Thread detachFromAwtShowExceptions(java.awt.Component c,
java.lang.Runnable runnable)
public static java.lang.Runnable showExceptions(java.awt.Component c,
java.lang.Runnable runnable)
c - runnable -
public static java.awt.Dimension getScreenSize(java.awt.Window window)
Toolkit.getScreenSize() by allowing for the space
that any permanent fixtures
that native application windows do not have access to in a given OS. As
an example, the space for the toolbar in Windows - native applications do
not get that pixel area for their use.
window - the window that will use the screen
public static void fitInScreen(java.awt.Window window)
window - public static java.awt.Container findToplevelContainer(java.awt.Component c)
c -
public static java.awt.Container findContainer(java.awt.Component c,
java.lang.Class containerClass)
c -
public static boolean isComponentVisibleToUser(java.awt.Component c)
c -
public static java.util.List<java.awt.Component> flattenComponentTree(javax.swing.JComponent c)
c -
public static java.awt.Component forceRelayout(java.awt.Component c)
public static java.awt.Component forceRefresh(java.awt.Component c)
public static void centerOnScreen(java.awt.Window jwindow)
jwindow -
public static void placeAtComponent(java.awt.Window window,
java.awt.Component component)
window - component -
public static void placeBelowComponent(java.awt.Window window,
java.awt.Component component)
window - component -
public static void makeWindowAtLeastTheWidthOfComponent(java.awt.Window window,
java.awt.Component component)
window - component - public static javax.swing.JFrame fixDecoratedJFrameProblem(javax.swing.JFrame frame)
public static javax.swing.JFrame createJFrame()
public static javax.swing.JFrame createJFrame(java.awt.Container container)
public static javax.swing.JFrame createJFrame(java.lang.String name,
java.awt.Container container)
public static javax.swing.JFrame createJFrame(java.lang.String name,
java.awt.Container container,
int width,
int height)
public static javax.swing.JFrame createJFrame(java.awt.Container container,
int width,
int height)
public static javax.swing.JFrame createJFrame(java.lang.String name,
java.awt.Component... component)
public static javax.swing.JFrame createJFrame(java.awt.Component... component)
public static javax.swing.JFrame createJFrame(java.lang.String name,
java.awt.Component component,
int width,
int height)
public static javax.swing.JFrame createJFrame(java.awt.Component component,
int width,
int height)
public static javax.swing.JDialog fixDecoratedJDialogProblem(javax.swing.JDialog dialog)
public static javax.swing.JDialog createJDialog(java.awt.Component owner)
owner - the component of which the container will be the owner of this dialog
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.awt.Container container)
owner - the component of which the container will be the owner of this dialogcontainer - the content of the dialog
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
boolean modal)
owner - the component of which the container will be the owner of this dialogmodal - is the dialog modal
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.awt.Dialog.ModalityType modal)
owner - the component of which the container will be the owner of this dialogmodal - is the dialog modal
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
boolean modal,
java.awt.Container container)
owner - the component of which the container will be the owner of this dialogmodal - is the dialog modalcontainer - the content of the dialog
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.lang.String title)
owner - the component of which the container will be the owner of this dialogtitle - dialog title
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Container container)
owner - the component of which the container will be the owner of this dialogtitle - dialog titlecontainer - the content of the dialog
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.lang.String title,
boolean modal)
owner - the component of which the container will be the owner of this dialogtitle - dialog titlemodal - is the dialog modal
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.lang.String title,
boolean modal,
java.awt.Container container)
owner - the component of which the container will be the owner of this dialogtitle - dialog titlemodal - is the dialog modalcontainer - the content of the dialog
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Dialog.ModalityType modal,
java.awt.Container container)
owner - the component of which the container will be the owner of this dialogtitle - dialog titlemodal - is the dialog modalcontainer - the content of the dialog
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Dialog.ModalityType modality,
boolean maximize)
owner - the component of which the container will be the owner of this dialog
public static javax.swing.JDialog createJDialog(java.awt.Component owner,
java.lang.String title,
java.awt.Dialog.ModalityType modality)
public static int getBorderSizeTop(javax.swing.JComponent c)
public static int getBorderSizeLeft(javax.swing.JComponent c)
public static int getBorderSizeRight(javax.swing.JComponent c)
public static int getBorderSizeBottom(javax.swing.JComponent c)
public static javax.swing.border.Border createCompoundedBorder(javax.swing.border.Border... borders)
borders -
public static void synchronizeTwoScrollbars(javax.swing.JScrollBar sb1,
javax.swing.JScrollBar sb2)
public static javax.swing.JScrollPane createTransparentJScrollpane()
public static javax.swing.JScrollPane createTransparentJScrollpane(java.awt.Component c)
public static void jumpToComponentInScrollpane(javax.swing.JComponent component)
component -
public static void jumpTo(javax.swing.JComponent component,
javax.swing.JScrollPane jscrollpane)
component - jscrollpane - public static java.lang.String describe(java.awt.Component c)
public static java.awt.image.BufferedImage createImageFromComponent(java.awt.Component comp)
comp - public static java.awt.image.BufferedImage createImage(javax.swing.JComponent component)
public static java.awt.image.BufferedImage createImage(javax.swing.JComponent component,
java.awt.Rectangle region)
public static java.awt.image.BufferedImage createImage(java.awt.Component component)
throws java.awt.AWTException
component - AWT component to create image fromfileName - name of file to be created or null
java.io.IOException - if an error occurs during writing
java.awt.AWTException
public static java.awt.image.BufferedImage createImage(java.awt.Rectangle region)
throws java.awt.AWTException
region - region on the screen to create image from
java.awt.AWTException - see Robot class constructors
java.io.IOException - if an error occurs during writing
public static java.awt.image.BufferedImage createDesktopImage()
throws java.awt.AWTException
java.awt.AWTException - see Robot class constructors
java.io.IOException - if an error occurs during writingpublic static boolean hasFocusElseRequestAndReclick(javax.swing.JButton button)
public static java.awt.Component cloneComponent(java.awt.Component component)
component -
public static void registerEnterAsFocusTravelsalKey()
public static void paintImmediately(javax.swing.JComponent c)
public static void disableAllComponents(java.awt.Container container)
public static void setEnableAll(java.awt.Container container,
java.util.List ignoredComponents,
boolean enable)
public static boolean print(java.awt.Component component)
public static java.awt.event.ActionListener exceptionsAsJOptionPane(java.awt.event.ActionListener actionListener)
public static java.awt.event.ActionListener exceptionsAsStatusBarAndJOptionPane(StatusBar statusBar,
java.awt.event.ActionListener actionListener)
public static void quickKeybind(javax.swing.JComponent c,
javax.swing.KeyStroke k,
javax.swing.Action a)
c - Componentk - Keystrokea - Action
public static boolean pointIsInComponent(java.awt.Component c,
java.awt.Point p)
c - p - must be in screen coordinates
public static void setHorizontalAlignment(javax.swing.JSpinner spinner,
int aligment)
spinner - aligment - SwingConstantspublic static javax.swing.ProgressMonitor showProgressMonitorImmediately(javax.swing.ProgressMonitor progressMonitor)
progressMonitor -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||