Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-07-2007, 01:06 PM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default EventHandling code for Swing application
There are 2 event handlers in the following example. First handler handles button clicks and the other handles window closing.
Code:
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
numClicks++;
label.setText(labelPrefix + numClicks);
}
});
...
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code for making a java swing program a demo verson fakhruddin AWT / Swing 1 11-27-2007 09:54 PM
Memory Leak using a Swing Application Project iimasd AWT / Swing 0 11-27-2007 11:20 AM
jdbc/ swing code problem sami Advanced Java 1 08-13-2007 03:26 PM
swing application consumes much memory oregon AWT / Swing 1 08-05-2007 09:25 AM
Patterns to application with swing and hibernate Peter Database 2 07-04-2007 07:58 AM


All times are GMT +2. The time now is 03:01 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org