|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gjt.sp.jedit.GUIUtilities
public class GUIUtilities
Various GUI functions.
The most frequently used members of this class are:
loadIcon(String)confirm(Component,String,Object[],int,int)error(Component,String,Object[])message(Component,String,Object[])showPopupMenu(JPopupMenu,Component,int,int)showVFSFileDialog(View,String,int,boolean)loadGeometry(Window,String)saveGeometry(Window,String)
| Field Summary | |
|---|---|
static javax.swing.Icon |
DIRTY_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("dirty.gif");
instead. |
static javax.swing.Icon |
NEW_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("new.gif");
instead. |
static javax.swing.Icon |
NORMAL_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("normal.gif");
instead. |
static javax.swing.Icon |
READ_ONLY_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("readonly.gif");
instead. |
static javax.swing.Icon |
WINDOW_ICON
Deprecated. Use GUIUtilities.loadIcon("jedit-icon.gif");
instead. |
| Method Summary | |
|---|---|
static void |
adjustForScreenBounds(java.awt.Rectangle desired)
Gives a rectangle the specified bounds, ensuring it is within the screen bounds. |
static void |
centerOnScreen(java.awt.Window win)
Centers the given window on the screen. |
static int |
confirm(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args,
int buttons,
int type)
Displays a confirm dialog box and returns the button pushed by the user. |
static javax.swing.JComponent |
createMultilineLabel(java.lang.String str)
Creates a component that displays a multiple line message. |
static void |
error(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args)
Displays an error dialog box. |
static java.lang.String |
getColorHexString(java.awt.Color c)
Converts a color object to its hex value. |
static java.awt.Component |
getComponentParent(java.awt.Component comp,
java.lang.Class clazz)
Finds a parent of the specified component. |
static java.awt.Image |
getEditorIcon()
Returns the default editor window image. |
static javax.swing.JDialog |
getParentDialog(java.awt.Component c)
Traverses the given component's parent tree looking for an instance of JDialog, and return it. |
static java.awt.Image |
getPluginIcon()
Returns the default plugin window image. |
static java.lang.String |
getStyleString(SyntaxStyle style)
Converts a style into it's string representation. |
static View |
getView(java.awt.Component comp)
Finds the view parent of the specified component. |
static void |
hideSplashScreen()
Ensures that the splash screen is not visible. |
static java.lang.String |
input(java.awt.Component comp,
java.lang.String name,
java.lang.Object def)
Displays an input dialog box and returns any text the user entered. |
static java.lang.String |
input(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args,
java.lang.Object def)
Displays an input dialog box and returns any text the user entered. |
static java.lang.String |
inputProperty(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args,
java.lang.String def)
Displays an input dialog box and returns any text the user entered. |
static java.lang.String |
inputProperty(java.awt.Component comp,
java.lang.String name,
java.lang.String def)
Displays an input dialog box and returns any text the user entered. |
static boolean |
isAncestorOf(java.awt.Component comp1,
java.awt.Component comp2)
Returns if the first component is an ancestor of the second by traversing up the component hierarchy. |
static boolean |
isMiddleButton(int modifiers)
|
static boolean |
isPopupTrigger(java.awt.event.MouseEvent evt)
Returns if the specified event is the popup trigger event. |
static boolean |
isRightButton(int modifiers)
|
static int |
listConfirm(java.awt.Component comp,
java.lang.String name,
java.lang.String[] args,
java.lang.Object[] listModel)
Displays a confirm dialog box and returns the button pushed by the user. |
static void |
loadGeometry(java.awt.Window win,
java.lang.String name)
Loads a windows's geometry from the properties. |
static javax.swing.Icon |
loadIcon(java.lang.String iconName)
Loads an icon. |
static javax.swing.JMenu |
loadMenu(ActionContext context,
java.lang.String name)
Creates a menu. |
static javax.swing.JMenu |
loadMenu(java.lang.String name)
Creates a menu. |
static javax.swing.JMenuBar |
loadMenuBar(ActionContext context,
java.lang.String name)
Creates a menubar. |
static javax.swing.JMenuBar |
loadMenuBar(java.lang.String name)
Creates a menubar. |
static javax.swing.JMenuItem |
loadMenuItem(ActionContext context,
java.lang.String name,
boolean setMnemonic)
Creates a menu item. |
static javax.swing.JMenuItem |
loadMenuItem(java.lang.String name)
Creates a menu item. |
static javax.swing.JMenuItem |
loadMenuItem(java.lang.String name,
boolean setMnemonic)
Creates a menu item. |
static javax.swing.JPopupMenu |
loadPopupMenu(ActionContext context,
java.lang.String name)
Creates a popup menu. |
static javax.swing.JPopupMenu |
loadPopupMenu(java.lang.String name)
Creates a popup menu. |
static SyntaxStyle[] |
loadStyles(java.lang.String family,
int size)
Loads the syntax styles from the properties, giving them the specified base font family and size. |
static SyntaxStyle[] |
loadStyles(java.lang.String family,
int size,
boolean color)
Loads the syntax styles from the properties, giving them the specified base font family and size. |
static javax.swing.Box |
loadToolBar(ActionContext context,
java.lang.String name)
Creates a toolbar. |
static javax.swing.Box |
loadToolBar(java.lang.String name)
Creates a toolbar. |
static EnhancedButton |
loadToolButton(ActionContext context,
java.lang.String name)
Loads a tool bar button. |
static EnhancedButton |
loadToolButton(java.lang.String name)
Loads a tool bar button. |
static void |
message(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args)
Displays a dialog box. |
static java.awt.Color |
parseColor(java.lang.String name)
Converts a color name to a color object. |
static java.awt.Color |
parseColor(java.lang.String name,
java.awt.Color defaultColor)
|
static SyntaxStyle |
parseStyle(java.lang.String str,
java.lang.String family,
int size)
Converts a style string to a style object. |
static SyntaxStyle |
parseStyle(java.lang.String str,
java.lang.String family,
int size,
boolean color)
Converts a style string to a style object. |
static java.lang.String |
prettifyMenuLabel(java.lang.String label)
`Prettifies' a menu item label by removing the `$' sign. |
static void |
requestFocus(java.awt.Window win,
java.awt.Component comp)
Focuses on the specified component as soon as the window becomes active. |
static void |
saveGeometry(java.awt.Window win,
java.lang.String name)
Saves a window's geometry to the properties. |
static void |
setIconPath(java.lang.String iconPath)
Sets the path where jEdit looks for icons. |
static void |
showPopupMenu(javax.swing.JPopupMenu popup,
java.awt.Component comp,
int x,
int y)
Shows the specified popup menu, ensuring it is displayed within the bounds of the screen. |
static void |
showPopupMenu(javax.swing.JPopupMenu popup,
java.awt.Component comp,
int x,
int y,
boolean point)
Shows the specified popup menu, ensuring it is displayed within the bounds of the screen. |
static java.lang.String[] |
showVFSFileDialog(View view,
java.lang.String path,
int type,
boolean multipleSelection)
Displays a VFS file selection dialog box. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static javax.swing.Icon NEW_BUFFER_ICON
GUIUtilities.loadIcon("new.gif");
instead.public static javax.swing.Icon DIRTY_BUFFER_ICON
GUIUtilities.loadIcon("dirty.gif");
instead.public static javax.swing.Icon READ_ONLY_BUFFER_ICON
GUIUtilities.loadIcon("readonly.gif");
instead.public static javax.swing.Icon NORMAL_BUFFER_ICON
GUIUtilities.loadIcon("normal.gif");
instead.public static javax.swing.Icon WINDOW_ICON
GUIUtilities.loadIcon("jedit-icon.gif");
instead.| Method Detail |
|---|
public static void setIconPath(java.lang.String iconPath)
public static javax.swing.Icon loadIcon(java.lang.String iconName)
iconName - The icon namepublic static java.awt.Image getEditorIcon()
public static java.awt.Image getPluginIcon()
public static javax.swing.JMenuBar loadMenuBar(java.lang.String name)
name - The menu bar name
public static javax.swing.JMenuBar loadMenuBar(ActionContext context,
java.lang.String name)
context - An action contextname - The menu bar namepublic static javax.swing.JMenu loadMenu(java.lang.String name)
name.label property. The menu contents is taken
from the name property, which is a whitespace
separated list of action names. An action name of -
inserts a separator in the menu.
name - The menu nameloadMenuItem(String)
public static javax.swing.JMenu loadMenu(ActionContext context,
java.lang.String name)
name.label property. The menu contents is taken
from the name property, which is a whitespace
separated list of action names. An action name of -
inserts a separator in the menu.
context - An action context; either
jEdit.getActionContext() or
VFSBrowser.getActionContext().name - The menu nameloadMenuItem(String)public static javax.swing.JPopupMenu loadPopupMenu(java.lang.String name)
name - The menu name
public static javax.swing.JPopupMenu loadPopupMenu(ActionContext context,
java.lang.String name)
context - An action context; either
jEdit.getActionContext() or
VFSBrowser.getActionContext().name - The menu namepublic static javax.swing.JMenuItem loadMenuItem(java.lang.String name)
name with label taken from the return value of the
EditAction.getLabel() method.
name - The menu item nameloadMenu(String)
public static javax.swing.JMenuItem loadMenuItem(java.lang.String name,
boolean setMnemonic)
name - The menu item namesetMnemonic - True if the menu item should have a mnemonic
public static javax.swing.JMenuItem loadMenuItem(ActionContext context,
java.lang.String name,
boolean setMnemonic)
context - An action context; either
jEdit.getActionContext() or
VFSBrowser.getActionContext().name - The menu item namesetMnemonic - True if the menu item should have a mnemonicpublic static javax.swing.Box loadToolBar(java.lang.String name)
name - The toolbar name
public static javax.swing.Box loadToolBar(ActionContext context,
java.lang.String name)
context - An action context; either
jEdit.getActionContext() or
VFSBrowser.getActionContext().name - The toolbar namepublic static EnhancedButton loadToolButton(java.lang.String name)
name.label and
name.shortcut properties and the icon is loaded
from the resource named '/org/gjt/sp/jedit/icons/' suffixed
with the value of the name.icon property.
name - The name of the button
public static EnhancedButton loadToolButton(ActionContext context,
java.lang.String name)
name.label and
name.shortcut properties and the icon is loaded
from the resource named '/org/gjt/sp/jedit/icons/' suffixed
with the value of the name.icon property.
context - An action context; either
jEdit.getActionContext() or
VFSBrowser.getActionContext().name - The name of the buttonpublic static java.lang.String prettifyMenuLabel(java.lang.String label)
public static void message(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args)
name.title property. The message is fetched
from the name.message property. The message
is formatted by the property manager with args as
positional parameters.
comp - The component to display the dialog forname - The name of the dialogargs - Positional parameters to be substituted into the
message text
public static void error(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args)
name.title property. The message is fetched
from the name.message property. The message
is formatted by the property manager with args as
positional parameters.
comp - The component to display the dialog forname - The name of the dialogargs - Positional parameters to be substituted into the
message text
public static java.lang.String input(java.awt.Component comp,
java.lang.String name,
java.lang.Object def)
name.title property. The message is fetched
from the name.message property.
comp - The component to display the dialog forname - The name of the dialogdef - The text to display by default in the input field
public static java.lang.String inputProperty(java.awt.Component comp,
java.lang.String name,
java.lang.String def)
name.title property. The message is fetched
from the name.message property.
comp - The component to display the dialog forname - The name of the dialogdef - The property whose text to display in the input field
public static java.lang.String input(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args,
java.lang.Object def)
name.title property. The message is fetched
from the name.message property.
comp - The component to display the dialog forname - The name of the dialogdef - The text to display by default in the input fieldargs - Positional parameters to be substituted into the
message text
public static java.lang.String inputProperty(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args,
java.lang.String def)
name.title property. The message is fetched
from the name.message property.
comp - The component to display the dialog forname - The name of the dialogargs - Positional parameters to be substituted into the
message textdef - The property whose text to display in the input field
public static int confirm(java.awt.Component comp,
java.lang.String name,
java.lang.Object[] args,
int buttons,
int type)
name.title property. The message is fetched
from the name.message property.
comp - The component to display the dialog forname - The name of the dialogargs - Positional parameters to be substituted into the
message textbuttons - The buttons to display - for example,
JOptionPane.YES_NO_CANCEL_OPTIONtype - The dialog type - for example,
JOptionPane.WARNING_MESSAGE
public static int listConfirm(java.awt.Component comp,
java.lang.String name,
java.lang.String[] args,
java.lang.Object[] listModel)
name.title property. The message is fetched
from the name.message property. The dialog
also shows a list of entries given by the listModel
parameter.
public static java.lang.String[] showVFSFileDialog(View view,
java.lang.String path,
int type,
boolean multipleSelection)
view - The view, should be non-nullpath - The initial directory to display. May be nulltype - The dialog type. One of
VFSBrowser.OPEN_DIALOG,
VFSBrowser.SAVE_DIALOG, or
VFSBrowser.CHOOSE_DIRECTORY_DIALOG.multipleSelection - True if multiple selection should be allowed
public static java.awt.Color parseColor(java.lang.String name)
java.awt.Color class) or a hex color value
prefixed with `#', for example `#ff0088'.
name - The color name
public static java.awt.Color parseColor(java.lang.String name,
java.awt.Color defaultColor)
public static java.lang.String getColorHexString(java.awt.Color c)
c - The color object
public static SyntaxStyle parseStyle(java.lang.String str,
java.lang.String family,
int size)
throws java.lang.IllegalArgumentException
str - The style stringfamily - Style strings only specify font style, not font familysize - Style strings only specify font style, not font family
java.lang.IllegalArgumentException - if the style is invalid
public static SyntaxStyle parseStyle(java.lang.String str,
java.lang.String family,
int size,
boolean color)
throws java.lang.IllegalArgumentException
str - The style stringfamily - Style strings only specify font style, not font familysize - Style strings only specify font style, not font familycolor - If false, the styles will be monochrome
java.lang.IllegalArgumentException - if the style is invalidpublic static java.lang.String getStyleString(SyntaxStyle style)
style - The style
public static SyntaxStyle[] loadStyles(java.lang.String family,
int size)
family - The font familysize - The font size
public static SyntaxStyle[] loadStyles(java.lang.String family,
int size,
boolean color)
family - The font familysize - The font sizecolor - If false, the styles will be monochrome
public static void loadGeometry(java.awt.Window win,
java.lang.String name)
name.x,
name.y, name.width and
name.height properties.
win - The windowname - The window namepublic static void adjustForScreenBounds(java.awt.Rectangle desired)
public static void saveGeometry(java.awt.Window win,
java.lang.String name)
name.x,
name.y, name.width and
name.height properties.
win - The windowname - The window namepublic static void centerOnScreen(java.awt.Window win)
JWindow.setLocationRelativeTo()
method.
public static void hideSplashScreen()
public static javax.swing.JComponent createMultilineLabel(java.lang.String str)
JLabels in
a JPanel.
str - The string, with lines delimited by newline
(\n) characters.
public static void requestFocus(java.awt.Window win,
java.awt.Component comp)
win - The windowcomp - The componentpublic static boolean isPopupTrigger(java.awt.event.MouseEvent evt)
evt - The eventpublic static boolean isMiddleButton(int modifiers)
modifiers - The modifiers flag from a mouse eventpublic static boolean isRightButton(int modifiers)
modifiers - The modifiers flag from a mouse event
public static void showPopupMenu(javax.swing.JPopupMenu popup,
java.awt.Component comp,
int x,
int y)
popup - The popup menucomp - The component to show it forx - The x co-ordinatey - The y co-ordinate
public static void showPopupMenu(javax.swing.JPopupMenu popup,
java.awt.Component comp,
int x,
int y,
boolean point)
popup - The popup menucomp - The component to show it forx - The x co-ordinatey - The y co-ordinatepoint - If true, then the popup originates from a single point;
otherwise it will originate from the component itself. This affects
positioning in the case where the popup does not fit onscreen.
public static boolean isAncestorOf(java.awt.Component comp1,
java.awt.Component comp2)
comp1 - The ancestorcomp2 - The component to checkpublic static javax.swing.JDialog getParentDialog(java.awt.Component c)
c - The component
public static java.awt.Component getComponentParent(java.awt.Component comp,
java.lang.Class clazz)
comp - The componentclazz - Looks for a parent with this class (exact match, not
derived).public static View getView(java.awt.Component comp)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||