正如标题所说,我只是试图在具有LineBorder集的TextArea上设置边距(提供一些填充).没有设置边框,.setMargins工作正常.这是特定的代码块.
aboutArea = new JTextArea("program info etc.....");
Border border = BorderFactory.createLineBorder(Color.BLACK);
aboutArea.setSize(400, 200);
aboutArea.setBorder(border);
aboutArea.setEditable(false);
aboutArea.setFont(new Font("Verdana", Font.BOLD, 12));
add(aboutArea);
我尝试过以下各项:
aboutArea.setMargins(10,10,10,10);
.getBorders(aboutArea).set(10,10,10,10);
UIManager.put("aboutArea.margin", new Insets(10, 10, 10, 10));
但是在应用边框后没有任何影响边距,填充总是0.任何想法如何设置带边框的textArea上的填充?