This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes refresh canvas, designer problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "refresh canvas, designer problem?" Watch "refresh canvas, designer problem?" New topic

refresh canvas, designer problem?

robert trudel

Joined: Apr 24, 2009
Posts: 3

i begin with swing and to get more experience, i begined a small project.
i would like to create a basic entity-relation program who will generate sql script...

on a canvas i draw some shape (entity, link)

when i click on it a panel open.... to change its property... when it's close i would like to refresh canvas...

entity class

class who draw entity on the canvas

in the canvas class, when i click on a entityDrawable, i displaye the EntityPanel

any idea, design suggestion?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45292
Where is your paintComponent() method?
robert trudel

Joined: Apr 24, 2009
Posts: 3
Campbell Ritchie wrote:Where is your paintComponent() method?

where i supposed to have this method?

i only have a paint method for EntityDrawable
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
AWT uses "paint", but Swing uses "paintComponent":
robert trudel

Joined: Apr 24, 2009
Posts: 3
the code of my canvas (where i draw the shape)

i have no problem to draw entitydrawable on the jcanvas... i can move it, draw...
the only problem is when i change property of the entity (name, code...) in the EntityPanel, the change done is not applied....

so i need to change paint by paintcomponent in :JCanvas,

in EntityDrawable, i use paint...
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: refresh canvas, designer problem?
It's not a secret anymore!