Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent! Drawing graphic in Java

Status
Not open for further replies.

fungling

Programmer
Feb 23, 2003
10
HK
Hi all,

I am doing a Catering project which requires to view the table status (4 colors represent 4 status) in graphical form. User can click the graphic and see the billing or order detail. I don't have any idea on it.
Should I use 2D Graphic and Threading in this project.
Please give me some suggestion or reference to do so.

Many Thanks!

Joyce
 
A JButton can display a graphic (jpg or gif). One of the constructors will take an ImageIcon object.
 
JavalinMan,

4 statuses are mutually exclusive and only one status per each table is allowed at a time. The system should show 25 tables status at the same time.

Many thanks

Joyce
 
I'm not sure what you are trying to achieve here but one question that springs to mind is, must it be in graphical form? If the user has to click a colour to see a status, it strikes me that those colours are just buttons in disguse.

Could you not extend the JButton so that instead of drawing a standard button it draws as a solid colour, so that when a user clicks on the colour, he is in fact clicking on a button?

over writting the
Code:
protected void paintComponent(Graphics g) {...}
method will allow you to draw the button anyway you wish, just remember to add the line
Code:
super.paintComponent(g);
to the end of your overwritten method.

Check out some of Sun's tutorials on custom swing components, specifically how to create a round button, for an idea on getting that to work. -------------------------------------------
There are no onions, only magic
-------------------------------------------
 
Javelin man, i'm doing something that would have JToggleButtons that are mutually exclusive but can u create like an array of JButtons. That way if I want to do some mass changes I could just access them through their index?

Delton.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top