Xilonian
Xilonian

Reputation: 13

Java swing help needed

I need to build a GUI in java with the following format:

Without providing any large blocks of code I want to know how to get started. After reading countless info on swing I am utterly confused. I'm wondering if I would need multiple Jpanels / frames or a gridlayout or flowlayout. Also a very general idea of how to get started on the GUI would help. I know what components I need (list, label etc..) and have example code to help. The data I will load myself.

I'm assuming I will need a separate class for each component and maybe only one for labels to make it easier to debug.

Upvotes: 1

Views: 82

Answers (1)

NESPowerGlove
NESPowerGlove

Reputation: 5496

You will need to mix containers and layouts, knowing what properties different layouts have, and different parts of those layouts, and the different options of the layouts will help a lot in knowing how to nest components together to get what you want.

Without providing code that shows this, I would do the following container/layout nesting:

The root panel could have a BorderLayout, with two JPanels on the east and west sides of it.

West most JPanel could have a BorderLayout, with the JList being in the center so it expands and takes up as much room as possible, and the 4 labels and 4 text fields could be in another panel which has a GridLayout of 4 rows by 2 columns.

The far east JPanel could have a BorderLayout as well, with a JPanel in the north that has a GridLayout of 3 rows by 1 column, where each of those rows has another panel of a FlowLayout. The text area or whatever it is could be in a JPanel in the center position, and you could place the bottom text field and label in a JPanel with a FlowLayout in the south position of the far east JPanel.

Upvotes: 3

Related Questions