0

I need to set a border on only one side of JPanel. I'm using Java 8 and Swing.

I'm looking for a simple solution, because create a other class to do the customization I think a lot for something simple.

Just draw a line don't works good because I want to customize the border.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Arcaniaco
  • 400
  • 2
  • 10
  • 2
    You're probably looking for this: https://stackoverflow.com/questions/2174319/is-it-possible-to-have-a-java-swing-border-only-on-the-top-side and maybe this as well: https://stackoverflow.com/questions/11935188/is-there-any-way-to-get-one-sidei-e-right-bordered-line-of-the-jtextfield-co – Thomas Jul 20 '21 at 13:59
  • Perhaps a [`JSeparator`](https://docs.oracle.com/en/java/javase/16/docs/api/java.desktop/javax/swing/JSeparator.html) would be better for this. – Andrew Thompson Jul 20 '21 at 14:04
  • @Thomas yes, thats good! Thank you. – Arcaniaco Jul 20 '21 at 14:06
  • Does this answer your question? [Is it possible to have a java swing border only on the top side?](https://stackoverflow.com/questions/2174319/is-it-possible-to-have-a-java-swing-border-only-on-the-top-side) – aksappy Jul 20 '21 at 14:07

0 Answers0