2013-10-30 136 views
0

当我让JTextArea显示文本但不编辑它。它会变成蓝色,看不清楚。如何在不可编辑时更改JTextArea的颜色?如何改变JTextArea不可编辑的颜色?

+2

你想改变哪个颜色?使用setBackground和setForeground方法 – Markus

+0

我对实际颜色没有问题,但是当我使文本区域变得不可编辑时,它变成浅蓝色。 – Bernard

回答

1

尝试使用此:

JTextArea a = new JTextArea("test"); 
a.setEnabled(false); 
a.setDisabledTextColor(Color.red); 
+0

-1,这个建议是早些时候给出的。无需重复该建议。 – camickr

1

不能使用

public void setDisabledTextColor(Color c) 

相关问题