Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<br>? \n? a line break in java

Tags:

java

swing

I have three JLabels and three JTextAreas. I have them in borderlayout, center, but I want each of them in a different line, that's not happening and the top ten search results in Google for line break java don't solve the problem. How can I do a simple line break?

like image 649
Delirium tremens Avatar asked Dec 18 '22 06:12

Delirium tremens


2 Answers

If this is a Swing application, you should use a layout manager to position your fields in the container.

like image 177
Rich Seller Avatar answered Dec 19 '22 21:12

Rich Seller


Line break won't help with placing Swing objects; you need to place a layout on a center JPanel. That is, the center of your border layout should be a single Swing object, a JPanel, and you should set that to a style which allows you to stack each widget. GridLayout(6,1) may do it.

like image 41
AlbertoPL Avatar answered Dec 19 '22 19:12

AlbertoPL