Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > 2d Graphics problem - Help!

Reply
Thread Tools

2d Graphics problem - Help!

 
 
DBC User
Guest
Posts: n/a
 
      04-21-2006
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.

 
Reply With Quote
 
 
 
 
Vova Reznik
Guest
Posts: n/a
 
      04-21-2006
DBC User wrote:
> 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.
>


Do frames share Graphics object?
 
Reply With Quote
 
 
 
 
DBC User
Guest
Posts: n/a
 
      04-21-2006
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?

 
Reply With Quote
 
Monique Y. Mudama
Guest
Posts: n/a
 
      04-21-2006
On 2006-04-21, DBC User penned:
> 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?


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).

--
monique

Help us help you:
http://www.catb.org/~esr/faqs/smart-questions.html
 
Reply With Quote
 
DBC User
Guest
Posts: n/a
 
      04-21-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Intel HD Graphics 3000 and Intel HD Graphics 2000 Review Ian Front Page News 0 02-24-2011 03:07 PM
Best graphics program to lecture students with graphics tablet Mrs. Chickpea Digital Photography 8 05-26-2008 04:54 AM
Upgrading graphics on a computer with Integrated Graphics sharonf Computer Support 3 03-27-2007 06:21 AM
Gizmodo: NVIDIA Ships 128-Core Graphics Cards for High-End Film Editors Graphics Pros Silverstrand Front Page News 0 03-05-2007 03:32 PM
Intel Graphics Media Accelerator 900 Graphics Harvey Gratt Computer Support 3 10-09-2005 02:40 AM



Advertisments