Class AwtUtil

java.lang.Object
com.moneydance.awt.AwtUtil

public class AwtUtil
extends java.lang.Object
Description: Misc. functions to make GUI programming easier.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int DEFAULT_INSET  
    static int DEFAULT_X_INSET  
    static java.awt.Insets noInsets  
    static java.awt.Insets tallInsets  
    static int WINDOW_BOTTOM_LEFT  
    static int WINDOW_BOTTOM_RIGHT  
    static int WINDOW_CENTER  
    static int WINDOW_TOP_LEFT  
    static int WINDOW_TOP_RIGHT  
  • Constructor Summary

    Constructors 
    Constructor Description
    AwtUtil()  
  • Method Summary

    Modifier and Type Method Description
    static void centerWindow​(java.awt.Window win)  
    static java.awt.Color colorFromHexString​(java.lang.String colorString)
    Returns an instance of java.awt.Color for the given string, which should consist of a 6 digit hexadecimal string with a prefix of either '0x' or '#'.
    static void drawHashOverArea​(java.awt.Graphics2D g, int x, int y, int width, int height)
    Draw diagonal hashing lines over the given area.
    static void dumpSizingInformation​(java.io.PrintStream out, java.lang.String prefix, java.awt.Component c, int depthLimit)  
    static void enableAntiAliasing​(java.awt.Graphics g)  
    static java.awt.GridBagConstraints getC​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, java.awt.Insets insets)  
    static java.awt.GridBagConstraints getC​(int x, int y, float weightx, float weighty, int width, int height, int padx, int pady, int topInset, int leftInset, int botInset, int rightInset)  
    static java.awt.Component getClosestFrameOrDialogAncestor​(java.awt.Component c)
    Returns the nearest Frame or JDialog that is an ancestor to the given component.
    static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly)  
    static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align)  
    static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, int inset)  
    static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, int xinset, int yinset)  
    static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int topInset, int leftInset, int botInset, int rightInset)  
    static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, int topInset, int leftInset, int botInset, int rightInset)  
    static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, int topInset, int leftInset, int botInset, int rightInset)  
    static java.awt.Frame getFrame​(java.awt.Component c)  
    static javax.swing.JFrame getJFrame​(java.awt.Component c)
    Since build 505 of Moneydance
    static java.awt.Component getTopmostParent​(java.awt.Component c)  
    static java.awt.Window getWindow​(java.awt.Component c)  
    static java.lang.String hexStringForColor​(java.awt.Color color)
    Return the hex string for the given colour.
    static java.awt.Image loadImage​(java.lang.Class base, java.lang.String imageFileName)  
    static java.awt.Image loadImage​(java.lang.Class base, java.lang.String imageFileName, java.awt.Component comp)  
    static java.awt.Image loadImage​(java.lang.String imageFileName)  
    static void setupWindow​(java.awt.Window child)  
    static void setupWindow​(java.awt.Window child, int position)  
    static void setupWindow​(java.awt.Window child, int width, int height)  
    static void setupWindow​(java.awt.Window child, int width, int height, int position)  
    static void setupWindow​(java.awt.Window child, int width, int height, int x, int y)  
    static void setupWindow​(java.awt.Window child, int width, int height, int x, int y, java.awt.Component parent)  
    static void setupWindow​(java.awt.Window child, int width, int height, java.awt.Component parent)  
    static void setupWindow​(java.awt.Window child, java.awt.Component parent)  
    static void setWindowPosition​(java.awt.Window win, int position)  
    static void setWindowPosition​(java.awt.Window child, java.awt.Component parent)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getConstraints

      public static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly)
    • getConstraints

      public static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align)
    • getConstraints

      public static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, int inset)
    • getConstraints

      public static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, int xinset, int yinset)
    • getConstraints

      public static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int topInset, int leftInset, int botInset, int rightInset)
    • getConstraints

      public static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, int topInset, int leftInset, int botInset, int rightInset)
    • getConstraints

      public static java.awt.GridBagConstraints getConstraints​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, int topInset, int leftInset, int botInset, int rightInset)
    • getC

      public static java.awt.GridBagConstraints getC​(int x, int y, float weightx, float weighty, int width, int height, int padx, int pady, int topInset, int leftInset, int botInset, int rightInset)
    • getC

      public static java.awt.GridBagConstraints getC​(int x, int y, float weightx, float weighty, int width, int height, boolean fillx, boolean filly, int align, java.awt.Insets insets)
    • loadImage

      public static java.awt.Image loadImage​(java.lang.Class base, java.lang.String imageFileName)
    • loadImage

      public static java.awt.Image loadImage​(java.lang.String imageFileName) throws java.io.IOException
      Throws:
      java.io.IOException
    • loadImage

      public static java.awt.Image loadImage​(java.lang.Class base, java.lang.String imageFileName, java.awt.Component comp) throws java.io.IOException
      Throws:
      java.io.IOException
    • getTopmostParent

      public static final java.awt.Component getTopmostParent​(java.awt.Component c)
    • getFrame

      public static final java.awt.Frame getFrame​(java.awt.Component c)
    • getClosestFrameOrDialogAncestor

      public static java.awt.Component getClosestFrameOrDialogAncestor​(java.awt.Component c)
      Returns the nearest Frame or JDialog that is an ancestor to the given component. If no JDialog or Frame is found then return the top-most component ancestor.
    • getJFrame

      public static final javax.swing.JFrame getJFrame​(java.awt.Component c)
      Since build 505 of Moneydance
    • getWindow

      public static final java.awt.Window getWindow​(java.awt.Component c)
    • centerWindow

      public static final void centerWindow​(java.awt.Window win)
    • setWindowPosition

      public static final void setWindowPosition​(java.awt.Window win, int position)
    • setWindowPosition

      public static final void setWindowPosition​(java.awt.Window child, java.awt.Component parent)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child, int position)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child, java.awt.Component parent)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child, int width, int height)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child, int width, int height, int position)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child, int width, int height, int x, int y, java.awt.Component parent)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child, int width, int height, int x, int y)
    • setupWindow

      public static final void setupWindow​(java.awt.Window child, int width, int height, java.awt.Component parent)
    • dumpSizingInformation

      public static void dumpSizingInformation​(java.io.PrintStream out, java.lang.String prefix, java.awt.Component c, int depthLimit)
    • enableAntiAliasing

      public static void enableAntiAliasing​(java.awt.Graphics g)
    • drawHashOverArea

      public static void drawHashOverArea​(java.awt.Graphics2D g, int x, int y, int width, int height)
      Draw diagonal hashing lines over the given area.
      Since:
      build 600
    • colorFromHexString

      public static java.awt.Color colorFromHexString​(java.lang.String colorString)
      Returns an instance of java.awt.Color for the given string, which should consist of a 6 digit hexadecimal string with a prefix of either '0x' or '#'. Returns null if the string specifies an invalid color.
    • hexStringForColor

      public static java.lang.String hexStringForColor​(java.awt.Color color)
      Return the hex string for the given colour. This does _not_ include any 0x or # prefix and is only the 6 digit hexadecimal string.