Java Doc for GUIHelper.java in  » Database-Client » QueryForm » org » glasser » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » QueryForm » org.glasser.swing 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.glasser.swing.GUIHelper

GUIHelper
public class GUIHelper (Code)


Field Summary
static  intFORWARD_TRAVERSAL_KEYSBACKWARD_TRAVERSAL_KEYS
    
static  HashSetbackwardTraversalKeys
    
public static  StringdefaultMessageTitle
    
static  HashSetforwardTraversalKeys
    
static  booleanisJavaVersion_1_4_OrGreater
    
static  MethodsetFocusEnableMethod
    
static  MethodsetFocusTraversalMethod
    
static  Object[]shiftTabArgs
    
static  Object[]tabArgs
    


Method Summary
public static  voidbuildButtonPanel(JPanel buttonPanel, Object[][] buttonConfig, ActionListener listener)
    
public static  voidbuildFormPanel(JPanel panel, Object[][] fields, int fieldWidth, int vgap, Font labelFont, Color labelForeground, boolean stretchLastRow, int lastRowHeight)
     This method peforms the tedious chore of constructing a form panel consisting of JTextField objects, each with a corresponding JLabel to its left.
public static  JComponentbuildMenu(JComponent menu, Object[][] menuConfig, ActionListener listener, ChangeListener changeListener, ItemListener itemListener)
     Adds JMenuItems, separators and submenus to a JMenu or JPopup menu.
Parameters:
  menu - the menu to be configured.
public static  JComponentbuildMenu(JComponent menu, Object[][] menuConfig, ActionListener listener, ChangeListener changeListener, ItemListener itemListener, ResourceBundle bundle)
     Adds JMenuItems, separators and submenus to a JMenu or JPopup menu.
Parameters:
  menu - the menu to be configured.
public static  voidcenterWindowOnScreen(java.awt.Window w)
     Centers a window on the screen.
public static  voidconfigureToolbar(JToolBar toolBar, Object[][] toolBarConfig, String imageDir, Dimension buttonSize, ActionListener actionListener)
    
public static  voidenterPressesWhenFocused(JButton button)
     After a JButton has been passed to this method, it will be invoked by the ENTER key whenever it has the focus.
public static  voiderrMsg(Component parent, String msg, String title)
     Beeps and displays message box with error icon.
public static  voidexceptionMsg(Component parent, Exception ex)
     Displays info about an exception in a message box.
public static  voidexceptionMsg(Exception ex)
     Displays info about an exception in a message box.
public static  JMenuItemfindMenuItemByActionCommand(MenuElement menu, String command)
     Searches through a tree of menus and returns the JMenuItem that has the string "command" set as its ActionCommand.
public static  JMenuItemfindMenuItemByLabelText(MenuElement menu, String labelText)
     Searches through a tree of menus and returns the JMenuItem that has the string "labelText" set as its label text.
public static  ImageIcongetImageIconFromClasspath(String imageFilePath)
     Given the path, relative to the classpath, of an image file which is IN the classpath, this will return an ImageIcon constructed from the given image.
public static  JMenuItem[]getMenuItems(JMenu menu)
     This returns an array containing all of the JMenuItems from the given JMenu.
public static  JMenuItem[]getMenuItems(JPopupMenu menu)
     This returns an array containing all of the JMenuItems from the given JPopupMenu.
public static  JViewportgetViewport(Component c)
    
public static  voidinfoMsg(Component parent, String msg, String title)
     Beeps and displays message box with info icon.
public static  voidsetAllSizes(JComponent c, Dimension d)
    
public static  voidsetTabTraversal(JTextArea textArea)
     This method will modify the given JTextArea for Java versions 1.4.0 and above so that pressing the tab key will shift focus away from the JTextArea, rather than insert a tab character.
public static  intshowConfirmDialog(Component parent, Object msg, String title, int optionType)
    
public static  intshowConfirmDialog(Component parent, Object msg, String title, int optionType, int messageType)
    
public static  voidshowMessageDialog(Component parent, String msg, String title, int messageType)
     Beeps and displays message box with icon of given type.
public static  voidwarningMsg(Component parent, String msg, String title)
     Beeps and displays message box with a warning icon.

Field Detail
FORWARD_TRAVERSAL_KEYSBACKWARD_TRAVERSAL_KEYS
static int FORWARD_TRAVERSAL_KEYSBACKWARD_TRAVERSAL_KEYS(Code)



backwardTraversalKeys
static HashSet backwardTraversalKeys(Code)



defaultMessageTitle
public static String defaultMessageTitle(Code)



forwardTraversalKeys
static HashSet forwardTraversalKeys(Code)



isJavaVersion_1_4_OrGreater
static boolean isJavaVersion_1_4_OrGreater(Code)



