Results 21 to 27 of 27
- 04-18-2009, 03:29 AM #21
There might be a better way, but if it were me, I would create a method called initF1ActionMap() and add the action map to every component in your initComponent method...
I would skip JButtons, ButtonGroups and JLabels...
Java Code:optPane1 = new javax.swing.JOptionPane(); buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); txtMembership = new javax.swing.JTextField(); txtJdate = new javax.swing.JTextField(); txtAge = new javax.swing.JTextField(); txtGender = new javax.swing.JTextField(); cmdNew = new javax.swing.JButton(); cmdAdd = new javax.swing.JButton(); cmdSearch = new javax.swing.JButton(); cmdFirst = new javax.swing.JButton(); cmdHelp = new javax.swing.JButton(); cmdExit = new javax.swing.JButton(); cmdUpdate = new javax.swing.JButton(); cmdReset = new javax.swing.JButton(); JheightWeightPanel = new javax.swing.JPanel(); txtHeight = new javax.swing.JTextField(); txtConvHeight = new javax.swing.JTextField(); txtWeight = new javax.swing.JTextField(); txtConvWeight = new javax.swing.JTextField(); cmdConvert = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jRmetric = new javax.swing.JRadioButton(); jRimp = new javax.swing.JRadioButton(); jBmiPanel = new javax.swing.JPanel(); txtBmi = new javax.swing.JTextField(); txtResults = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); cmdCal = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); Limage = new javax.swing.JLabel();
But... A draw back to this answer is that every time you add a new component you will also have to update your intiF1actionMap()Who Cares... As Long As It Works...
-
good luck mark! myself, I'll take an SSCCE any day.
- 04-18-2009, 03:33 AM #23
LOL... I did enjoy the guidelines of SSCCE...
Who Cares... As Long As It Works...
- 04-18-2009, 04:03 AM #24
So just to clarify your saying that the section of code you have listed above is where I need to add the code, its just that this is system generated code and that I cannot add anything to it
- 04-18-2009, 08:04 AM #25
That does pose a problem...
Who Cares... As Long As It Works...
-
Nah, no problem. Loose the system generated code, learn Swing, problem solved. Not only will you have better overall control of your program, the information that you've learned in your studies will mean that you'll not have to ask questions here as often, but rather you'll be answering them. Good luck.
- 04-18-2009, 04:14 PM #27
Similar Threads
-
keyListener isn't working for me
By lost_in_java in forum AWT / SwingReplies: 7Last Post: 12-05-2008, 04:24 AM -
KeyListener Example
By Java Tip in forum SWTReplies: 0Last Post: 07-11-2008, 04:46 PM -
How to use KeyListener and ActionListener
By Java Tip in forum javax.swingReplies: 0Last Post: 04-23-2008, 08:19 PM -
how to add a KeyListener
By leonard in forum New To JavaReplies: 1Last Post: 08-06-2007, 04:44 PM -
Help with KeyListener in applet
By mathias in forum Java AppletsReplies: 1Last Post: 08-06-2007, 02:22 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks