Link to home
Start Free TrialLog in
Avatar of Kensai
Kensai

asked on

Simple Question

Hallo
I am new to java and don't usnderstand some basic things that you all experts already know

I want to make something like color chooser(I don't want to use Swing Color chooser)

In then button pressed - {
I collect information about color to choose;
make color;
and here I need to fill my canvas with this color

}

when I use
public void paint(Graphics g){}
compiler makes error

I tryed to create second class like Area_Filler.class but I dont know how to make this 2nd class to work.
Something like
include????


Please explain me such things
urls are also usefull

Roman

PS I will add more points when it grow more







Avatar of yehudaw
yehudaw

First of all, try to use the java tutorial:

http://java.sun.com/docs/books/tutorial/index.html

Second:
I didn't really understand your question, but maybe this is what you ment:
Graphics is in package java.awt.Graphics. Therefor you need to import this class.

You can do this by:
import java.awt.Graphics;

(or can import the entire package by: import java.awt.*; )

ASKER CERTIFIED SOLUTION
Avatar of rarulkumar
rarulkumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Arul,
He want the answer without using swings.
Avatar of Kensai

ASKER

now I want to make color chooser
with 4 textfields(alfa,red,green,blue) and button and canvas.

when you press button - canvas is fillRect with color(a,r,g,b).
It's all what I want now.

But finally I'd wanted to make color chooser more advanced.

From picture with palette. Like any win painting program.

Roman

Thank for a Swing example. This might be educational for me :)