Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Border Thickness on JPanels?

I'm wondering if it is possible to adjust the thickness of a border around a JPanel in Java? I currently have a border defined and the JPanel adds the border around it but I would like it to be a little thicker:

Border border;
JPanel panel;

border = BorderFactory.creatLineBorder(Color.RED);
panel = new JPanel();
panel.setBorder(border);
like image 921
NiallMitch14 Avatar asked Apr 21 '15 16:04

NiallMitch14


1 Answers

I believe you could use BorderFactory

panel.setBorder(BorderFactory.createStrokeBorder(new BasicStroke(5.0f)));

See

  • BorderFactory
  • BasicStroke
like image 118
Jean-François Savard Avatar answered Sep 20 '22 10:09

Jean-François Savard