|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectswingwtx.swing.SwingWTUtils
Utilities required for SwingWT. Handles management of SWT display, SwingWT event pump and some handy stuff for calculating renderered text size, determining platform, etc.
Field Summary | |
static int |
MACOSX_MENUBAR_BOTTOM
The height of the MacOS X menubar in pixels |
static boolean |
showInternalSWTExceptions
|
Constructor Summary | |
SwingWTUtils()
|
Method Summary | |
static void |
checkEventDispatcher()
Checks whether the event dispatch thread is running, and starts it if it isn't. |
static void |
checkShutdownHook()
|
static void |
clearTempDirectory()
|
static void |
decrementWindowReferences()
|
static org.eclipse.swt.widgets.Display |
getDisplay()
|
static int |
getRenderStringHeight(java.lang.String text)
Given a piece of text, this routine will evaluate how many pixels high it will be when renderered in the default system font. |
static int |
getRenderStringWidth(java.lang.String text)
Given a piece of text, this routine will evaluate how many pixels wide it will be when renderered in the default system font. |
static int |
getRetardationInterval()
|
static int |
getStringBufferIndexOf(java.lang.StringBuffer buffer,
java.lang.String string)
Because GCJ/GIJ Classpath doesn't support StringBuffer.indexOf, we have to have a replacement that uses Strings instead. |
static int |
getStringBufferIndexOf(java.lang.StringBuffer buffer,
java.lang.String string,
int fromIndex)
Because GCJ/GIJ Classpath doesn't support StringBuffer.indexOf, we have to have a replacement that uses Strings instead. |
static org.eclipse.swt.graphics.Image |
getSWTImageFromSwingIcon(Component c,
Icon icon)
Renders a Swing Icon onto an SWT image. |
static java.lang.String |
getVersion()
|
static void |
incrementWindowReferences()
|
static void |
initialiseMacOSX(java.lang.Runnable run)
Startup routine for MacOSX programs. |
static boolean |
isEventDispatchRunning()
|
static boolean |
isMacOSX()
Returns true if this is a MacOS X platform |
static boolean |
isRetardDispatchThread()
|
static boolean |
isSWTControlAvailable(org.eclipse.swt.widgets.Control c)
Determines if an SWT peer is available for use |
static boolean |
isSWTMenuControlAvailable(org.eclipse.swt.widgets.MenuItem c)
Determines if an SWT menu peer is available for use |
static boolean |
isUrlInJar(java.net.URL url)
|
static boolean |
isUseSWTFastVirtualTables()
Returns whether SwingWT is using fast SWT virtual tables |
static boolean |
isWindows()
Returns true if this is a windows platform |
static java.lang.String |
removeHTML(java.lang.String s)
Removes HTML tags from a string |
static java.lang.String |
replace(java.lang.String findin,
java.lang.String find,
java.lang.String replacewith)
Looks in findin for all occurrences of find and replaces them with replacewith |
static void |
saveImageToGIF(Image image,
java.io.OutputStream stream)
Saves an image to a GIF. |
static void |
saveImageToJPG(Image image,
java.io.OutputStream stream)
Saves an image to a JPEG. |
static void |
saveImageToPNG(Image image,
java.io.OutputStream stream)
Saves an image to a JPEG. |
static void |
setEclipsePlugin(boolean b)
If your code is an Eclipse plugin (ie. |
static void |
setRetardDispatchThread(boolean b)
Determines whether the event dispatch thread is retarded for extra performance |
static void |
setRetardDispatchThread(boolean b,
int ms)
Determines whether the event dispatch thread is retarded for extra performance |
static void |
setShowSwingWTInfoOnStartup(boolean b)
|
static void |
setUsesSWTFastVirtualTables(boolean b)
Set this to true to use fast SWT Virtual tables (off by default) |
static void |
stopEventDispatchRunning()
Stops the event dispatch thread running (if it isn't running. |
static java.net.URL |
stringToTempFile(byte[] contents,
java.lang.String type)
Given a byte array of content, writes it to a temporary file and then returns the path to it as a URL |
static int |
translateSwingAlignmentConstant(int constant)
Translates the alignment part of the Swing constants |
static int |
translateSwingOrientationConstant(int constant)
Translates the orientation part of the Swing constants |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean showInternalSWTExceptions
public static int MACOSX_MENUBAR_BOTTOM
Constructor Detail |
public SwingWTUtils()
Method Detail |
public static java.lang.String getVersion()
public static void incrementWindowReferences()
public static void decrementWindowReferences()
public static void setShowSwingWTInfoOnStartup(boolean b)
public static void setRetardDispatchThread(boolean b)
public static void setRetardDispatchThread(boolean b, int ms)
public static void setEclipsePlugin(boolean b)
public static boolean isUseSWTFastVirtualTables()
public static void setUsesSWTFastVirtualTables(boolean b)
public static void initialiseMacOSX(java.lang.Runnable run)
run
- The startup code to run (this call will block)public static void checkEventDispatcher()
public static boolean isRetardDispatchThread()
public static int getRetardationInterval()
public static org.eclipse.swt.widgets.Display getDisplay()
public static boolean isSWTControlAvailable(org.eclipse.swt.widgets.Control c)
public static boolean isSWTMenuControlAvailable(org.eclipse.swt.widgets.MenuItem c)
public static boolean isEventDispatchRunning()
public static void stopEventDispatchRunning()
public static boolean isUrlInJar(java.net.URL url) throws java.io.IOException
url
- The path to inspect.
java.io.IOException
public static java.net.URL stringToTempFile(byte[] contents, java.lang.String type) throws java.io.IOException
contents
- The content of the filetype
- The file extension to use
java.io.IOException
- if an error occurspublic static void clearTempDirectory()
public static void checkShutdownHook()
public static boolean isWindows()
public static boolean isMacOSX()
public static void saveImageToJPG(Image image, java.io.OutputStream stream)
public static void saveImageToGIF(Image image, java.io.OutputStream stream)
public static void saveImageToPNG(Image image, java.io.OutputStream stream)
public static int getRenderStringWidth(java.lang.String text)
public static int getRenderStringHeight(java.lang.String text)
public static int getStringBufferIndexOf(java.lang.StringBuffer buffer, java.lang.String string)
buffer
- The StringBuffer to find instring
- The String to find
public static int getStringBufferIndexOf(java.lang.StringBuffer buffer, java.lang.String string, int fromIndex)
buffer
- The StringBuffer to find instring
- The String to findfromIndex
- The char index to search from
public static org.eclipse.swt.graphics.Image getSWTImageFromSwingIcon(Component c, Icon icon)
icon
- The icon to render
public static int translateSwingAlignmentConstant(int constant)
public static int translateSwingOrientationConstant(int constant)
public static java.lang.String removeHTML(java.lang.String s)
s
- The string to remove HTML tags frompublic static java.lang.String replace(java.lang.String findin, java.lang.String find, java.lang.String replacewith)
findin
- The string to find occurrences infind
- The string to findreplacewith
- The string to replace found occurrences with
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |