Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

2d Graphics problem - Help!

Thread view: 
DBC User - 21 Apr 2006 07:10 GMT
Hi all,

I have 2 frames, one frame has panel, which displays a bar chart. I
have another frame which display the bar chart values in text in
JTextPanel. Bar chart drawing is real time with data coming from
server. So when I get the data  pass it to the second frame to display
the text and then draw the graph as well.

When I do only Bar chart everything is fine, but when I start
displaying the second frame to write text message, everything in the
second frame start appearing in my bar chart panel. Does anyone know
why this is happening?

Thanks a lot.
Vova Reznik - 21 Apr 2006 15:01 GMT
> Hi all,
>
[quoted text clipped - 10 lines]
>
> Thanks a lot.

Do frames share Graphics object?
DBC User - 21 Apr 2006 17:09 GMT
No, This is the sequence diagram if you will,

mainprogram -> create frame1 -> create panel with 2D graphics object
that get painted everytime it recives message from server.

mainprogram->create frame1->create frame2 ->create a textpanel which
updates the text in this box, everytime, it gets the message from the
server.

when the second part is not running the first one works like a charm
but when you enable the second frame, the first frame paint is painting
the frame 1 panel and underneth it paints frame 2 text box message. any
idea how to seperate them and not to paint over again and again?
Monique Y. Mudama - 21 Apr 2006 18:03 GMT
> No, This is the sequence diagram if you will,
>
[quoted text clipped - 10 lines]
> message. any idea how to seperate them and not to paint over again
> and again?

This sounds like a problem with forgetting to call super.paint() or
super.paintComponent() in your custom paint code (depending on whether
you're using AWT or Swing).

Signature

monique

Help us help you:
http://www.catb.org/~esr/faqs/smart-questions.html

DBC User - 21 Apr 2006 19:35 GMT
Yes I wasn't doing the super.paint, the reason is, I want to retain the
old graph and update only the new data. If I do super.paint I loose all
previously drawn graph. Now that i am thinking about it.

Can I generate a image and update the image and show it in a paint,
will it work?

Thanks for the answers.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.