944,150 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6122
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Mar 1st, 2005
0

plotting graphs

Expand Post »
Hi, I'm developing a GUI with several forms, one of which contains a jLabel that displays a JPEG image of a graph as it's icon. How do I go about plotting a simple 2d curve on that image from a set of data? I know of drawLine etc, but how can I do that on a jLabel?
Many thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
matt_5104 is offline Offline
15 posts
since Nov 2004
Mar 1st, 2005
0

Re: plotting graphs

use paintComponent(Graphics g)
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Mar 1st, 2005
0

Re: plotting graphs

Quote originally posted by server_crash ...
use paintComponent(Graphics g)
huh? how does that help, just curious?
Reputation Points: 11
Solved Threads: 0
Junior Poster
Fasola is offline Offline
188 posts
since Jan 2005
Mar 1st, 2005
0

Re: plotting graphs

He said he wanted to draw some graphics on a JLabel, well that's how. Maybe you should think a little harder before posting stupid replys. Besides, if you didn't even know what I was talking about, why did you even post? It was obvious that helped...Now stop taking away from other people's posts.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Mar 1st, 2005
0

Re: plotting graphs

Quote originally posted by server_crash ...
He said he wanted to draw some graphics on a JLabel, well that's how. Maybe you should think a little harder before posting stupid replys. Besides, if you didn't even know what I was talking about, why did you even post? It was obvious that helped...Now stop taking away from other people's posts.

i was just trying to learn something

i don't know what he means my JLabel...i'd like to know

i don't know how that one line of code you gave him answers his question

it looked like only part of an answer...
Reputation Points: 11
Solved Threads: 0
Junior Poster
Fasola is offline Offline
188 posts
since Jan 2005
Mar 1st, 2005
0

Re: plotting graphs

ohhh Sorry dude, I thought you were like trying to insult my intelligence or something....Dang, I hate it when I do that...Really, I am sorry for being an a$$...please forgive me...

Anyways,

JLabel, is a component in swing...It's like any other label, in any other programming language..All it does is display information, and in matt's case, he's wanting to draw on top of the component...So, in order to do that, he has to override the paintComponent method...And no, it doesn't fully answer his question, it answers only part of it...I'll try answering the rest of it later...

Again, I'm really sorry..I thought you were trying to say that I didn't know what I was talking about! sorry :o
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Mar 1st, 2005
0

Re: plotting graphs

Are you talking about not answering the curve part? Could you just drwa multiple lines making it appear to be a curve only being made up of line segments.
Reputation Points: 16
Solved Threads: 9
Master Poster
OurNation is offline Offline
780 posts
since Aug 2004
Mar 1st, 2005
0

Re: plotting graphs

Quote originally posted by server_crash ...
ohhh Sorry dude, I thought you were like trying to insult my intelligence or something....Dang, I hate it when I do that...Really, I am sorry for being an a$$...please forgive me...

Anyways,

JLabel, is a component in swing...It's like any other label, in any other programming language..All it does is display information, and in matt's case, he's wanting to draw on top of the component...So, in order to do that, he has to override the paintComponent method...And no, it doesn't fully answer his question, it answers only part of it...I'll try answering the rest of it later...

Again, I'm really sorry..I thought you were trying to say that I didn't know what I was talking about! sorry :o

its no biggie, appreciate the information

i still don't have a complete grasp of what it is you guys are trying to do

but i have more to go by now, i need to look up JLabel, Swing, and basics of plotting 2 dimensional curves in java



Matt,
i was reading up on Java "Java for Dummies" a few weeks back and it spoke on using drawline which was some type of an object in one of java's built in libraries

from what i remeber it basically spoke on how "drawline" illustrates the grid of an applet by dragging the mouse from coordinates (x, y) and droping it to (x2, y2).

Is that what you mean my drawline (you'll have to excuse me i don't even own a computer, i just keep read this stuff until i can afford one)?
Reputation Points: 11
Solved Threads: 0
Junior Poster
Fasola is offline Offline
188 posts
since Jan 2005
Mar 1st, 2005
0

Re: plotting graphs

You can draw an arc in java, I guess that would be the same thing as a curve:

Somthing like... Graphics.drawArc(//code);
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Mar 1st, 2005
0

Re: plotting graphs

Quote originally posted by OurNation ...
Are you talking about not answering the curve part? Could you just drwa multiple lines making it appear to be a curve only being made up of line segments.
That's probably not a bad idea, although I would check out the drawArc() method first, and if that didn't work for him, then doing what you said certainly would.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: IF statement question
Next Thread in Java Forum Timeline: 'Back' buttons





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC