org.opensourcephysics.display
Class GUIUtils

java.lang.Object
  extended by org.opensourcephysics.display.GUIUtils

public class GUIUtils
extends java.lang.Object


Method Summary
static void clearDrawingFrameData(boolean clearAll)
          Clears the data in animated DrawingFrames and repaints the frame's content.
static void closeAndDisposeOSPFrames(java.awt.Frame frame)
          Disposes all OSP frames except the given frame.
static void enableMenubars(boolean enable)
          Enables and disables the menu bars in DrawingFrames and DrawingFrame3D.
static java.awt.Component findInstance(java.awt.Container container, java.lang.Class<?> c)
          Finds an instance of a class in the given container.
static java.lang.String parseTeX(java.lang.String input)
          Deprecated. use TeXParser class.
static java.lang.String removeSubscripting(java.lang.String input)
          Deprecated. use TeXParser class.
static void renderAnimatedFrames()
          Renders all OSPFrames whose animated property is true.
static void repaintAnimatedFrames()
          Repaints all OSPFrames whose animated property is true.
static void repaintOSPFrames()
          Repaints all OSPFrames.
static void saveImage(javax.swing.JComponent comp, java.io.File outputFile, java.lang.String outputFileFormat)
          Saves the contents of the specified component in the given file format.
static void saveImage(javax.swing.JComponent component, java.lang.String ouputFileFormat, java.awt.Component parent)
          Saves the contents of the specified component in the given file format.
static void setAnimatedFrameIgnoreRepaint(boolean ignoreRepaint)
          Sets the IgnorRepaint for all animated frames to the given value.
static void showDrawingAndTableFrames()
          Shows all drawing and table frames.
static java.io.File showOpenDialog(java.awt.Component parent)
           
static java.io.File showSaveDialog(java.awt.Component parent)
          Pops up a "Save File" file chooser dialog and takes user through process of saving a file.
static java.io.File showSaveDialog(java.awt.Component parent, java.lang.String title)
          Pops up a "Save File" file chooser dialog and takes user through process of saving a file.
static void timingTest(Drawable drawable)
          Test the time to render a drawable component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseTeX

public static java.lang.String parseTeX(java.lang.String input)
Deprecated. use TeXParser class.

Converts TeX-like notation for Greek symbols to unicode characters.

Parameters:
input -
Returns:

removeSubscripting

public static java.lang.String removeSubscripting(java.lang.String input)
Deprecated. use TeXParser class.

Removes TeX subscripting from the input.

Parameters:
input -
Returns:

findInstance

public static java.awt.Component findInstance(java.awt.Container container,
                                              java.lang.Class<?> c)
Finds an instance of a class in the given container.

Parameters:
container - Container
c - Class
Returns:
Component

showDrawingAndTableFrames

public static void showDrawingAndTableFrames()
Shows all drawing and table frames. Usually invoked when a model is initialized but may be invoked at other times to show frames that have been closed.


renderAnimatedFrames

public static void renderAnimatedFrames()
Renders all OSPFrames whose animated property is true. Usually invoked by an animation thread after every animation step.


repaintAnimatedFrames

public static void repaintAnimatedFrames()
Repaints all OSPFrames whose animated property is true. Usually invoked by a control's single-step button.


repaintOSPFrames

public static void repaintOSPFrames()
Repaints all OSPFrames.


clearDrawingFrameData

public static void clearDrawingFrameData(boolean clearAll)
Clears the data in animated DrawingFrames and repaints the frame's content. All frames are cleared if clearAll<\code> is true; otherwise only frames whose autoClear<\code> flag is true will be cleared.

Parameters:
clearAll - clears all frames if true

setAnimatedFrameIgnoreRepaint

public static void setAnimatedFrameIgnoreRepaint(boolean ignoreRepaint)
Sets the IgnorRepaint for all animated frames to the given value.

Parameters:
ignoreRepaint - boolean

enableMenubars

public static void enableMenubars(boolean enable)
Enables and disables the menu bars in DrawingFrames and DrawingFrame3D. Usually invoked when a model is initialized but may be invoked at other times.


closeAndDisposeOSPFrames

public static void closeAndDisposeOSPFrames(java.awt.Frame frame)
Disposes all OSP frames except the given frame. Usually invoked when the control window is being closed.

Parameters:
frame - will not be disposed

showSaveDialog

public static java.io.File showSaveDialog(java.awt.Component parent)
Pops up a "Save File" file chooser dialog and takes user through process of saving a file.

Parameters:
parent - the parent component of the dialog, can be null; see showDialog in class JFileChooser for details
Returns:
the file or null if an error occurred:

showSaveDialog

public static java.io.File showSaveDialog(java.awt.Component parent,
                                          java.lang.String title)
Pops up a "Save File" file chooser dialog and takes user through process of saving a file.

Parameters:
parent - the parent component of the dialog, can be null; see showDialog in class JFileChooser for details
title -
Returns:
the file or null if an error occurred:

showOpenDialog

public static java.io.File showOpenDialog(java.awt.Component parent)

timingTest

public static void timingTest(Drawable drawable)
Test the time to render a drawable component.

Parameters:
drawable -

saveImage

public static void saveImage(javax.swing.JComponent comp,
                             java.io.File outputFile,
                             java.lang.String outputFileFormat)
                      throws java.io.IOException
Saves the contents of the specified component in the given file format. Note method requires Java 1.4

Parameters:
comp -
outputFile - the output file
outputFileFormat - output file format. One of eps, jpeg, or png
Throws:
java.io.IOException

saveImage

public static void saveImage(javax.swing.JComponent component,
                             java.lang.String ouputFileFormat,
                             java.awt.Component parent)
Saves the contents of the specified component in the given file format. Pops open a save file dialog to allow the user to select the output file. Note method requires Java 1.4

Parameters:
component - comp the component
ouputFileFormat - output file format. One of eps, jpeg, or png
parent - dialog parent