org.faceless.pdf2.viewer2
Class Util

java.lang.Object
  extended by org.faceless.pdf2.viewer2.Util

public final class Util
extends Object

A utility class that handles localized Strings, display of error messages and so on. Developers extending the viewer are welcome to use this class

This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.

Since:
2.11 - created from the SuperJOptionPane class

Method Summary
static void displayThrowable(Throwable throwable, Component parent)
          Display an Error message, including the stack trace
static void fixScrollPaneKeyBindings(JScrollPane scrollpane)
          Remove the pageup/pagedown key bindings from ScrollPanes - they're clashing with the pageup/pagedown we're mapping on the DocumentPanel
static String getUIString(String key, String field1)
          Return a UIManager string field with the specified fields replaced
static String getUIString(String key, String field1, String field2)
          Return a UIManager string field with the specified fields replaced
static boolean isBrowserApplet(Component c)
          Return true if the viewer is running as an Applet inside a web browser, false otherwise
static boolean isJNLP(Component c)
          Return true if the specified component is running in a JNLP environment, false otherwise
static boolean isLAFAqua()
          Return true if the LAF uses the Aqua toolkit (OS X)
static boolean isLAFGTK()
          Return true if the LAF uses the GTK+ toolkit (UNIX)
static boolean isLAFMetal()
          Return true if the LAF uses the Meta toolkit
static boolean isLAFWindows()
          Return true if the LAF uses the Window toolkit
static boolean isStandaloneApplet(Component c)
          Return true if the viewer is running as an Applet that has been dragged outside of the web browser, false otherwise.
static boolean openURL(URL url, Component c)
          Display a URL in a web browser, if possible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

displayThrowable

public static void displayThrowable(Throwable throwable,
                                    Component parent)
Display an Error message, including the stack trace

Parameters:
throwable - the Throwable object this error relates to
parent - the parent component

isLAFAqua

public static boolean isLAFAqua()
Return true if the LAF uses the Aqua toolkit (OS X)


isLAFGTK

public static boolean isLAFGTK()
Return true if the LAF uses the GTK+ toolkit (UNIX)


isLAFWindows

public static boolean isLAFWindows()
Return true if the LAF uses the Window toolkit


isLAFMetal

public static boolean isLAFMetal()
Return true if the LAF uses the Meta toolkit


isBrowserApplet

public static boolean isBrowserApplet(Component c)
Return true if the viewer is running as an Applet inside a web browser, false otherwise

Parameters:
c - the Component
Since:
2.11.1

isStandaloneApplet

public static boolean isStandaloneApplet(Component c)
Return true if the viewer is running as an Applet that has been dragged outside of the web browser, false otherwise.

Parameters:
c - the Component
Since:
2.11.1

isJNLP

public static boolean isJNLP(Component c)
Return true if the specified component is running in a JNLP environment, false otherwise

Parameters:
c - the Component
Since:
2.11.1

openURL

public static boolean openURL(URL url,
                              Component c)
Display a URL in a web browser, if possible

Parameters:
url - the URL to open
c - the Component
Returns:
true if the URL could be opened, false otherwise
Since:
2.11.1

getUIString

public static String getUIString(String key,
                                 String field1)
Return a UIManager string field with the specified fields replaced

Parameters:
key - the message key,
field1 - the field to be substituted for {1}
Returns:
the modified string

getUIString

public static String getUIString(String key,
                                 String field1,
                                 String field2)
Return a UIManager string field with the specified fields replaced

Parameters:
key - the message key,
field1 - the field to be substituted for {1}
field2 - the field to be substituted for {2}
Returns:
the modified string

fixScrollPaneKeyBindings

public static void fixScrollPaneKeyBindings(JScrollPane scrollpane)
Remove the pageup/pagedown key bindings from ScrollPanes - they're clashing with the pageup/pagedown we're mapping on the DocumentPanel



Copyright © 2001-2009 Big Faceless Organization