我一直在寻找如何在JLabel周围建立边界.但我不希望它没有颜色.提前致谢.
public TitlePanel()
{
title = new JLabel("This is some text!", JLabel.CENTER);
add(title);
//This will make a black border around the "title" label
title.setBorder(new LineBorder(new Color(0,0,0)));
}
Run Code Online (Sandbox Code Playgroud)