Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
JButton Problem ?
Vince Vinci
Greenhorn
Posts: 2
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
package Panel; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.sql.*; import java.text.*; public class RestaurantPlan extends JPanel implements ActionListener { PreparedStatement pstmtSubmit; static String[] seat = {"1","2","3","4","5","6","7","8","9","10"}; JLabel jlbCashier = new JLabel("Cashier"); JLabel jlbRestroom = new JLabel("Female"); JLabel jlbRestroom2 = new JLabel("Male"); JLabel jlbMainDoor = new JLabel("Main Door"); JLabel jlbTitle = new JLabel("Reservation Details"); JLabel jlbDate = new JLabel("Date: "); JLabel jlbTime = new JLabel("Time: "); JLabel jlbSeat = new JLabel("Seat: "); JLabel jlbName = new JLabel("Name: "); JLabel jlbID = new JLabel("Cust. ID: "); JLabel jlbBigTable = new JLabel("Table for 10"); JLabel jlbMedTable = new JLabel("Table for 4"); JLabel jlbSmallTable = new JLabel("Table for 2"); JLabel jlbNA = new JLabel("Not Available"); JLabel jlbStar = new JLabel("*"); JLabel jlbNote = new JLabel("* = required field"); JLabel jlbBtm = new JLabel("For reservation more than 3 tables or more than 20 peoples, please call for staff or call 03-41450123"); static JTextField jtfDate = new JTextField(); static JTextField jtfTime = new JTextField(); static JTextField jtfName = new JTextField(); static JTextField jtfID = new JTextField(); JSeparator jsBtm = new JSeparator(JSeparator.HORIZONTAL); JSeparator jsSouth = new JSeparator(JSeparator.HORIZONTAL); JSeparator jsEast = new JSeparator(JSeparator.VERTICAL); static JButton jbtTable01 = new JButton("Table 1"); static JButton jbtTable2 = new JButton("Table 2"); static JButton jbtTable3 = new JButton("Table 3"); static JButton jbtTable4 = new JButton("Table 4"); static JButton jbtTable5 = new JButton("Table 5"); static JButton jbtTable6 = new JButton("Table 6"); static JButton jbtTable7 = new JButton("Table 7"); static JButton jbtTable8 = new JButton("Table 8"); static JButton jbtTable9 = new JButton("Table 9"); static JButton jbtTable10 = new JButton("Table 10"); static JButton jbtTable11 = new JButton("Table 11"); static JButton jbtTable12 = new JButton("Table 12"); static JButton jbtTable13 = new JButton("Table 13"); static JButton jbtTable14 = new JButton("Table 14"); static JButton jbtTable15 = new JButton("Table 15"); static JComboBox jcbSeat = new JComboBox(seat); JButton jbtBigTable = new JButton(); JButton jbtMedTable = new JButton(); JButton jbtSmallTable = new JButton(); JButton jbtNA = new JButton(); JButton jbtClose = new JButton("Close Window"); public RestaurantPlan(){ setLayout(null); //Some Other Code...i guess is not related. add(jbtTable9);add(jbtTable8);add(jbtTable7); add(jbtTable6);add(jbtTable5);add(jbtTable4); add(jbtTable3);add(jbtTable2);add(jbtTable01); add(jlbCashier); add(jlbRestroom); add(jlbRestroom2); add(jbtClose); jbtTable01.addActionListener(this); jbtClose.addActionListener( this); public void actionPerformed(ActionEvent e) { if(e.getSource()==jbtTable01){ System.out.println("AAAAAAAAAAAAA"); } if(e.getSource()==jbtClose){ System.out.println("ABC"); } } }
When i try open this frame for second time and click on jbtTable01, it will show the message twice, while on jbtClose, it will only show once...
what should be the problem? anyone could help me?
Michael Dunn
Ranch Hand
Posts: 4632
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
was the problem resolved here?
http://forums.sun.com/thread.jspa?threadID=5376633&tstart=0
Vince Vinci
Greenhorn
Posts: 2
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
yes! it get resolved! thanks!
Rob Spoor
Sheriff
Posts: 22783
131
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Next time, please
Be Forthright When Cross Posting To Other Sites
.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
He does not suffer fools gladly. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
what i have done
listeners2
enabling & disabling menuitems
what i have done
Referencing swing components from ActionEvent
More...