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?

Recommended Answers

All 3 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.