This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes [newbie] The constructor <Class>(String, ImageIcon) is undefined Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "[newbie] The constructor <Class>(String, ImageIcon) is undefined" Watch "[newbie] The constructor <Class>(String, ImageIcon) is undefined" New topic
Author

[newbie] The constructor <Class>(String, ImageIcon) is undefined

Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 659

Well this is what I see:



Full listing:






Jon
Sunil Kumar
Ranch Hand

Joined: Apr 24, 2007
Posts: 76
Any stack trace.. line number of error?? anything... Provide some info.
From what i see, you are trying to instantiate ColorAction using (String, ImageIcon) as parameters while your constructor needs 3 (String, Icon, Color)
If ImageIcon is a subclass of Icon, you can still instantiate using (String, ImageIcon, Color). Main point to note is.. the number of arguments should be correct


Sunil Kumar
http://goodtoknowit.blogspot.com/
Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 659

Sunil Kumar wrote:Any stack trace.. line number of error?? anything... Provide some info.
From what i see, you are trying to instantiate ColorAction using (String, ImageIcon) as parameters while your constructor needs 3 (String, Icon, Color)
If ImageIcon is a subclass of Icon, you can still instantiate using (String, ImageIcon, Color). Main point to note is.. the number of arguments should be correct


Compilation error:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems:
The constructor ColorAction(String, ImageIcon) is undefined
The constructor ImageIcon(String, Color) is undefined
Syntax error, insert ")" to complete VariableInitializer
The constructor ColorAction(String, ImageIcon) is undefined
The constructor ImageIcon(String, Color) is undefined
Syntax error, insert ")" to complete VariableInitializer
The constructor ColorAction(String, ImageIcon) is undefined
The constructor ImageIcon(String, Color) is undefined
Syntax error, insert ")" to complete VariableInitializer

at homenetwork.bkr.training.ActionFrame.<init>(ActionFrame.java:19)
at homenetwork.bkr.training.ActionTest$1.run(ActionTest.java:16)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16695
    
  19

Weird. The compile errors doesn't seem to match the code. Maybe some of your stuff is out of sync -- I would consider deleting your class files, and compile again.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16695
    
  19


From reading your other topics, it looks like you are using an IDE to run the program that has compile errors. Don't do that !!!

You need to fix the compile errors. And fix them before you run them. Use the IDE to point them out and fix them -- and fix them all before you run the program. Otherwise you can get weird runtime errors, that doesn't make sense, which is what you have here.

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [newbie] The constructor <Class>(String, ImageIcon) is undefined
 
Similar Threads
Button Listener
[newbie] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
[newbie] AbstractAction fun...
.getSelection()
ActionListener and Event