|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gjt.sp.jedit.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 Icon |
DIRTY_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("dirty.gif");
instead. |
static Icon |
NEW_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("new.gif");
instead. |
static Icon |
NORMAL_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("normal.gif");
instead. |
static Icon |
READ_ONLY_BUFFER_ICON
Deprecated. Use GUIUtilities.loadIcon("readonly.gif");
instead. |
static Icon |
WINDOW_ICON
Deprecated. Use GUIUtilities.loadIcon("jedit-icon.gif");
instead. |
Method Summary | |
static void |
adjustForScreenBounds(Rectangle desired)
Gives a rectangle the specified bounds, ensuring it is within the screen bounds. |
static void |
centerOnScreen(Window win)
Centers the given window on the screen. |
static int |
confirm(Component comp,
String name,
Object[] args,
int buttons,
int type)
Displays a confirm dialog box and returns the button pushed by the user. |
static JComponent |
createMultilineLabel(String str)
Creates a component that displays a multiple line message. |
static void |
error(Component comp,
String name,
Object[] args)
Displays an error dialog box. |
static String |
getColorHexString(Color c)
Converts a color object to its hex value. |
static Component |
getComponentParent(Component comp,
Class clazz)
Finds a parent of the specified component. |
static Image |
getEditorIcon()
Returns the default editor window image. |
static int |
getExtendedState(Frame frame)
On Java 1.4, calls Frame.getExtendedState() . |
static JDialog |
getParentDialog(Component c)
Traverses the given component's parent tree looking for an instance of JDialog, and return it. |
static Image |
getPluginIcon()
Returns the default plugin window image. |
static String |
getStyleString(SyntaxStyle style)
Converts a style into it's string representation. |
static View |
getView(Component comp)
Finds the view parent of the specified component. |
static void |
hideSplashScreen()
Ensures that the splash screen is not visible. |
static String |
input(Component comp,
String name,
Object def)
Displays an input dialog box and returns any text the user entered. |
static String |
input(Component comp,
String name,
Object[] args,
Object def)
Displays an input dialog box and returns any text the user entered. |
static String |
inputProperty(Component comp,
String name,
Object[] args,
String def)
Displays an input dialog box and returns any text the user entered. |
static String |
inputProperty(Component comp,
String name,
String def)
Displays an input dialog box and returns any text the user entered. |
static boolean |
isAncestorOf(Component comp1,
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(MouseEvent evt)
Returns if the specified event is the popup trigger event. |
static boolean |
isRightButton(int modifiers)
|
static void |
loadGeometry(Window win,
String name)
Loads a windows's geometry from the properties. |
static Icon |
loadIcon(String iconName)
Loads an icon. |
static JMenu |
loadMenu(ActionContext context,
String name)
Creates a menu. |
static JMenu |
loadMenu(String name)
Creates a menu. |
static JMenuBar |
loadMenuBar(ActionContext context,
String name)
Creates a menubar. |
static JMenuBar |
loadMenuBar(String name)
Creates a menubar. |
static JMenuItem |
loadMenuItem(ActionContext context,
String name,
boolean setMnemonic)
Creates a menu item. |
static JMenuItem |
loadMenuItem(String name)
Creates a menu item. |
static JMenuItem |
loadMenuItem(String name,
boolean setMnemonic)
Creates a menu item. |
static JPopupMenu |
loadPopupMenu(ActionContext context,
String name)
Creates a popup menu. |
static JPopupMenu |
loadPopupMenu(String name)
Creates a popup menu. |
static SyntaxStyle[] |
loadStyles(String family,
int size)
Loads the syntax styles from the properties, giving them the specified base font family and size. |
static SyntaxStyle[] |
loadStyles(String family,
int size,
boolean color)
Loads the syntax styles from the properties, giving them the specified base font family and size. |
static Box |
loadToolBar(ActionContext context,
String name)
Creates a toolbar. |
static Box |
loadToolBar(String name)
Creates a toolbar. |
static EnhancedButton |
loadToolButton(ActionContext context,
String name)
Loads a tool bar button. |
static EnhancedButton |
loadToolButton(String name)
Loads a tool bar button. |
static void |
message(Component comp,
String name,
Object[] args)
Displays a dialog box. |
static Color |
parseColor(String name)
Converts a color name to a color object. |
static Color |
parseColor(String name,
Color defaultColor)
|
static SyntaxStyle |
parseStyle(String str,
String family,
int size)
Converts a style string to a style object. |
static SyntaxStyle |
parseStyle(String str,
String family,
int size,
boolean color)
Converts a style string to a style object. |
static String |
prettifyMenuLabel(String label)
`Prettifies' a menu item label by removing the `$' sign. |
static void |
requestFocus(Window win,
Component comp)
Focuses on the specified component as soon as the window becomes active. |
static void |
saveGeometry(Window win,
String name)
Saves a window's geometry to the properties. |
static void |
setExtendedState(Frame frame,
int extState)
On Java 1.4, calls Frame.setExtendedState() . |
static void |
setIconPath(String iconPath)
Sets the path where jEdit looks for icons. |
static void |
showPopupMenu(JPopupMenu popup,
Component comp,
int x,
int y)
Shows the specified popup menu, ensuring it is displayed within the bounds of the screen. |
static void |
showPopupMenu(JPopupMenu popup,
Component comp,
int x,
int y,
boolean point)
Shows the specified popup menu, ensuring it is displayed within the bounds of the screen. |
static String[] |
showVFSFileDialog(View view,
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 Icon NEW_BUFFER_ICON
GUIUtilities.loadIcon("new.gif");
instead.
public static Icon DIRTY_BUFFER_ICON
GUIUtilities.loadIcon("dirty.gif");
instead.
public static Icon READ_ONLY_BUFFER_ICON
GUIUtilities.loadIcon("readonly.gif");
instead.
public static Icon NORMAL_BUFFER_ICON
GUIUtilities.loadIcon("normal.gif");
instead.
public static Icon WINDOW_ICON
GUIUtilities.loadIcon("jedit-icon.gif");
instead.
Method Detail |
public static void setIconPath(String iconPath)
public static Icon loadIcon(String iconName)
iconName
- The icon namepublic static Image getEditorIcon()
public static Image getPluginIcon()
public static JMenuBar loadMenuBar(String name)
name
- The menu bar namepublic static JMenuBar loadMenuBar(ActionContext context, String name)
context
- An action contextname
- The menu bar namepublic static JMenu loadMenu(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 JMenu loadMenu(ActionContext context, 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 JPopupMenu loadPopupMenu(String name)
name
- The menu namepublic static JPopupMenu loadPopupMenu(ActionContext context, String name)
context
- An action context; either
jEdit.getActionContext()
or
VFSBrowser.getActionContext()
.name
- The menu namepublic static JMenuItem loadMenuItem(String name)
name
with label taken from the return value of the
EditAction.getLabel()
method.
name
- The menu item nameloadMenu(String)
public static JMenuItem loadMenuItem(String name, boolean setMnemonic)
name
- The menu item namesetMnemonic
- True if the menu item should have a mnemonicpublic static JMenuItem loadMenuItem(ActionContext context, 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 Box loadToolBar(String name)
name
- The toolbar namepublic static Box loadToolBar(ActionContext context, String name)
context
- An action context; either
jEdit.getActionContext()
or
VFSBrowser.getActionContext()
.name
- The toolbar namepublic static EnhancedButton loadToolButton(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 buttonpublic static EnhancedButton loadToolButton(ActionContext context, 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 String prettifyMenuLabel(String label)
public static void message(Component comp, String name, 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 textpublic static void error(Component comp, String name, 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 textpublic static String input(Component comp, String name, 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 fieldpublic static String inputProperty(Component comp, String name, 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 fieldpublic static String input(Component comp, String name, Object[] args, 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 textpublic static String inputProperty(Component comp, String name, Object[] args, 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 fieldpublic static int confirm(Component comp, String name, 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_MESSAGEpublic static String[] showVFSFileDialog(View view, 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 Color parseColor(String name)
java.awt.Color
class) or a hex color value
prefixed with `#', for example `#ff0088'.
name
- The color namepublic static Color parseColor(String name, Color defaultColor)
public static String getColorHexString(Color c)
c
- The color objectpublic static SyntaxStyle parseStyle(String str, String family, int size) throws IllegalArgumentException
str
- The style stringfamily
- Style strings only specify font style, not font familysize
- Style strings only specify font style, not font family
IllegalArgumentException
- if the style is invalidpublic static SyntaxStyle parseStyle(String str, String family, int size, boolean color) throws 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
IllegalArgumentException
- if the style is invalidpublic static String getStyleString(SyntaxStyle style)
style
- The stylepublic static SyntaxStyle[] loadStyles(String family, int size)
family
- The font familysize
- The font sizepublic static SyntaxStyle[] loadStyles(String family, int size, boolean color)
family
- The font familysize
- The font sizecolor
- If false, the styles will be monochromepublic static void loadGeometry(Window win, String name)
name.x
,
name.y
, name.width
and
name.height
properties.
win
- The windowname
- The window namepublic static void adjustForScreenBounds(Rectangle desired)
public static void saveGeometry(Window win, String name)
name.x
,
name.y
, name.width
and
name.height
properties.
win
- The windowname
- The window namepublic static int getExtendedState(Frame frame)
Frame.getExtendedState()
.
On Java 1.3, returns 0.
public static void setExtendedState(Frame frame, int extState)
Frame.setExtendedState()
.
On Java 1.3, does nothing.
public static void centerOnScreen(Window win)
JWindow.setLocationRelativeTo()
method.
public static void hideSplashScreen()
public static JComponent createMultilineLabel(String str)
JLabels
in
a JPanel
.
str
- The string, with lines delimited by newline
(\n
) characters.public static void requestFocus(Window win, Component comp)
win
- The windowcomp
- The componentpublic static boolean isPopupTrigger(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 eventpublic static void showPopupMenu(JPopupMenu popup, Component comp, int x, int y)
popup
- The popup menucomp
- The component to show it forx
- The x co-ordinatey
- The y co-ordinatepublic static void showPopupMenu(JPopupMenu popup, 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(Component comp1, Component comp2)
comp1
- The ancestorcomp2
- The component to checkpublic static JDialog getParentDialog(Component c)
c
- The componentpublic static Component getComponentParent(Component comp, Class clazz)
comp
- The componentclazz
- Looks for a parent with this class (exact match, not
derived).public static View getView(Component comp)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |