Results 1 to 3 of 3
Thread: A simple question
- 02-15-2012, 12:05 AM #1
Member
- Join Date
- Feb 2012
- Posts
- 8
- Rep Power
- 0
A simple question
Hi. I need someone to point me in the right direction. I have about 70+ lines of code under a button; I was wondering how can I make it so that the code is elsewhere, but when I press the button it calls that action(that way I don't have to repeat the code to other actions). Any examples/suggestions? Thanks.
Java Code:private void button1ActionPerformed(java.awt.event.ActionEvent evt) { xystr = textField1.toString(); XorY = xystr.charAt(0); angle = Double.parseDouble(textField2.getText()); xy = Double.parseDouble(textField3.getText().substring(3)); result.setText("Length = " + textField3.getText().substring(3) + " with "); if ("x".equals(textField1.getText())) { ...
- 02-15-2012, 12:43 AM #2
Re: A simple question
That's already a method that's being called from the ActionListener's actionPerformed(...)
Drop the visual designer that spewed out that code and learn to program a GUI yourself: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)
Moving this thread to AWT/Swing
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-15-2012, 01:54 AM #3
Member
- Join Date
- Feb 2012
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
A simple question
By chris.bos in forum New To JavaReplies: 11Last Post: 12-02-2011, 05:37 PM -
Simple Question
By new2oojava in forum New To JavaReplies: 1Last Post: 09-29-2011, 07:14 AM -
Please help. Simple question
By owencain in forum New To JavaReplies: 14Last Post: 06-16-2011, 01:07 AM -
very simple Question
By arsenal4ever_11 in forum NetBeansReplies: 2Last Post: 05-27-2010, 08:51 PM -
some simple question?
By jperson in forum New To JavaReplies: 4Last Post: 05-03-2010, 05:32 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks