On the bottom of the container where it says Statistic, what kind of box is that. I am using JFrame and would like to duplicate that.
Thanks
On the bottom of the container where it says Statistic, what kind of box is that. I am using JFrame and would like to duplicate that.
Thanks
It's a JPanel. It provides means for visually structuring elements into box-like containers. You can find more information on how to effectively use and style them here.
EDIT: Since you seem to be more interested in the style of the border than the name of the component being used in the example above here's a snippet using the border style on a panel.
import javax.swing.*;
public class MyPanelTestDrive{
public static void main(String [] args){
JFrame myFrame = new JFrame("Panel Test Drive");
myFrame.setSize(800,600);
JPanel myPanel = new JPanel();
myPanel.setBorder(BorderFactory.createTitledBorder("Panel Title"));
myFrame.add(myPanel);
myFrame.setVisible(true);
}
}
The container you're seeing is a JPanel
. Followed by adding a border to it. You can add a border with text, by doing.
// panel is a JPanel
panel.setBorder(BorderFactory.createTitledBorder("Title"));
You can read more about it on the Java Docs there is even a lot of examples, showing the various borders, etc.
There is even a "BorderDemo.java" you can get from the Java Docs.