This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Serialization and Graphics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Serialization and Graphics" Watch "Serialization and Graphics" New topic

Serialization and Graphics

Kriti Garg
Ranch Hand

Joined: Sep 13, 2004
Posts: 50
My question is...
"why Graphics class do not implement serializable interface".
like Color or others in java.awt

Jason Kingsley

Joined: Feb 21, 2004
Posts: 18
because a graphics context is usually quite unique to a machine/address space/device and serialising it over the wire makes absolutely no sense to the receiving context.

Basically, wanting to draw onto a remote graphics context is a very very bad idea. If you are wanting to say remotely control/cause to draw things between some client and server then you are better off looking at some form of protocol/messaging system between the two entities. This would abstract away the physical devices and provide adequate seperation.
It is sorta covered in the JavaRanch Style Guide.
subject: Serialization and Graphics