|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ccl.swing.SwingUtil
Utility class for gui/swing stuff. Instead of creating and showing special dialogs yourself, this class provides some shortcut methods for this task.
Field Summary | |
static int |
CANCEL
Constant for yes, no, and cancel. |
static int |
NO
Constant for yes, no, and cancel. |
static int |
YES
Constant for yes, no, and cancel. |
Constructor Summary | |
SwingUtil()
|
Method Summary | |
static void |
centerComponent(java.awt.Component cmpObject)
|
static void |
centerComponent(java.awt.Component cmpObject_,
java.awt.Component cmpParent_,
int heightFraction_)
|
static CCLBorder |
createCCLBorder()
Instead of creating your own new CCLBorder object each time you want to use a CCLBorder, you can simply reuse the object returned by this method. |
static CCLButtonBorder |
createCCLButtonBorder()
Instead of creating your own new CCLButtonBorder object each time you want to use a CCLButtonBorder, you can simply reuse the object returned by this method. |
static void |
dispatchEnterKeyEvent(java.awt.Component pComponent_)
Send enter key event to component, espacially text component. |
static void |
dispatchKeyEvent(java.awt.Component pComponent_,
char c_)
Send characters interactively to components, espacially text components. |
static void |
dispatchKeyEvent(java.awt.Component pComponent_,
int virtualKey_)
Send pKeyEvent_ to component, espacially text component. |
static void |
doClick(javax.swing.JButton btnClick_)
Using this method you don't need to create an inner class yourself to invoke it later in awt thread. |
static java.awt.Component |
getComponent(java.awt.Container pContainer_,
java.lang.String sName_,
int n_)
For example: getComponent( pFrame, "name_text", 0 ); or: getComponent( pFrame, "javax.swing.JTextField", 2 ); |
static java.awt.Component |
getComponent(java.awt.Container pContainer_,
Testable pTestable_,
int n_)
|
static java.lang.String |
getContainerDump(java.awt.Container container)
Simliar to a stack trace a string containing the tree of awt components in the given container. |
static java.lang.String |
getDirName(java.awt.Frame frmParent_,
java.lang.String sTitle_,
java.lang.String sDirectory_)
This file choose selects peer class under windows, swing file chooser on other systems. |
static java.lang.String |
getFileName(java.awt.Frame frmParent_,
java.lang.String sTitle_,
java.lang.String sStartDirectory_)
|
static java.lang.String |
getFileName(java.awt.Frame frmParent_,
java.lang.String sTitle_,
java.lang.String[] asFileSuffixes_,
java.lang.String sDirectory_)
This file choose selects peer class under windows, swing file chooser on other systems. |
static java.lang.String |
getFileName(java.awt.Frame frmParent_,
java.lang.String sTitle_,
java.lang.String sFileName_,
java.lang.String sDirectory_)
(This file choose selects peer class under windows, swing file chooser on other systems. |
static java.lang.String |
getFileName(java.awt.Frame frmParent_,
java.lang.String sTitle_,
java.lang.String sFileName_,
java.lang.String sDirectory_,
java.lang.String sOKButtonText_)
|
static java.lang.String |
getFileOrDirName(java.awt.Frame frmParent_,
java.lang.String sTitle_,
java.lang.String sDirectory_)
|
static java.awt.Component |
getFirstComponent(java.awt.Container pContainer_,
java.lang.String sName_)
For example: getFirstComponent( pFrame, "name_text" ); or: getFirstComponent( pFrame, "javax.swing.JTextField" ); |
static javax.swing.MenuElement |
getMenuElement(javax.swing.MenuElement pMenuElement_,
java.lang.String[] asMenuName_)
|
static java.awt.Image |
getResourcesImage(java.lang.String sResourceImageName_)
|
static java.awt.Dimension |
getScreenSize()
|
static void |
getValue(Test pTest_)
Deprecated. Test hack. |
static java.lang.String |
inputCancel(java.awt.Frame frmParent_,
java.lang.String sPrint_)
|
static java.lang.String |
inputCancel(java.awt.Frame frmParent_,
java.lang.String sPrint_,
java.lang.String sInit_)
|
static java.util.Vector |
inputDoubleListCancel(java.awt.Frame frmParent_,
java.lang.String sPrint_,
java.util.Vector vsFirst_,
java.util.Vector vsSecond_,
boolean bMultiSelect_)
|
static java.util.Vector |
inputDoubleListCancel(java.awt.Frame frmParent_,
java.lang.String sPrint_,
java.util.Vector vsFirst_,
java.util.Vector vsSecond_,
boolean bMultiSelect_,
java.awt.Color clrListBackground_,
java.awt.Color clrListForeground_)
|
static java.lang.String |
inputListCancel(java.awt.Frame frmParent_,
java.lang.String sPrint_,
java.util.Vector vsItems_)
|
static void |
insertNodeToTree(javax.swing.tree.DefaultMutableTreeNode tnRoot_,
javax.swing.tree.DefaultMutableTreeNode tnChild_,
java.lang.String sPath_,
char cDelimiter_)
|
static void |
invokeAndWaitIfNecessary(java.lang.Runnable pRunnable_)
If not running in an AWT thread, then invoke later. |
static void |
invokeLaterIfNecessary(java.lang.Runnable pRunnable_)
If not running in an AWT thread, then invoke later. |
static boolean |
isFileSavable(java.awt.Frame frmParent_,
java.lang.String sSaveFile_)
|
static boolean |
isOKOrCancel(java.awt.Frame frmParent_,
java.lang.String sMessage_)
Opens a dialog and returns either true or false. |
static int |
lastIndexOf(javax.swing.text.Segment pSegment_,
int c_)
Like String.lastIndexOf() but working on Segment instead of String. |
static int |
lastIndexOf(javax.swing.text.Segment pSegment_,
int c_,
int fromIndex_)
Like String.lastIndexOf() but working on Segment instead of String. |
static java.awt.Image |
loadImage(java.lang.String sImageFileName_)
|
static java.awt.Dimension |
max(java.awt.Dimension dimA_,
java.awt.Dimension dimB_)
|
static void |
maximizeWindow(java.awt.Window pWindow_)
|
static void |
maximizeWindow(java.awt.Window window,
float percentage)
|
static void |
pressOKButton(java.awt.Window pWindow_)
Might return earlier than the action has finished. |
static void |
removeEnterBinding(javax.swing.JTextField pTextField_)
From sun's JTextField.java: [ccl 1998-1-8] Need this for default button in dialogs. |
static void |
setCCLButtonBorderOnTableHeader(javax.swing.JTable table,
java.awt.Font font)
Uses ccl button border for the given table's headers. |
static void |
setDefaultButton(java.awt.Component pComponent_,
javax.swing.JButton pButton_)
|
static void |
setInitialFocus(java.awt.Window pWindow_,
java.awt.Component pComponent_)
Sets the initial focus of a component when a window pops up. |
static void |
setList(javax.swing.JList pList_,
java.util.Vector vValues_)
|
static void |
setMainFrame(java.awt.Frame pFrame_)
Deprecated. Testing should not rely on this hack. |
static void |
showAboutDialog(MainJFrame pMainFrame_)
|
static void |
showMessage(java.awt.Frame frmParent_,
java.lang.String sMessages_)
Requests focus for frmParent_ afterwards. |
static java.util.Vector |
toVector(javax.swing.DefaultListModel pDefaultListModel_)
|
static void |
unregisterEnterAction(javax.swing.JButton pButton_)
A swing workaround. |
static int |
wannaSave(java.awt.Frame frmParent_)
Deprecated. Use ccl.swing.SwingUtil instead. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int YES
public static final int NO
public static final int CANCEL
Constructor Detail |
public SwingUtil()
Method Detail |
public static java.lang.String inputListCancel(java.awt.Frame frmParent_, java.lang.String sPrint_, java.util.Vector vsItems_)
public static java.util.Vector inputDoubleListCancel(java.awt.Frame frmParent_, java.lang.String sPrint_, java.util.Vector vsFirst_, java.util.Vector vsSecond_, boolean bMultiSelect_)
public static java.util.Vector inputDoubleListCancel(java.awt.Frame frmParent_, java.lang.String sPrint_, java.util.Vector vsFirst_, java.util.Vector vsSecond_, boolean bMultiSelect_, java.awt.Color clrListBackground_, java.awt.Color clrListForeground_)
public static java.awt.Image getResourcesImage(java.lang.String sResourceImageName_) throws java.util.MissingResourceException
java.util.MissingResourceException
public static void showMessage(java.awt.Frame frmParent_, java.lang.String sMessages_)
public static void setInitialFocus(java.awt.Window pWindow_, java.awt.Component pComponent_)
public static java.lang.String getFileName(java.awt.Frame frmParent_, java.lang.String sTitle_, java.lang.String[] asFileSuffixes_, java.lang.String sDirectory_)
asFileSuffixes_
- for example: { "jiml", "nr" }public static java.lang.String getFileName(java.awt.Frame frmParent_, java.lang.String sTitle_, java.lang.String sFileName_, java.lang.String sDirectory_)
sFileName_
- for example: *.projpublic static java.lang.String getFileName(java.awt.Frame frmParent_, java.lang.String sTitle_, java.lang.String sFileName_, java.lang.String sDirectory_, java.lang.String sOKButtonText_)
sFileName_
- for example: *.projpublic static java.lang.String getDirName(java.awt.Frame frmParent_, java.lang.String sTitle_, java.lang.String sDirectory_)
public static java.lang.String getFileOrDirName(java.awt.Frame frmParent_, java.lang.String sTitle_, java.lang.String sDirectory_)
public static java.lang.String getFileName(java.awt.Frame frmParent_, java.lang.String sTitle_, java.lang.String sStartDirectory_)
public static boolean isOKOrCancel(java.awt.Frame frmParent_, java.lang.String sMessage_)
public static void unregisterEnterAction(javax.swing.JButton pButton_)
public static void removeEnterBinding(javax.swing.JTextField pTextField_)
public static CCLBorder createCCLBorder()
public static CCLButtonBorder createCCLButtonBorder()
public static void setCCLButtonBorderOnTableHeader(javax.swing.JTable table, java.awt.Font font)
table
- the table to change the header borders on.
The table must have its columns already set.public static void invokeLaterIfNecessary(java.lang.Runnable pRunnable_)
public static void invokeAndWaitIfNecessary(java.lang.Runnable pRunnable_) throws java.lang.InterruptedException, java.lang.reflect.InvocationTargetException
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException
public static java.lang.String inputCancel(java.awt.Frame frmParent_, java.lang.String sPrint_, java.lang.String sInit_)
public static java.lang.String inputCancel(java.awt.Frame frmParent_, java.lang.String sPrint_)
public static void insertNodeToTree(javax.swing.tree.DefaultMutableTreeNode tnRoot_, javax.swing.tree.DefaultMutableTreeNode tnChild_, java.lang.String sPath_, char cDelimiter_)
sPath_
- String representation of the new child node.
For example "Notes/Ideas/Crazy". This will
Search for node Notes->Ideas and inserts the
new child assuming its string representation
is "Crazy".cDelimiter_
- '/' for example.public static java.util.Vector toVector(javax.swing.DefaultListModel pDefaultListModel_)
public static java.awt.Component getFirstComponent(java.awt.Container pContainer_, java.lang.String sName_)
public static java.lang.String getContainerDump(java.awt.Container container)
public static java.awt.Component getComponent(java.awt.Container pContainer_, java.lang.String sName_, int n_)
n_
- >= 0; the n-1st component of this type will be returned.public static java.awt.Component getComponent(java.awt.Container pContainer_, Testable pTestable_, int n_)
n_
- >= 0; the n-1st component of this type will be returned.public static void pressOKButton(java.awt.Window pWindow_)
public static javax.swing.MenuElement getMenuElement(javax.swing.MenuElement pMenuElement_, java.lang.String[] asMenuName_)
public static void dispatchKeyEvent(java.awt.Component pComponent_, char c_)
public static void dispatchKeyEvent(java.awt.Component pComponent_, int virtualKey_)
public static void dispatchEnterKeyEvent(java.awt.Component pComponent_)
public static void doClick(javax.swing.JButton btnClick_)
public static int lastIndexOf(javax.swing.text.Segment pSegment_, int c_)
public static int lastIndexOf(javax.swing.text.Segment pSegment_, int c_, int fromIndex_)
public static void showAboutDialog(MainJFrame pMainFrame_)
public static void setList(javax.swing.JList pList_, java.util.Vector vValues_)
pList_
- expects list with DefaultListModel.public static int wannaSave(java.awt.Frame frmParent_)
YesNoCancelDialog
public static java.awt.Dimension getScreenSize()
public static void maximizeWindow(java.awt.Window pWindow_)
public static void maximizeWindow(java.awt.Window window, float percentage)
public static void centerComponent(java.awt.Component cmpObject_, java.awt.Component cmpParent_, int heightFraction_)
public static void centerComponent(java.awt.Component cmpObject)
public static java.awt.Image loadImage(java.lang.String sImageFileName_)
public static void setMainFrame(java.awt.Frame pFrame_)
public static void getValue(Test pTest_)
public static java.awt.Dimension max(java.awt.Dimension dimA_, java.awt.Dimension dimB_)
public static void setDefaultButton(java.awt.Component pComponent_, javax.swing.JButton pButton_)
public static boolean isFileSavable(java.awt.Frame frmParent_, java.lang.String sSaveFile_)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |