bibliothek.util
Class Workarounds

java.lang.Object
  extended by bibliothek.util.Workarounds

public class Workarounds
extends Object

Utility class providing help for bugs or specialities present in some versions of the JRE or in some libraries. Workarounds is implemented as singleton, as there is only one JRE and usually libraries are not loaded multiple times as well.

Author:
Benjamin Sigg

Constructor Summary
Workarounds()
           
 
Method Summary
 void addWorkaround(Workaround workaround)
          Adds a new workaround to this Workarounds.
static Workarounds getDefault()
          Gets access to the currently used Workaroundss.
 Workaround[] getWorkarounds()
          Gets all the Workarounds that are currently active.
 boolean makeTransparent(Window window)
          Makes window transparent, meaning that the opacity of each pixel is defined by the alpha value or the Color that was used to paint over that pixel.
 void markAsGlassPane(Component component)
          This method is necessary since 1.6.14, it marks a component as transparent.
 void removeWorkaround(Workaround workaround)
          Removes a workaround from this Workarounds.
static void setDefault(Workarounds workarounds)
          Seets the Workarounds that should be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Workarounds

public Workarounds()
Method Detail

getDefault

public static Workarounds getDefault()
Gets access to the currently used Workaroundss.

Returns:
the current workarounds

setDefault

@ClientOnly
public static void setDefault(Workarounds workarounds)
Seets the Workarounds that should be used. This method will never be called from the framework itself. Calling this method has no effect on workarounds that are already applied.
Please note that this method is not thread safe!

Parameters:
workarounds - the new workarounds, not null

addWorkaround

public void addWorkaround(Workaround workaround)
Adds a new workaround to this Workarounds.

Parameters:
workaround - the new workaround, not null

removeWorkaround

public void removeWorkaround(Workaround workaround)
Removes a workaround from this Workarounds.

Parameters:
workaround - the workaround to remove

getWorkarounds

public Workaround[] getWorkarounds()
Gets all the Workarounds that are currently active.

Returns:
all the workarounds

markAsGlassPane

public void markAsGlassPane(Component component)
This method is necessary since 1.6.14, it marks a component as transparent. If not marked then AWT components behind component are not visible.

Parameters:
component - the component to mark completely transparent

makeTransparent

public boolean makeTransparent(Window window)
Makes window transparent, meaning that the opacity of each pixel is defined by the alpha value or the Color that was used to paint over that pixel.

Parameters:
window - the window that should be transparent
Returns:
true if the winodw is now transparent