Question

I'm beginner JAVA. I'm using Swing tool for design GUI. I'm looking for GroupBox container similiar in C# winform. Any Help...

Thanks Guys.

Update

JPanel box = new JPanel();  
box.setLayout(new MigLayout("", "[323.00][][27.00][197.00][][][56.00][]", "[][][][][][][][][][][][][][][]"));
box.setBorder(BorderFactory.createTitledBorder("192.168.10.101"));
add(box, "flowx,cell 3 0 1 4");

JLabel lblNewLabel = new JLabel("Start Offset X,Y:");
box.add(lblNewLabel, "flowx,cell 3 0");
Was it helpful?

Solution

You can use a JPanel with a titled Border from the BorderFactory.

JPanel box = new JPanel();
box.add(new JLabel("Some element"));

box.setBorder(BorderFactory.createTitledBorder("Box Title"));

You can add any other components to the JPanel and lay them out as you wish. The Border just frames them... Here is a more extensive tutorial which also explains different styles.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top