Class JFAWT
java.lang.Object
javaforce.awt.JFAWT
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassignHotKey(JDialog dialog, Runnable action, int vk) Assigns a single hot key to activate button.static voidassignHotKey(JDialog dialog, JButton button, int vk) Assigns a single hot key to activate button.static voidassignHotKey(JRootPane root, Runnable action, int vk) Assigns a single hot key to activate button.static voidassignHotKey(JRootPane root, JButton button, int vk) Assigns a single hot key to activate button.static voidcenterWindow(Window window) Centers a window on screen (works with java.awt.Window/Frame javax.swing.JWindow/JFrame/JDialogstatic JFImagecreateJFImage(int x, int y, int w, int h, Container parent) Creates JFImage with size and position within container.static JFImagecreateJFImage(Container parent) Creates JFImage that will fill parent container.static JFramecreateJFrame(String title, int x, int y, int w, int h, LayoutManager lm) Creates a JFrame with desired size and position.static JPanelcreateJPanel(int x, int y, int w, int h, LayoutManager lm, Container parent) Creates JPanel with size and position within container.static JPanelcreateJPanel(LayoutManager lm, Container parent) Creates JPanel that will fill parent container.static voiddonate()static Set<? extends AWTKeyStroke> Creates empty Set of AWTKeyStoke.static int[]getFontMetrics(Font fnt) Returns font metrics for a "monospaced" font.static int[]getFontMetrics(Font font, String txt) Returns font metrics for regular fonts.static intReturns current screen height.static RectangleSame as java.awt.GraphicsEnvironment.getMaximumWindowBounds() except works after a screen mode change.static FontgetMonospacedFont(int style, int size) Due to JVM bugs finding a monospaced font is not that easy...static StringgetOpenFile(String path) Show open file dialog with init path.static StringgetOpenFile(String path, String[][] filters) Show open file dialog.static StringgetOpenFolder(String path) Show select folder dialog with init path.static StringgetSaveAsFile(String path) Show save file as dialog with init path.static StringgetSaveAsFile(String path, String[][] filters) Show save file as dialog.static StringgetSaveFile(String file) Show save file dialog with init path.static StringgetSaveFile(String file, String[][] filters) Show save file dialog.static doublestatic StringPopup dialog that allows String input.static intgetWidth()Returns current screen width.static voidList available fonts.static voidLoads font config for graal apps.static voidOpens a URL in default web browserstatic voidsetJPanelMenuBar(JPanel parent, JPanel child, JMenuBar menuBar) Modifies a JPanel so it can use a JMenuBar.static voidChange LAF to Metal theme.static booleanshowConfirm(String title, String msg) Show confirmation popup with message and title (OK, CANCEL).static final intshowConfirm3(String title, String msg) Show confirmation popup with message and title that includes 3 options (YES, NO, CANCEL).static voidShow error message with title.static voidshowMessage(String title, String msg) Show a message with title.
-
Field Details
-
debug
public static boolean debug -
KEY_MASKS
public static int KEY_MASKSValue 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
Opens a URL in default web browser -
createJFrame
Creates a JFrame with desired size and position.- Parameters:
title- = Window titlex- ,y = position of windoww- ,h = size of client area within windowlm- = LayoutManager
-
createJPanel
Creates JPanel that will fill parent container. -
createJPanel
Creates JPanel with size and position within container. -
createJFImage
-
createJFImage
-
getFontMetrics
Returns font metrics for a "monospaced" font. [0] = width [1] = ascent [2] = descent height = [1] + [2] -
getFontMetrics
-
showMessage
-
showError
-
getString
-
showConfirm
-
showConfirm3
-
assignHotKey
-
assignHotKey
-
assignHotKey
-
assignHotKey
-
getMonospacedFont
Due to JVM bugs finding a monospaced font is not that easy... See : Java Bug # 9009891 @ bugs.sun.com -
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
Centers a window on screen (works with java.awt.Window/Frame javax.swing.JWindow/JFrame/JDialog -
setJPanelMenuBar
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
-
getOpenFile
-
getSaveFile
-
getSaveFile
-
getSaveAsFile
-
getSaveAsFile
-
getOpenFolder
-
setMetalLAF
public static void setMetalLAF()Change LAF to Metal theme. -
getWidth
public static int getWidth()Returns current screen width. -
getHeight
public static int getHeight()Returns current screen height. -
getScaling
public static double getScaling() -
loadFontConfig
public static void loadFontConfig()Loads font config for graal apps. -
listFonts
public static void listFonts()List available fonts. -
emptyKeys
Creates empty Set of AWTKeyStoke.
-