|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jsxe.gui.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)
Method Summary | |
static void |
adjustForScreenBounds(Rectangle desired)
Gives a rectangle the specified bounds, ensuring it is within the screen bounds. |
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 JDialog |
getParentDialog(Component c)
Traverses the given component's parent tree looking for an instance of JDialog, and return it. |
static TabbedView |
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 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 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 |
setIconPath(String iconPath)
Sets the path where jsXe 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void setIconPath(String iconPath)
public static Icon loadIcon(String iconName)
iconName
- The icon namepublic 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 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 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 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 TabbedView getView(Component comp)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |