Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
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:
Java in General
Compiler error in JavaBean
Suman Sharma
Ranch Hand
Posts: 72
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The following example gives 8 compiler errors. The first error is where I added // Line 1:
The constructor Object(int, int, int) is undefined. I am using
Java
5.0 in Eclipse.
package com.elucify.tips.dec2003; import java.awt.Color; public class ColorBean { String _name = null; public ColorBean(int r, int g, int b, String name) { super(r, g, b); //Line 1 _name = name.trim(); } public static ColorBean newInstance(String rs, String gs, String bs, String name) { int r = Integer.valueOf(rs).intValue(); int g = Integer.valueOf(gs).intValue(); int b = Integer.valueOf(bs).intValue(); return new ColorBean(r, g, b, name); } // Read-only property accessor public String getRgbHex() { int i = getRGB() & 0xffffff; return Integer.toString(i, 16); } // Get complementary color public String getRgbComplement() { int i = ((255 - getRed()) << 16) | ((255 - getGreen()) << 8) | (255 - getBlue()); return Integer.toString(i, 16); } public String getName() { return _name; } }
Could you please help me with this? Thank you.
Bupjae Lee
Ranch Hand
Posts: 107
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I think you missed 'extends Color' for ColorBean class.
Suman Sharma
Ranch Hand
Posts: 72
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thank you. It works now.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
addMouseMotionListener error
Hexadecimal values and bitwise operators.
image is not beeing drawn
Colour picker, MouseDown(Event, int x, int y) Depreciation Help!
More...