Class JFAWT

java.lang.Object
javaforce.awt.JFAWT

public class JFAWT extends Object
  • Field Details

    • KEY_MASKS

      public static int KEY_MASKS
      Value of new key down masks (CTRL + ALT + SHIFT). Use with KeyEvent.getModifiersEx() Note : RightAlt is AltGraph that includes Alt + AltGraph masks.
    • YES

      public static final int YES
      See Also:
    • NO

      public static final int NO
      See Also:
    • CANCEL

      public static final int CANCEL
      See Also:
  • Constructor Details

    • JFAWT

      public JFAWT()
  • Method Details

    • openURL

      public static void openURL(String url)
      Opens a URL in default web browser
    • createJFrame

      public static JFrame createJFrame(String title, int x, int y, int w, int h, LayoutManager lm)
    • createJPanel

      public static JPanel createJPanel(LayoutManager lm, Container parent)
    • createJPanel

      public static JPanel createJPanel(int x, int y, int w, int h, LayoutManager lm, Container parent)
    • createJFImage

      public static JFImage createJFImage(Container parent)
    • createJFImage

      public static JFImage createJFImage(int x, int y, int w, int h, Container parent)
    • getFontMetrics

      public static int[] getFontMetrics(Font fnt)
      Returns font metrics for a "monospaced" font. [0] = width [1] = ascent [2] = descent height = [1] + [2]
    • getFontMetrics

      public static int[] getFontMetrics(Font font, String txt)
      Returns font metrics for regular fonts. [0] = width [1] = ascent [2] = descent height = [1] + [2]
    • showMessage

      public static void showMessage(String title, String msg)
    • showError

      public static void showError(String title, String msg)
    • getString

      public static String getString(String msg, String str)
    • showConfirm

      public static boolean showConfirm(String title, String msg)
    • showConfirm3

      public static final int showConfirm3(String title, String msg)
    • assignHotKey

      public static void assignHotKey(JDialog dialog, JButton button, int vk)
      Assigns a single hot key to activate button. Use mnemonics for key combos.
    • assignHotKey

      public static void assignHotKey(JRootPane root, JButton button, int vk)
      Assigns a single hot key to activate button. Use mnemonics for key combos.
    • assignHotKey

      public static void assignHotKey(JDialog dialog, Runnable action, int vk)
      Assigns a single hot key to activate button. Use mnemonics for key combos.
    • assignHotKey

      public static void assignHotKey(JRootPane root, Runnable action, int vk)
      Assigns a single hot key to activate button. Use mnemonics for key combos.
    • getMonospacedFont

      public static Font getMonospacedFont(int style, int size)
      Due to JVM bugs finding a monospaced font is not that easy... See : Java Bug # 9009891 @ bugs.sun.com
    • getMaximumBounds

      public static Rectangle getMaximumBounds()
      Same as java.awt.GraphicsEnvironment.getMaximumWindowBounds() except works after a screen mode change. See : http://stackoverflow.com/questions/22467544/java-awt-graphicsenvironment-getmaximumwindowbounds-does-not-change-after-scre
    • centerWindow

      public static void centerWindow(Window window)
      Centers a window on screen (works with java.awt.Window/Frame javax.swing.JWindow/JFrame/JDialog
    • setJPanelMenuBar

      public static void setJPanelMenuBar(JPanel parent, JPanel child, JMenuBar menuBar)
      Modifies a JPanel so it can use a JMenuBar. Usage: - Create a JPanel (parent) with another JPanel (child) inside it that fills the space - place your controls in the child JPanel - Create a JMenuBar (NetBeans will place it in "Other Components") - in the ctor after initComponents() call setJPanelMenuBar() ie: setJPanelMenuBar(this, child, menuBar); Note: a client property "root" is set in the parent JPanel to the JRootPane created if you need later.
    • donate

      public static void donate()
    • getOpenFile

      public static String getOpenFile(String path)
    • getOpenFile

      public static String getOpenFile(String path, String[][] filters)
      Show open file dialog.
      Parameters:
      path - = init path
      filters - [][] = new String[][] { {"desc", "txt"}, ...};
      Returns:
    • getSaveFile

      public static String getSaveFile(String file)
    • getSaveFile

      public static String getSaveFile(String file, String[][] filters)
      Show save file dialog.
      Parameters:
      file - = init file
      filters - [][] = new String[][] { {"desc", "txt"}, ...};
      Returns:
    • getSaveAsFile

      public static String getSaveAsFile(String path)
    • getSaveAsFile

      public static String getSaveAsFile(String path, String[][] filters)
      Show save file dialog.
      Parameters:
      path - = init path
      filters - [][] = new String[][] { {"desc", "txt"}, ...};
      Returns:
    • getOpenFolder

      public static String getOpenFolder(String path)
    • setMetalLAF

      public static void setMetalLAF()
    • getWidth

      public static int getWidth()
      Returns current screen width.
    • getHeight

      public static int getHeight()
      Returns current screen height.
    • getScaling

      public static double getScaling()
    • main

      public static void main(String[] args)
    • loadFontConfig

      public static void loadFontConfig()
      Loads font config for graal apps.
    • listFonts

      public static void listFonts()
      List available fonts.
    • emptyKeys

      public static Set<? extends AWTKeyStroke> emptyKeys()