Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a JPanel border with title like in Firefox

I would like to make an option dialog in my application. In this dialog I want to make kind of Areas surrounded with a border and with a title.

An example of what I want is in Firefox:

Firefox Options

How can I do something like that in Java?

like image 470
Neifen Avatar asked Sep 21 '11 12:09

Neifen


1 Answers

Here you can find all informations you need.

Basically you can use border factory to create a Border using types available in Swing:

Border lineBorder = BorderFactory.createLineBorder(Color.black);
JPanel panel = new JPanel();
panel.setBorder(lineBorder);

You can also define your custom borders implementing Border interface.

like image 187
Heisenbug Avatar answered Oct 04 '22 17:10

Heisenbug