2

I have a string array that I want to display to a JPanel. How do I implement this?

1 Answer 1

4

I would display your list using a JList.

Read the section from the Swing tutorial on How to Use List for working examples that show how to add data to the ListModel of the JList.

Basically instead of adding the strings to a List you add them to a DefaultListModel and add the model to the JList.

Sign up to request clarification or add additional context in comments.

1 Comment

@Sharku, thanks, For some reason I was linking to an image, instead of the tutorial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.