|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xnap.gui.util.GUIHelper
public class GUIHelper
Helps with gui related tasks. We can not have Preferences.java
depend on java.awt.
Field Summary | |
---|---|
static int |
POPUP_MENU_HEIGHT_INSET
Kicker offset. |
protected static Preferences |
prefs
|
Constructor Summary | |
---|---|
GUIHelper()
|
Method Summary | |
---|---|
static void |
bindEmacsKeysToTable(javax.swing.JTable jta)
Adds some Emacs like keybindings to a table for moving between rows. |
static boolean |
bindEnterKey(javax.swing.JComponent c,
javax.swing.Action action)
Adds a mapping between the enter key and action to the
input map of c . |
static boolean |
bindEnterKeyLocally(javax.swing.JComponent c,
javax.swing.Action action)
Does the same as bindEnterKey(JComponent, Action) but
uses the default input map and not the window input map. |
static boolean |
bindEscapeKey(javax.swing.JComponent c,
javax.swing.Action action)
Adds a mapping between the escape key and action to the
input map of c . |
static boolean |
bindKey(javax.swing.JComponent c,
javax.swing.KeyStroke ks,
javax.swing.Action action,
boolean whenInFocusedWindow)
Adds a mapping between ks and action to the
input map of c . |
static javax.swing.border.Border |
createDefaultBorder(java.lang.String title)
Returns an etched default border. |
static javax.swing.border.Border |
createEmptyBorder()
Returns an empty border. |
static javax.swing.border.Border |
createEmptyBorder(int inset)
Returns an empty border. |
static javax.swing.border.Border |
createEtchedBorder()
Returns an empty border. |
static javax.swing.JComponent |
createHeader(java.lang.String title)
Creates and answers a label with separator; useful to separate paragraphs in a panel. |
static javax.swing.border.Border |
createLoweredBorder()
|
static javax.swing.border.Border |
createRaisedBorder()
|
static javax.swing.JComponent |
createSeparator(java.lang.String title)
|
static javax.swing.border.Border |
createTitledBorder(java.lang.String title,
int inset)
Returns a titled border. |
static void |
expandAllNodes(javax.swing.JTree jt)
|
static javax.swing.KeyStroke |
getMenuKeyStroke(int keyCode)
|
static void |
initialize()
|
static java.lang.String |
label(java.lang.String text)
Wraps HTML tags around text so the maximum width
is limited to a senseful value. |
static void |
limitSize(javax.swing.JComponent c)
|
static void |
restrictWidth(javax.swing.JComponent jc)
|
static void |
scrollToEnd(javax.swing.text.JTextComponent jt)
|
static void |
setAccelerator(javax.swing.JMenuItem jmi,
int keyCode)
|
static void |
setMnemonics(java.awt.Container c)
|
static void |
setMnemonics(java.awt.Container c,
java.util.HashSet l)
|
static void |
setMnemonics(javax.swing.JTabbedPane pane)
|
static boolean |
shouldScroll(javax.swing.JScrollBar jsb)
Returns true, if jsb is at the maximum value. |
static void |
showFile(javax.swing.text.JTextComponent jta,
java.lang.String filename,
java.lang.String altText)
Loads text from file and sets it to jta . |
static void |
showPopupMenu(javax.swing.JPopupMenu jpm,
java.awt.Component source,
int x,
int y)
|
static void |
showPopupMenu(javax.swing.JPopupMenu jpm,
java.awt.Component source,
int x,
int y,
int yOffset)
|
static java.lang.String |
tableRow(java.lang.String key,
java.lang.String value)
Formats key, value as a HTML table row, the key is highlighted as bold. |
static java.lang.String |
tt(java.lang.String text)
Wraps HTML tags around text so the maximum width
is limited to a sensible value. |
static java.lang.String |
tt(java.lang.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
protected static Preferences prefs
Constructor Detail |
---|
public GUIHelper()
Method Detail |
---|
public static boolean bindEnterKey(javax.swing.JComponent c, javax.swing.Action action)
action
to the
input map of c
.
public static boolean bindEnterKeyLocally(javax.swing.JComponent c, javax.swing.Action action)
bindEnterKey(JComponent, Action)
but
uses the default input map and not the window input map.
public static boolean bindEscapeKey(javax.swing.JComponent c, javax.swing.Action action)
action
to the
input map of c
.
public static boolean bindKey(javax.swing.JComponent c, javax.swing.KeyStroke ks, javax.swing.Action action, boolean whenInFocusedWindow)
ks
and action
to the
input map of c
.
public static javax.swing.border.Border createDefaultBorder(java.lang.String title)
public static javax.swing.border.Border createEmptyBorder(int inset)
public static javax.swing.border.Border createEmptyBorder()
public static javax.swing.border.Border createEtchedBorder()
public static javax.swing.border.Border createLoweredBorder()
public static javax.swing.border.Border createRaisedBorder()
public static javax.swing.JComponent createHeader(java.lang.String title)
TitledBorder
.
The current implementation doesn't support component alignments.
Copyright (c) 2003 JGoodies Karsten Lentzsch. All Rights Reserved. Modified by Steffen Pingel for XNap.
text
- the title's textalignment
- text alignment: left, center, right
public static javax.swing.JComponent createSeparator(java.lang.String title)
public static javax.swing.border.Border createTitledBorder(java.lang.String title, int inset)
public static void expandAllNodes(javax.swing.JTree jt)
public static void initialize()
public static void restrictWidth(javax.swing.JComponent jc)
public static void scrollToEnd(javax.swing.text.JTextComponent jt)
public static boolean shouldScroll(javax.swing.JScrollBar jsb)
jsb
is at the maximum value.
public static javax.swing.KeyStroke getMenuKeyStroke(int keyCode)
public static void setAccelerator(javax.swing.JMenuItem jmi, int keyCode)
public static void setMnemonics(javax.swing.JTabbedPane pane)
public static void setMnemonics(java.awt.Container c)
public static void setMnemonics(java.awt.Container c, java.util.HashSet l)
public static void showFile(javax.swing.text.JTextComponent jta, java.lang.String filename, java.lang.String altText)
jta
.
If file is not found or could not be read, sets
altText
instead.
public static void showPopupMenu(javax.swing.JPopupMenu jpm, java.awt.Component source, int x, int y, int yOffset)
public static void showPopupMenu(javax.swing.JPopupMenu jpm, java.awt.Component source, int x, int y)
public static java.lang.String label(java.lang.String text)
text
so the maximum width
is limited to a senseful value.
public static java.lang.String tt(java.lang.String text, int width)
text
so the maximum width
is limited to a senseful value.
public static java.lang.String tt(java.lang.String text)
text
so the maximum width
is limited to a sensible value.
public static java.lang.String tableRow(java.lang.String key, java.lang.String value)
public static void limitSize(javax.swing.JComponent c)
public static void bindEmacsKeysToTable(javax.swing.JTable jta)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |