0
私はJScrollPaneをテキストの色の変更、テキストボックスの背景と独自のフォントで作成したいと思いますが、実装がうまくいかない - JScrollPaneのデフォルトフォーム(白い背景、標準黒色のフォント)を見た。誰も私にそれが動作しない理由とそれを修正する方法を教えてもらえますか?JScrollPaneのコンテンツの色を変更するにはどうすればよいですか?
public class TextField extends JFrame
{
\t public TextField()
\t {
\t \t JScrollPane scroll = new JScrollPane(new JTextArea(15, 45));
\t \t scroll.setPreferredSize(new Dimension(500, 300));
\t \t scroll.getViewport().setBackground(Color.BLUE);
\t \t scroll.getViewport().setForeground(Color.YELLOW);
\t \t
\t \t Font font = new Font("Dialog", Font.BOLD + Font.ITALIC, 14);
\t \t scroll.getViewport().setFont(font);
\t \t add(scroll);
\t \t pack();
\t }
}