正如标题所说,我只是想在带有 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 上设置填充?