Package javaforce.awt
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) static JFImagecreateJFImage(Container parent) static JFramecreateJFrame(String title, int x, int y, int w, int h, LayoutManager lm) static JPanelcreateJPanel(int x, int y, int w, int h, LayoutManager lm, Container parent) static JPanelcreateJPanel(LayoutManager lm, Container parent) static voiddonate()static Set<? extends AWTKeyStroke> 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) static StringgetOpenFile(String path, String[][] filters) Show open file dialog.static StringgetOpenFolder(String path) static StringgetSaveAsFile(String path) static StringgetSaveAsFile(String path, String[][] filters) Show save file dialog.static StringgetSaveFile(String file) static StringgetSaveFile(String file, String[][] filters) Show save file dialog.static doublestatic Stringstatic intgetWidth()Returns current screen width.static voidList available fonts.static voidLoads font config for graal apps.static voidstatic voidOpens a URL in default web browserstatic voidsetJPanelMenuBar(JPanel parent, JPanel child, JMenuBar menuBar) Modifies a JPanel so it can use a JMenuBar.static voidstatic booleanshowConfirm(String title, String msg) static final intshowConfirm3(String title, String msg) static voidstatic voidshowMessage(String title, String msg)
-
Field Details
-
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
-
createJPanel
-
createJPanel
-
createJFImage
-
createJFImage
-
getFontMetrics
Returns font metrics for a "monospaced" font. [0] = width [1] = ascent [2] = descent height = [1] + [2] -
getFontMetrics
Returns font metrics for regular fonts. [0] = width [1] = ascent [2] = descent height = [1] + [2] -
showMessage
-
showError
-
getString
-
showConfirm
-
showConfirm3
-
assignHotKey
Assigns a single hot key to activate button. Use mnemonics for key combos. -
assignHotKey
Assigns a single hot key to activate button. Use mnemonics for key combos. -
assignHotKey
Assigns a single hot key to activate button. Use mnemonics for key combos. -
assignHotKey
Assigns a single hot key to activate button. Use mnemonics for key combos. -
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
Show open file dialog.- Parameters:
path- = init pathfilters- [][] = new String[][] { {"desc", "txt"}, ...};- Returns:
-
getSaveFile
-
getSaveFile
Show save file dialog.- Parameters:
file- = init filefilters- [][] = new String[][] { {"desc", "txt"}, ...};- Returns:
-
getSaveAsFile
-
getSaveAsFile
Show save file dialog.- Parameters:
path- = init pathfilters- [][] = new String[][] { {"desc", "txt"}, ...};- Returns:
-
getOpenFolder
-
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
-
loadFontConfig
public static void loadFontConfig()Loads font config for graal apps. -
listFonts
public static void listFonts()List available fonts. -
emptyKeys
-