From: Jorg J. <jj...@us...> - 2005-12-05 02:36:17
|
Update of /cvsroot/compiere/client/Src/org/compiere/apps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23829/Src/org/compiere/apps Modified Files: AFocusTraversalPolicy.java AWindow.java APanel.java ALoginRes.java AMenu.java ALogin.java ConfirmPanel.java Added Files: AKeyboardFocusManager.java Log Message: --- NEW FILE: AKeyboardFocusManager.java --- /****************************************************************************** * The contents of this file are subject to the Compiere License Version 1.1 * ("License"); You may not use this file except in compliance with the License * You may obtain a copy of the License at http://www.compiere.org/license.html * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License. * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke * are Copyright (C) 1999-2005 Jorg Janke. * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. * Contributor(s): ______________________________________. *****************************************************************************/ package org.compiere.apps; import java.awt.*; /** * Apps Keyboard Focus Manager * * @author Jorg Janke * @version $Id: AKeyboardFocusManager.java,v 1.1 2005/12/05 02:36:08 jjanke Exp $ */ public class AKeyboardFocusManager extends DefaultKeyboardFocusManager { /** * Get default Keyboard Focus Mgr * @return focus manager */ public static AKeyboardFocusManager get() { if (s_kfm == null) s_kfm = new AKeyboardFocusManager(); return s_kfm; } // get /** Default Focus Manager */ private static AKeyboardFocusManager s_kfm = new AKeyboardFocusManager(); /** * Constructor */ public AKeyboardFocusManager () { super (); setDefaultFocusTraversalPolicy(AFocusTraversalPolicy.get()); } // AKeyboardFocusManager } // AKeyboardFocusManager Index: AFocusTraversalPolicy.java =================================================================== RCS file: /cvsroot/compiere/client/Src/org/compiere/apps/AFocusTraversalPolicy.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AFocusTraversalPolicy.java 14 Nov 2005 02:10:58 -0000 1.6 --- AFocusTraversalPolicy.java 5 Dec 2005 02:36:07 -0000 1.7 *************** *** 18,21 **** --- 18,22 ---- import org.compiere.swing.*; + /** * Compiere Application Focus Traversal Policy *************** *** 40,46 **** private static AFocusTraversalPolicy s_policy = new AFocusTraversalPolicy(); ! /*************************************************************************/ ! ! /** * Constructor */ --- 41,45 ---- private static AFocusTraversalPolicy s_policy = new AFocusTraversalPolicy(); ! /************************************************************************** * Constructor */ *************** *** 50,140 **** } // AFocusTraversalPolicy /** ! * Returns the first Component in the traversal cycle. This method is used ! * to determine the next Component to focus when traversal wraps in the ! * forward direction. ! * ! * @param focusCycleRoot the focus cycle root whose first Component is to ! * be returned ! * @return the first Component in the traversal cycle when focusCycleRoot ! * is the focus cycle root, or null if no suitable Component can be ! * found ! * @throws IllegalArgumentException if focusCycleRoot is null ! */ ! public Component getFirstComponent(Container focusCycleRoot) ! { ! Component c = super.getFirstComponent(focusCycleRoot); ! // info ("Root: ", focusCycleRoot); ! // info (" First: ", c); ! return c; ! } // getFirstComponent ! ! /** ! * Returns the Component that should receive the focus after aComponent. ! * focusCycleRoot must be a focus cycle root of aComponent. ! * <p> ! * By default, LayoutFocusTraversalPolicy implicitly transfers focus down- ! * cycle. That is, during normal focus traversal, the Component ! * traversed after a focus cycle root will be the focus-cycle-root's ! * default Component to focus. This behavior can be disabled using the ! * <code>setImplicitDownCycleTraversal</code> method. ! * ! * @param focusCycleRoot a focus cycle root of aComponent ! * @param aComponent a (possibly indirect) child of focusCycleRoot, or ! * focusCycleRoot itself ! * @return the Component that should receive the focus after aComponent, or ! * null if no suitable Component can be found ! * @throws IllegalArgumentException if focusCycleRoot is not a focus cycle ! * root of aComponent, or if either focusCycleRoot or aComponent is ! * null ! */ ! public Component getComponentAfter(Container focusCycleRoot, Component aComponent) ! { ! Component c = super.getComponentAfter(focusCycleRoot, aComponent); ! return c; ! } ! ! /** ! * Returns the Component that should receive the focus before aComponent. ! * focusCycleRoot must be a focus cycle root of aComponent. ! * <p> ! * By default, LayoutFocusTraversalPolicy implicitly transfers focus down- ! * cycle. That is, during normal focus traversal, the Component ! * traversed after a focus cycle root will be the focus-cycle-root's ! * default Component to focus. This behavior can be disabled using the ! * <code>setImplicitDownCycleTraversal</code> method. ! * ! * @param focusCycleRoot a focus cycle root of aComponent ! * @param aComponent a (possibly indirect) child of focusCycleRoot, or ! * focusCycleRoot itself ! * @return the Component that should receive the focus before aComponent, ! * or null if no suitable Component can be found ! * @throws IllegalArgumentException if focusCycleRoot is not a focus cycle ! * root of aComponent, or if either focusCycleRoot or aComponent is ! * null ! */ ! public Component getComponentBefore(Container focusCycleRoot, Component aComponent) ! { ! Component c = super.getComponentBefore(focusCycleRoot, aComponent); ! return c; ! } ! ! /** ! * Returns the last Component in the traversal cycle. This method is used ! * to determine the next Component to focus when traversal wraps in the ! * reverse direction. ! * ! * @param focusCycleRoot the focus cycle root whose last Component is to be ! * returned ! * @return the last Component in the traversal cycle when focusCycleRoot is ! * the focus cycle root, or null if no suitable Component can be ! * found ! * @throws IllegalArgumentException if focusCycleRoot is null */ ! public Component getLastComponent(Container focusCycleRoot) { ! Component c = super.getLastComponent(focusCycleRoot); return c; ! } /** --- 49,68 ---- } // AFocusTraversalPolicy + boolean m_default = false; + /** ! * Get Default Component ! * @param aContainer container ! * @return default or null */ ! public Component getDefaultComponent (Container aContainer) { ! // info ("Root: ", aContainer); ! m_default = true; ! Component c = super.getDefaultComponent (aContainer); ! // info (" Default: ", c); ! m_default = false; return c; ! } // getDefaultComponent /** *************** *** 186,189 **** --- 114,120 ---- if (!ed.isReadWrite()) return false; + if (m_default // get Default Focus + && ("AD_Client_ID".equals(aComponent.getName()) || "AD_Org_ID".equals(aComponent.getName()) )) + return false; } // Toolbar Buttons *************** *** 194,200 **** } // accept ! /*************************************************************************/ ! ! /** * Dump info * @param title --- 125,129 ---- } // accept ! /************************************************************************** * Dump info * @param title *************** *** 204,209 **** { System.out.print (title); ! System.out.print (c.getClass().getName()); ! System.out.println (" - " + c.getName()); } // info --- 133,143 ---- { System.out.print (title); ! if (c == null) ! System.out.println (" - null"); ! else ! { ! System.out.print (c.getClass().getName()); ! System.out.println (" - " + c.getName()); ! } } // info Index: AWindow.java =================================================================== RCS file: /cvsroot/compiere/client/Src/org/compiere/apps/AWindow.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AWindow.java 16 Sep 2005 00:48:35 -0000 1.30 --- AWindow.java 5 Dec 2005 02:36:07 -0000 1.31 *************** *** 17,23 **** --- 17,25 ---- import java.awt.event.*; import javax.swing.*; + import org.compiere.model.*; import org.compiere.plaf.*; import org.compiere.util.*; + import org.compiere.db.*; /** *************** *** 37,41 **** { super(); - // this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); CompiereColor.setBackground(this); --- 39,42 ---- *************** *** 103,107 **** public void setBusy (boolean busy) { ! if (busy == m_glassPane.isVisible()) return; log.config(getName() + " - " + busy); --- 104,109 ---- public void setBusy (boolean busy) { ! if (busy == m_glassPane.isVisible() ! || CConnection.get().isTerminalServer()) return; log.config(getName() + " - " + busy); Index: APanel.java =================================================================== RCS file: /cvsroot/compiere/client/Src/org/compiere/apps/APanel.java,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** APanel.java 2 Dec 2005 16:20:08 -0000 1.149 --- APanel.java 5 Dec 2005 02:36:07 -0000 1.150 *************** *** 582,590 **** tabName.append("</i>"); tabName.append ("</html>"); ! // window.addTab (tabName.toString(), mTab.getIcon(), tabElement, mTab.getDescription()); - // caused stateChanged for first tab - 3 seconds - window.setMnemonicAt (tab, KeyEvent.VK_1 + tab); // 1,2,3,.. } } // Tab Loop --- 582,588 ---- tabName.append("</i>"); tabName.append ("</html>"); ! // Add Tab - sets ALT-<number> and Shift-ALT-<x> window.addTab (tabName.toString(), mTab.getIcon(), tabElement, mTab.getDescription()); } } // Tab Loop *************** *** 862,865 **** --- 860,864 ---- this.setCursor(Cursor.getDefaultCursor()); frame.setCursor(Cursor.getDefaultCursor()); + m_curGC.requestFocus(); // if (statusBar.getStatusLine().equals(processing)) // statusBar.setStatusLine(""); Index: ALoginRes.java =================================================================== RCS file: /cvsroot/compiere/client/Src/org/compiere/apps/ALoginRes.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ALoginRes.java 11 Mar 2005 20:28:21 -0000 1.8 --- ALoginRes.java 5 Dec 2005 02:36:07 -0000 1.9 *************** *** 30,51 **** { "Defaults", "Defaults" }, { "Login", "Compiere Login" }, ! { "File", "File" }, { "Exit", "Exit" }, ! { "Help", "Help" }, { "About", "About" }, ! { "Host", "Host" }, { "Database", "Database" }, ! { "User", "User ID" }, { "EnterUser", "Enter Application User ID" }, ! { "Password", "Password" }, { "EnterPassword", "Enter Application Password" }, ! { "Language", "Language" }, { "SelectLanguage", "Select your language" }, ! { "Role", "Role" }, ! { "Client", "Client" }, ! { "Organization", "Organization" }, ! { "Date", "Date" }, ! { "Warehouse", "Warehouse" }, ! { "Printer", "Printer" }, { "Connected", "Connected" }, { "NotConnected", "Not Connected" }, --- 30,51 ---- { "Defaults", "Defaults" }, { "Login", "Compiere Login" }, ! { "File", "&File" }, { "Exit", "Exit" }, ! { "Help", "&Help" }, { "About", "About" }, ! { "Host", "&Server" }, { "Database", "Database" }, ! { "User", "&User ID" }, { "EnterUser", "Enter Application User ID" }, ! { "Password", "&Password" }, { "EnterPassword", "Enter Application Password" }, ! { "Language", "&Language" }, { "SelectLanguage", "Select your language" }, ! { "Role", "&Role" }, ! { "Client", "&Client" }, ! { "Organization", "&Organization" }, ! { "Date", "&Date" }, ! { "Warehouse", "&Warehouse" }, ! { "Printer", "Prin&ter" }, { "Connected", "Connected" }, { "NotConnected", "Not Connected" }, *************** *** 54,62 **** { "RoleNotFound", "Role not found/complete" }, { "Authorized", "Authorized" }, ! { "Ok", "Ok" }, ! { "Cancel", "Cancel" }, { "VersionConflict", "Version Conflict:" }, { "VersionInfo", "Server <> Client" }, ! { "PleaseUpgrade", "Please run the update program" } }; --- 54,62 ---- { "RoleNotFound", "Role not found/complete" }, { "Authorized", "Authorized" }, ! { "Ok", "&Ok" }, ! { "Cancel", "&Cancel" }, { "VersionConflict", "Version Conflict:" }, { "VersionInfo", "Server <> Client" }, ! { "PleaseUpgrade", "Please download new Version from Server" } }; Index: AMenu.java =================================================================== RCS file: /cvsroot/compiere/client/Src/org/compiere/apps/AMenu.java,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** AMenu.java 1 Dec 2005 01:55:37 -0000 1.98 --- AMenu.java 5 Dec 2005 02:36:07 -0000 1.99 *************** *** 23,28 **** import java.util.logging.*; import javax.swing.*; - import javax.swing.FocusManager; import javax.swing.event.*; import org.compiere.*; import org.compiere.apps.wf.*; --- 23,28 ---- import java.util.logging.*; import javax.swing.*; import javax.swing.event.*; + // import org.compiere.*; import org.compiere.apps.wf.*; *************** *** 140,145 **** // Focus Traversal ! FocusManager.getCurrentManager().setDefaultFocusTraversalPolicy(AFocusTraversalPolicy.get()); ! this.setFocusTraversalPolicy(AFocusTraversalPolicy.get()); /** --- 140,146 ---- // Focus Traversal ! KeyboardFocusManager.setCurrentKeyboardFocusManager(AKeyboardFocusManager.get()); ! // FocusManager.getCurrentManager().setDefaultFocusTraversalPolicy(AFocusTraversalPolicy.get()); ! // this.setFocusTraversalPolicy(AFocusTraversalPolicy.get()); /** *************** *** 157,160 **** --- 158,162 ---- catch (Exception ex) { + log.severe(ex.toString()); } if (!login.isConnected() || !login.isOKpressed()) *************** *** 221,225 **** infoLayout.setHgap(4); infoLayout.setVgap(0); ! bNotes.setRequestFocusEnabled(false); bNotes.setToolTipText(""); bNotes.setActionCommand("Notes"); --- 223,227 ---- infoLayout.setHgap(4); infoLayout.setVgap(0); ! // bNotes.setRequestFocusEnabled(false); bNotes.setToolTipText(""); bNotes.setActionCommand("Notes"); *************** *** 227,231 **** bNotes.setIcon(Env.getImageIcon("GetMail24.gif")); bNotes.setMargin(new Insets(0, 0, 0, 0)); ! bTasks.setRequestFocusEnabled(false); bTasks.setActionCommand("Tasks"); bTasks.addActionListener(this); --- 229,233 ---- bNotes.setIcon(Env.getImageIcon("GetMail24.gif")); bNotes.setMargin(new Insets(0, 0, 0, 0)); ! // bTasks.setRequestFocusEnabled(false); bTasks.setActionCommand("Tasks"); bTasks.addActionListener(this); *************** *** 546,549 **** --- 548,552 ---- + "," + CConnection.get().getStatus() ); + MSystem.get(m_ctx).info(); } // updateInfo Index: ALogin.java =================================================================== RCS file: /cvsroot/compiere/client/Src/org/compiere/apps/ALogin.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** ALogin.java 25 Nov 2005 21:57:38 -0000 1.70 --- ALogin.java 5 Dec 2005 02:36:07 -0000 1.71 *************** *** 59,64 **** log.severe(e.toString()); } ! // Focus ! this.setFocusTraversalPolicy(AFocusTraversalPolicy.get()); this.getRootPane().setDefaultButton(confirmPanel.getOKButton()); parent.setIconImage(Compiere.getImage16()); --- 59,63 ---- log.severe(e.toString()); } ! // Focus to OK this.getRootPane().setDefaultButton(confirmPanel.getOKButton()); parent.setIconImage(Compiere.getImage16()); *************** *** 78,82 **** private CConnectionEditor hostField = new CConnectionEditor(); private CLabel userLabel = new CLabel(); ! private JTextField userTextField = new JTextField(); private CLabel passwordLabel = new CLabel(); private JPasswordField passwordField = new JPasswordField(); --- 77,81 ---- private CConnectionEditor hostField = new CConnectionEditor(); private CLabel userLabel = new CLabel(); ! private CTextField userTextField = new CTextField(); private CLabel passwordLabel = new CLabel(); private JPasswordField passwordField = new JPasswordField(); Index: ConfirmPanel.java =================================================================== RCS file: /cvsroot/compiere/client/Src/org/compiere/apps/ConfirmPanel.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ConfirmPanel.java 1 Dec 2005 01:55:37 -0000 1.24 --- ConfirmPanel.java 5 Dec 2005 02:36:08 -0000 1.25 *************** *** 137,146 **** * @param toolTipText tool tip text * @param icon icon - * @param mnemonic mnemonic * @return JButton */ ! public DialogButton addButton (String action, String toolTipText, Icon icon, int mnemonic) { ! DialogButton b = new DialogButton (action, toolTipText, icon, mnemonic); addComponent (b); return b; --- 137,145 ---- * @param toolTipText tool tip text * @param icon icon * @return JButton */ ! public DialogButton addButton (String action, String toolTipText, Icon icon) { ! DialogButton b = new DialogButton (action, toolTipText, icon); addComponent (b); return b; *************** *** 194,198 **** /** ! * Create OK Button with label text * @param text text * @return OK Button --- 193,197 ---- /** ! * Create OK Button with label text and F4 Shortcut * @param text text * @return OK Button *************** *** 200,205 **** public static final DialogButton createOKButton (String text) { ! DialogButton okButton = new DialogButton (A_OK, text, Env.getImageIcon("Ok24.gif"), KeyEvent.VK_O); okButton.setDefaultCapable(true); return okButton; } // createOKButton --- 199,209 ---- public static final DialogButton createOKButton (String text) { ! DialogButton okButton = new DialogButton (A_OK, text, ! Env.getImageIcon("Ok24.gif")); okButton.setDefaultCapable(true); + // F4 + okButton.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) + .put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0), A_OK); + okButton.getActionMap().put(A_OK, okButton.getAction()); return okButton; } // createOKButton *************** *** 228,232 **** /** ! * Create Cancel Button wlth label text and register ESC and Alt-X as KeyStroke * @param text text * @return Cancel Button --- 232,236 ---- /** ! * Create Cancel Button wlth label text and register ESC as KeyStroke * @param text text * @return Cancel Button *************** *** 234,240 **** public static final DialogButton createCancelButton (String text) { ! DialogButton cancel = new DialogButton (A_CANCEL, text, Env.getImageIcon("Cancel24.gif"), KeyEvent.VK_X); // ESC = Ignore ! cancel.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), A_CANCEL); cancel.getActionMap().put(A_CANCEL, cancel.getAction()); return cancel; --- 238,246 ---- public static final DialogButton createCancelButton (String text) { ! DialogButton cancel = new DialogButton (A_CANCEL, text, ! Env.getImageIcon("Cancel24.gif")); // ESC = Ignore ! cancel.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) ! .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), A_CANCEL); cancel.getActionMap().put(A_CANCEL, cancel.getAction()); return cancel; *************** *** 309,315 **** public static final DialogButton createRefreshButton (String text) { ! DialogButton refresh = new DialogButton (A_REFRESH, text, Env.getImageIcon("Refresh24.gif"), 0); // F5 = Refresh ! refresh.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), A_REFRESH); refresh.getActionMap().put(A_REFRESH, refresh.getAction()); return refresh; --- 315,323 ---- public static final DialogButton createRefreshButton (String text) { ! DialogButton refresh = new DialogButton (A_REFRESH, text, ! Env.getImageIcon("Refresh24.gif")); // F5 = Refresh ! refresh.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) ! .put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), A_REFRESH); refresh.getActionMap().put(A_REFRESH, refresh.getAction()); return refresh; *************** *** 345,349 **** public static final DialogButton createResetButton (String text) { ! return new DialogButton (A_RESET, text, Env.getImageIcon("Reset24.gif"), 0); } // createResetButton --- 353,358 ---- public static final DialogButton createResetButton (String text) { ! return new DialogButton (A_RESET, text, ! Env.getImageIcon("Reset24.gif")); } // createResetButton *************** *** 377,381 **** public static final DialogButton createCustomizeButton (String text) { ! return new DialogButton (A_CUSTOMIZE, text, Env.getImageIcon("Preference24.gif"), 0); } // createCustomizeButton --- 386,391 ---- public static final DialogButton createCustomizeButton (String text) { ! return new DialogButton (A_CUSTOMIZE, text, ! Env.getImageIcon("Preference24.gif")); } // createCustomizeButton *************** *** 409,415 **** public static final DialogButton createHistoryButton (String text) { ! DialogButton history = new DialogButton (A_HISTORY, text, Env.getImageIcon("HistoryX24.gif"), 0); // F9 = History ! history.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0), A_HISTORY); history.getActionMap().put(A_HISTORY, history.getAction()); return history; --- 419,427 ---- public static final DialogButton createHistoryButton (String text) { ! DialogButton history = new DialogButton (A_HISTORY, text, ! Env.getImageIcon("HistoryX24.gif")); // F9 = History ! history.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) ! .put(KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0), A_HISTORY); history.getActionMap().put(A_HISTORY, history.getAction()); return history; *************** *** 445,449 **** public static final DialogButton createZoomButton (String text) { ! return new DialogButton (A_ZOOM, text, Env.getImageIcon("Zoom24.gif"), KeyEvent.VK_Z); } // createZoomButton --- 457,462 ---- public static final DialogButton createZoomButton (String text) { ! return new DialogButton (A_ZOOM, text, ! Env.getImageIcon("Zoom24.gif")); } // createZoomButton *************** *** 477,481 **** public static final DialogButton createProcessButton (String text) { ! return new DialogButton (A_PROCESS, text, Env.getImageIcon("Process24.gif"), 0); } // createProcessButton --- 490,495 ---- public static final DialogButton createProcessButton (String text) { ! return new DialogButton (A_PROCESS, text, ! Env.getImageIcon("Process24.gif")); } // createProcessButton *************** *** 500,504 **** public static final DialogButton createPrintButton (String text) { ! return new DialogButton (A_PRINT, text, Env.getImageIcon("Print24.gif"), KeyEvent.VK_P); } // createPrintButton --- 514,524 ---- public static final DialogButton createPrintButton (String text) { ! DialogButton button = new DialogButton (A_PRINT, text, ! Env.getImageIcon("Print24.gif")); ! // F12 ! button.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) ! .put(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0), A_HELP); ! button.getActionMap().put(A_HELP, button.getAction()); ! return button; } // createPrintButton *************** *** 523,529 **** public static final DialogButton createHelpButton (String text) { ! DialogButton help = new DialogButton (A_HELP, text, Env.getImageIcon("Help24.gif"), KeyEvent.VK_H); // F1 = Help ! help.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), A_HELP); help.getActionMap().put(A_HELP, help.getAction()); return help; --- 543,551 ---- public static final DialogButton createHelpButton (String text) { ! DialogButton help = new DialogButton (A_HELP, text, ! Env.getImageIcon("Help24.gif")); // F1 = Help ! help.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) ! .put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), A_HELP); help.getActionMap().put(A_HELP, help.getAction()); return help; *************** *** 550,554 **** public static final DialogButton createExportButton (String text) { ! return new DialogButton (A_EXPORT, text, Env.getImageIcon("Export24.gif"), 0); } // createExportButton --- 572,577 ---- public static final DialogButton createExportButton (String text) { ! return new DialogButton (A_EXPORT, text, ! Env.getImageIcon("Export24.gif")); } // createExportButton *************** *** 573,578 **** public static final DialogButton createDeleteButton (String text) { ! DialogButton dButton = new DialogButton (A_DELETE, text, Env.getImageIcon("Delete24.gif"), KeyEvent.VK_O); ! return dButton; } // createDeleteButton --- 596,606 ---- public static final DialogButton createDeleteButton (String text) { ! DialogButton button = new DialogButton (A_DELETE, text, ! Env.getImageIcon("Delete24.gif")); ! // F3 ! button.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) ! .put(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0), A_HELP); ! button.getActionMap().put(A_HELP, button.getAction()); ! return button; } // createDeleteButton *************** *** 609,613 **** public static final DialogButton createPAttributeButton (String text) { ! DialogButton button = new DialogButton (A_PATTRIBUTE, text, Env.getImageIcon("PAttribute24.gif"), 0); return button; } // createPAttributeButton --- 637,642 ---- public static final DialogButton createPAttributeButton (String text) { ! DialogButton button = new DialogButton (A_PATTRIBUTE, text, ! Env.getImageIcon("PAttribute24.gif")); return button; } // createPAttributeButton *************** *** 633,637 **** public static final DialogButton createNewButton (String text) { ! DialogButton button = new DialogButton (A_NEW, text, Env.getImageIcon("New24.gif"), 0); return button; } // createNewButton --- 662,671 ---- public static final DialogButton createNewButton (String text) { ! DialogButton button = new DialogButton (A_NEW, text, ! Env.getImageIcon("New24.gif")); ! // F2 ! button.getInputMap(CButton.WHEN_IN_FOCUSED_WINDOW) ! .put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), A_HELP); ! button.getActionMap().put(A_HELP, button.getAction()); return button; } // createNewButton *************** *** 705,713 **** * @param toolTipText toole tip text * @param icon icon - * @param mnemonic mnemonic */ ! public DialogButton (String action, String toolTipText, Icon icon, int mnemonic) { ! super (new DialogAction (action, toolTipText, icon, mnemonic)); super.setMargin(s_insets); super.setDefaultCapable(false); --- 739,746 ---- * @param toolTipText toole tip text * @param icon icon */ ! public DialogButton (String action, String toolTipText, Icon icon) { ! super (new DialogAction (action, toolTipText, icon)); super.setMargin(s_insets); super.setDefaultCapable(false); *************** *** 754,762 **** * @param toolTipText tool tip text * @param icon icon - * @param mnemonic mnemonic */ ! public DialogAction (String action, String toolTipText, Icon icon, int mnemonic) { super (); // Attributes // putValue(Action.NAME, text); // Display --- 787,806 ---- * @param toolTipText tool tip text * @param icon icon */ ! public DialogAction (String action, String toolTipText, Icon icon) { super (); + int pos = -1; + if (toolTipText != null) + pos = toolTipText.indexOf("&"); + if (pos != -1) // We have a nemonic - creates ALT-_ + { + char mnemonic = toolTipText.toUpperCase().charAt(pos+1); + if (mnemonic != ' ') + { + toolTipText = toolTipText.substring(0, pos) + toolTipText.substring(pos+1); + putValue(Action.MNEMONIC_KEY, new Integer(mnemonic)); + } + } // Attributes // putValue(Action.NAME, text); // Display *************** *** 764,769 **** putValue(Action.SHORT_DESCRIPTION, toolTipText); // Tooltip putValue(Action.ACTION_COMMAND_KEY, action); - if (mnemonic != 0) - putValue(Action.MNEMONIC_KEY, new Integer(mnemonic)); } // DialogAction --- 808,811 ---- |