setFocusEnableMethod
static Method setFocusEnableMethod(Code)



setFocusTraversalMethod
static Method setFocusTraversalMethod(Code)



shiftTabArgs
static Object[] shiftTabArgs(Code)



tabArgs
static Object[] tabArgs(Code)





Method Detail
buildButtonPanel
public static void buildButtonPanel(JPanel buttonPanel, Object[][] buttonConfig, ActionListener listener)(Code)
Configures and adds JButtons to a JPanel, which is assumed to have a FlowLayout (although other layout managers may work.)
Parameters:
  buttonPanel - the JPanel to which the JButtons will be added.
Parameters:
  buttonConfig - a two-dimensional Object array, where each outer elementis an array with the following elements:
  • A JButton to be added
  • A single-character String, which will be used to set the mnemonic for the button.
  • A String representing the ActionCommand that will be set for the button.
  • A String that will be set as the ToolTipText for the button

Parameters:
  An - ActionListener that will be passed to each JButton's addActionListener() method.



buildFormPanel
public static void buildFormPanel(JPanel panel, Object[][] fields, int fieldWidth, int vgap, Font labelFont, Color labelForeground, boolean stretchLastRow, int lastRowHeight)(Code)
This method peforms the tedious chore of constructing a form panel consisting of JTextField objects, each with a corresponding JLabel to its left. It uses a GridBagLayout to layout the components.
Parameters:
  panel - The JPanel to be laid out.
Parameters:
  fields - Each member array in this NxN array is of the form:
{<JTextField object>, <Label Text String>, [<Tooltip Text String>]}
The String containing the label text is used to construct a JLabelfor the JTextField. If the Tooltip Text String is present (it need not be)then it will be used as the tooltip text for both the JLabel and the JTextField.


Parameters:
  fieldWidth - if negative, this parameter is ignored, otherwise itis used as the ipadx value in the GridBagConstraints object for eachJTextField object. If the panel's width will not be determined by a layoutmanager or some other means, this parameter should be used.
Parameters:
  vgap - the vertical gap between label/textfield rows.
Parameters:
  labelFont - the Font that will be used for the JLabels. If null,the default font is used.
Parameters:
  labelForeground - the color that will be used for the foreground ofthe JLabels. If null, the default color is used.
Parameters:
  stretchLastRow - if true, the component in the last row will have it'sfill attribute set to "BOTH" so that it will stretch vertically as well ashorizontally.
Parameters:
  lastRowHeight - this is the amount used for ipady on the last row's component.if less than 1, then the component's preferred height will be used.




buildMenu
public static JComponent buildMenu(JComponent menu, Object[][] menuConfig, ActionListener listener, ChangeListener changeListener, ItemListener itemListener)(Code)
Adds JMenuItems, separators and submenus to a JMenu or JPopup menu.
Parameters:
  menu - the menu to be configured. If null, a JPopupMenu is intantiated and returned.
Parameters:
  menuConfig - a array of arrays containing the information needed to configurethe menu. Each element array is used to configure a JMenuItem that is added to themenu, or a submenu. An element array must have at least one element, and may haveup to four. These elements represent:
  • element 0:
  • (REQUIRED) The String used as the text for a menu item or a submenu. If it isis for a submenu, it should begin with an underscore (_), which will be stripped off. Optionally,this element may be the String "SEPARATOR", in which case a menu separator will be inserted.
  • element 1:
  • (REQUIRED, unless element 0 is "SEPARATOR") If this row is for a JMenuItem,then this element is a string that will be set as the "actionCommand" for that JMenuItem, soActionListeners can identify which menu item was selected. If this row is for a submenu, thenthis element is another Object[][] menuConfig array that will be used to configure thesubmenu.
  • element 2:
  • (OPTIONAL) a String, the first character of which will be set as themnemonic for the menu item of submenu.
  • element 3:
  • (OPTIONAL) a String which contains a message that is sent to the StatusMessageDisplay object(which typically would be a statusbar) if one was provided, any time the menu item is passed over by the mouse.

Parameters:
  listener - an ActionListener that will be added to each JMenuItem.
Parameters:
  statusDisplay - a StatusMessageDisplay object that will receive status messages from JMenuItemsthey're passed over in an open menu. This would typically be a status bar. If status messageelements are provided in any of the config array elements, this argument should be provided also.



buildMenu
public static JComponent buildMenu(JComponent menu, Object[][] menuConfig, ActionListener listener, ChangeListener changeListener, ItemListener itemListener, ResourceBundle bundle)(Code)
Adds JMenuItems, separators and submenus to a JMenu or JPopup menu.
Parameters:
  menu - the menu to be configured. If null, a JPopupMenu is intantiated and returned.
Parameters:
  menuConfig - a array of arrays containing the information needed to configurethe menu. Each element array is used to configure a JMenuItem that is added to themenu, or a submenu. An element array must have at least one element, and may haveup to four. These elements represent:
  • element 0:
  • (REQUIRED) The String used as the text for a menu item or a submenu. If it isis for a submenu, it should begin with an underscore (_), which will be stripped off. Optionally,this element may be the String "SEPARATOR", in which case a menu separator will be inserted.
  • element 1:
  • (REQUIRED, unless element 0 is "SEPARATOR") If this row is for a JMenuItem,then this element is a string that will be set as the "actionCommand" for that JMenuItem, soActionListeners can identify which menu item was selected. If this row is for a submenu, thenthis element is another Object[][] menuConfig array that will be used to configure thesubmenu.
  • element 2:
  • (OPTIONAL) a String, the first character of which will be set as themnemonic for the menu item of submenu.
  • element 3:
  • (OPTIONAL) a String which contains a message that is sent to the StatusMessageDisplay object(which typically would be a statusbar) if one was provided, any time the menu item is passed over by the mouse.

Parameters:
  listener - an ActionListener that will be added to each JMenuItem.
Parameters:
  statusDisplay - a StatusMessageDisplay object that will receive status messages from JMenuItemsthey're passed over in an open menu. This would typically be a status bar. If status messageelements are provided in any of the config array elements, this argument should be provided also.



centerWindowOnScreen
public static void centerWindowOnScreen(java.awt.Window w)(Code)
Centers a window on the screen. Should be used for top-level windows only. Does nothing if any needed information is missing, or if window is larger than the screen in either direction.



configureToolbar
public static void configureToolbar(JToolBar toolBar, Object[][] toolBarConfig, String imageDir, Dimension buttonSize, ActionListener actionListener)(Code)



enterPressesWhenFocused
public static void enterPressesWhenFocused(JButton button)(Code)
After a JButton has been passed to this method, it will be invoked by the ENTER key whenever it has the focus. This is not the default behavior for the Metal look-and-feel.



errMsg
public static void errMsg(Component parent, String msg, String title)(Code)
Beeps and displays message box with error icon.



exceptionMsg
public static void exceptionMsg(Component parent, Exception ex)(Code)
Displays info about an exception in a message box.



exceptionMsg
public static void exceptionMsg(Exception ex)(Code)
Displays info about an exception in a message box.



findMenuItemByActionCommand
public static JMenuItem findMenuItemByActionCommand(MenuElement menu, String command)(Code)
Searches through a tree of menus and returns the JMenuItem that has the string "command" set as its ActionCommand.



findMenuItemByLabelText
public static JMenuItem findMenuItemByLabelText(MenuElement menu, String labelText)(Code)
Searches through a tree of menus and returns the JMenuItem that has the string "labelText" set as its label text.



getImageIconFromClasspath
public static ImageIcon getImageIconFromClasspath(String imageFilePath)(Code)
Given the path, relative to the classpath, of an image file which is IN the classpath, this will return an ImageIcon constructed from the given image.



getMenuItems
public static JMenuItem[] getMenuItems(JMenu menu)(Code)
This returns an array containing all of the JMenuItems from the given JMenu. It does not recurse through submenus.



getMenuItems
public static JMenuItem[] getMenuItems(JPopupMenu menu)(Code)
This returns an array containing all of the JMenuItems from the given JPopupMenu. It does not recurse through submenus.



getViewport
public static JViewport getViewport(Component c)(Code)



infoMsg
public static void infoMsg(Component parent, String msg, String title)(Code)
Beeps and displays message box with info icon.



setAllSizes
public static void setAllSizes(JComponent c, Dimension d)(Code)



setTabTraversal
public static void setTabTraversal(JTextArea textArea)(Code)
This method will modify the given JTextArea for Java versions 1.4.0 and above so that pressing the tab key will shift focus away from the JTextArea, rather than insert a tab character. It uses reflection so that the code can be compiled and run with versions prior to 1.4.0. Before version 1.4.0, this affect could be achieved by overriding isManagingFocus() on the JTextArea to return false, however that no longer works.



showConfirmDialog
public static int showConfirmDialog(Component parent, Object msg, String title, int optionType)(Code)



showConfirmDialog
public static int showConfirmDialog(Component parent, Object msg, String title, int optionType, int messageType)(Code)



showMessageDialog
public static void showMessageDialog(Component parent, String msg, String title, int messageType)(Code)
Beeps and displays message box with icon of given type. messageType parameter may be JOptionPane.INFORMATION_MESSAGE, JOptionPane.WARNING_MESSAGE or JOptionPane.ERROR_MESSAGE.



warningMsg
public static void warningMsg(Component parent, String msg, String title)(Code)
Beeps and displays message box with a warning icon.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.