• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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

 
Ranch Hand
Posts: 664
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well this is what I see:



Full listing:





 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jon Camilleri
Ranch Hand
Posts: 664
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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)
 
author
Posts: 23959
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Henry Wong
author
Posts: 23959
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic