|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xnap.commons.gui.util.GUIHelper
public class GUIHelper
Helps with gui related tasks.
Field Summary | |
---|---|
static int |
POPUP_MENU_HEIGHT_INSET
Kicker offset. |
Constructor Summary | |
---|---|
GUIHelper()
|
Method Summary | |
---|---|
static void |
bindEmacsKeysToTable(JTable jta)
Adds some Emacs like keybindings to a table for moving between rows. |
static boolean |
bindEnterKey(JComponent c,
Action action)
Adds a mapping between the enter key and action to the
input map of c . |
static boolean |
bindEnterKeyLocally(JComponent c,
Action action)
Does the same as bindEnterKey(JComponent, Action) but uses the
default input map and not the window input map. |
static boolean |
bindEscapeKey(JComponent c,
Action action)
Adds a mapping between the escape key and action to the
input map of c . |
static void |
bindExpandCollapseKeysToTree(JTree tree)
|
static boolean |
bindKey(JComponent c,
KeyStroke ks,
Action action,
boolean whenInFocusedWindow)
Adds a mapping between ks and action to the
input map of c . |
static Border |
createDefaultBorder(String title)
Returns an etched default border. |
static Border |
createEmptyBorder()
Returns an empty border. |
static Border |
createEmptyBorder(int inset)
Returns an empty border. |
static Border |
createEtchedBorder()
Returns an empty border. |
static JComponent |
createHeader(String title)
Returns a component that displays title in a bold font. |
static Border |
createLoweredBorder()
|
static Border |
createRaisedBorder()
|
static Border |
createTitledBorder(String title,
int inset)
Returns a titled border. |
static void |
expandAllNodes(JTree tree,
boolean expand)
|
static void |
expandAllNodes(JTree tree,
TreePath path,
boolean expand)
|
static KeyStroke |
getMenuKeyStroke(int keyCode)
|
static KeyStroke |
getMenuShortcut(int keyCode)
|
static String |
label(String text)
Wraps HTML tags around text so the maximum width is
limited to a senseful value. |
static void |
limitSize(JComponent c)
|
static void |
restrictWidth(JComponent jc)
|
static void |
scrollToEnd(JTextComponent jt)
|
static void |
setAccelerator(JMenuItem jmi,
int keyCode)
|
static void |
setMnemonics(Container c)
|
static void |
setMnemonics(Container c,
HashSet<Integer> l)
|
static void |
setMnemonics(JTabbedPane pane)
|
static boolean |
shouldScroll(JScrollBar jsb)
Returns true, if jsb is at the maximum value. |
static void |
showFile(JTextComponent jtc,
String filename,
String altText)
Loads text from file and sets it to jtc . |
static void |
showPopupMenu(JPopupMenu jpm,
Component source,
int x,
int y)
|
static void |
showPopupMenu(JPopupMenu jpm,
Component source,
int x,
int y,
int yOffset)
|
static String |
tableRow(String key,
String value)
Formats key, value as a HTML table row, the key is highlighted as bold. |
static String |
tt(String text)
Wraps HTML tags around text so the maximum width is
limited to a sensible value. |
static String |
tt(String text,
int width)
Wraps HTML tags around text so the maximum width is
limited to a senseful value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int POPUP_MENU_HEIGHT_INSET
Constructor Detail |
---|
public GUIHelper()
Method Detail |
---|
public static boolean bindEnterKey(JComponent c, Action action)
action
to the
input map of c
.
public static boolean bindEnterKeyLocally(JComponent c, Action action)
bindEnterKey(JComponent, Action)
but uses the
default input map and not the window input map.
public static boolean bindEscapeKey(JComponent c, Action action)
action
to the
input map of c
.
public static boolean bindKey(JComponent c, KeyStroke ks, Action action, boolean whenInFocusedWindow)
ks
and action
to the
input map of c
.
public static Border createDefaultBorder(String title)
public static Border createEmptyBorder(int inset)
public static Border createEmptyBorder()
public static Border createEtchedBorder()
public static Border createLoweredBorder()
public static Border createRaisedBorder()
public static JComponent createHeader(String title)
title
in a bold font.
public static Border createTitledBorder(String title, int inset)
public static void expandAllNodes(JTree tree, boolean expand)
public static void expandAllNodes(JTree tree, TreePath path, boolean expand)
public static void restrictWidth(JComponent jc)
public static void scrollToEnd(JTextComponent jt)
public static boolean shouldScroll(JScrollBar jsb)
jsb
is at the maximum value.
public static KeyStroke getMenuKeyStroke(int keyCode)
public static void setAccelerator(JMenuItem jmi, int keyCode)
public static void setMnemonics(JTabbedPane pane)
public static void setMnemonics(Container c)
public static void setMnemonics(Container c, HashSet<Integer> l)
public static void showFile(JTextComponent jtc, String filename, String altText)
jtc
.
If file is not found or could not be read, sets altText
instead.
public static void showPopupMenu(JPopupMenu jpm, Component source, int x, int y, int yOffset)
public static void showPopupMenu(JPopupMenu jpm, Component source, int x, int y)
public static String label(String text)
text
so the maximum width is
limited to a senseful value.
public static String tt(String text, int width)
text
so the maximum width is
limited to a senseful value.
public static KeyStroke getMenuShortcut(int keyCode)
public static String tt(String text)
text
so the maximum width is
limited to a sensible value.
public static String tableRow(String key, String value)
public static void limitSize(JComponent c)
public static void bindExpandCollapseKeysToTree(JTree tree)
public static void bindEmacsKeysToTable(JTable jta)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |