Results 1 to 4 of 4
- 04-30-2011, 12:07 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 12
- Rep Power
- 0
Putting labels on the side of a graph
Hey,
I'm just finishing off a GUI on which are some graphs. These are drawn via the awt and awt.geom libraries and will take input data.
The problem I'm having is that I can get a label which says 0 on the bottom left of the graph at the axis, but I can't seem to get a label on the top left which would be the maximum value. I've tried using all the anchor points for the BorderLayout manager which is what I'm using, but the label either goes off the frame or overlaps the whole graph causing it to disappear.
I have included the two classes which you will need to run and see the graph, just run the HidableGraphingData class (not actually how it's done in the real GUI, the main method there is just for testing purposes).
To clarify - I want to make a label at the top left of the graph which would be an upper value of the graph, but the layout manager won't let me.
Thanks in advance,
James
-
Rather than use a layout manager to place it, why not draw it directly onto the JPanel from within its paintComponent method using the the Graphics object's drawString method?
- 04-30-2011, 01:02 PM #3
Member
- Join Date
- Mar 2011
- Posts
- 12
- Rep Power
- 0
You sir, are a genius.
<33
Thanks! :D
Edit: +rep'd you :)
-
Similar Threads
-
Printing labels to A4
By eggy524 in forum New To JavaReplies: 3Last Post: 09-23-2010, 04:53 PM -
how to access Ms Access from client side to server side
By arunkumarinfo in forum JDBCReplies: 1Last Post: 03-20-2010, 07:03 PM -
Putting a graph on another JPanel in another JFrame
By thestarncy in forum AWT / SwingReplies: 10Last Post: 12-31-2009, 04:45 PM -
size och swt labels
By larsk in forum SWT / JFaceReplies: 0Last Post: 10-04-2009, 12:01 PM -
Deploy Jar Side By Side
By Adrian in forum EclipseReplies: 0Last Post: 04-11-2008, 02:09 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks