org.thdl.savant
Class JdkVersionHacks

java.lang.Object
  |
  +--org.thdl.savant.JdkVersionHacks

public final class JdkVersionHacks
extends Object

Author:
David Chandler This class provides functionality that is not present in Java's JDK 1.2. Because we want to compile and run on a Java 2/1.2 system, we must use the Java Reflection API to provide functionality specific to Java 2/1.3 or later. At present, I haven't tested on a 1.2 box, but I have tested on a 1.3.1_04 box. If your code will break if some functionality here is not present, test the return value of the function and throw an exception. Avoid such code like the plague. This code is all written for one-shot operations thus-far. If you plan on executing a piece of code many times, you need to set up the reflection mechanism first, and then re-use it again and again. This is a two-step process. Three steps if you explicitly deconstruct the mechanism. This class is not instantiable.

Constructor Summary
private JdkVersionHacks()
          Don't instantiate this class.
 
Method Summary
private static void handleSecurityException(SecurityException ex)
          Coming soon: Does what the user desires (via the options he or she has set) with this SecurityException, one encountered during the process of reflection.
private static Object maximizedBothOption()
          Returns the value of Frame.MAXIMIZED_BOTH, wrapped in an Integer.
static boolean maximizedBothSupported(Toolkit tk)
          Returns true iff maximizeJFrameInBothDirections(f) will actually have an effect.
static boolean maximizeJFrameInBothDirections(JFrame f)
          Calls f.setExtendedState(Frame.MAXIMIZED_BOTH) if possible.
static boolean undecorateJFrame(JFrame f)
          Calls f.setUndecorated(true) if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdkVersionHacks

private JdkVersionHacks()
Don't instantiate this class.

Method Detail

undecorateJFrame

public static boolean undecorateJFrame(JFrame f)
Calls f.setUndecorated(true) if possible. Returns true if successful.


maximizeJFrameInBothDirections

public static boolean maximizeJFrameInBothDirections(JFrame f)
Calls f.setExtendedState(Frame.MAXIMIZED_BOTH) if possible. Returns true if successful.


maximizedBothSupported

public static boolean maximizedBothSupported(Toolkit tk)
Returns true iff maximizeJFrameInBothDirections(f) will actually have an effect.


handleSecurityException

private static void handleSecurityException(SecurityException ex)
                                     throws SecurityException
Coming soon: Does what the user desires (via the options he or she has set) with this SecurityException, one encountered during the process of reflection. Currently: does nothing. FIXME

SecurityException

maximizedBothOption

private static Object maximizedBothOption()
                                   throws NoSuchFieldException
Returns the value of Frame.MAXIMIZED_BOTH, wrapped in an Integer.

Throws:
NoSuchFieldException - the field does not exist or cannot be accessed because security settings are too limiting


These API docs were created 02/02/2003 08:20 PM.
Copyright © 2001-2002 Tibetan and Himalayan Digital Library. All Rights Reserved.
Hosted by SourceForge_Logo