Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-01-2007, 07:27 AM
Member
 
Join Date: Jul 2007
Posts: 40
barney is on a distinguished road
Error: javax.swing.AbstractButton cannot be applied to...
Hi, iv written a program which has a JtabbedPane GUI but the problem is on one of my tabs i have a JPanel called panel1. on panel1 i have a button called addButton now i add this button onto my panel and my panel onto the tab using the following code:
Code:
panel1.add(addButton); tabbedPane.addTab("New Booking", null, panel1, "First Panel");
which works just fine and when compiled you see the tabs and the button on the first pane.

but then when i try and ad an actionlistener to the button using the following code
Code:
addButton.addActionListener(this);
i get this error:
Code:
addActionListener(java.awt.event.ActionListener) in javax.swing.AbstractButton cannot be applied to (tester) tester is the name of my class.
Thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-01-2007, 08:10 AM
Senior Member
 
Join Date: Jul 2007
Posts: 1,266
hardwired is on a distinguished road
tester must implement ActionListener and have its only method implemented:
Code:
class tester implements ActionListener { ... public void actionPerformed(ActionEvent e) { } ... }
in order to be a proper ActionListener for addButton.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


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

vB 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
javax.comm:Error instantiating class com.sun.comm.Win32Driver bbq Advanced Java 3 02-07-2008 11:41 PM
javax.microedition.io/ javax.bluetooth ahtiven New To Java 0 01-20-2008 03:38 PM
Error: javax.servlet.ServletException: Column not found barney JavaServer Pages (JSP) and JSTL 1 08-07-2007 09:20 AM
Error: cannot be applied to (java.lang.String) carl New To Java 1 08-05-2007 08:33 AM
map javax.swing.text.Element to javax.swing.text.View elizabeth New To Java 1 07-30-2007 09:02 PM


All times are GMT +3. The time now is 02:19 PM.


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