Hey guys n girls, I have two arrays (one for x and one for y axis) which contain labels i would like to display on a graph. How do you recommend i do this?

I was thinking multiple JLabels, spread out depending on the quantity. But If theres a better of way without creating multiple Jabels then that would be better. Maybe hashtable similar to the slider label creation process?

13 Years
Discussion Span
Last Post by MrScruff

I wonder if this would work: Create one array with all the values you need, then create a gridlayout with the certain number of rows and columns you need and then append them to the container set to the grid layout


Hi everyone,

Read the labels into an array and then use the graphics object to paint it on the specified object. Do not forget to valite and repaint the component on which you painted the labels.

Richard West


Ive actually just created a border layout with the graph in the center, Y axis (panel with gridLayout) to west and x axis (same as Y) south. Then created 5 labels for each y/x panel which i have placed a range of values from some arrays. Its taken some tweaking but it kinda works.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.