質問内容
質問を評価する
(0ポイント)
|
import java.awt.*; import javax.swing.*;
class A15 extends JFrame{
A15(){ JTextArea textarea = new JTextArea();
this.getContentPane().setLayout(null); this.add(textarea); textarea.setBounds(50,50,50,50);
this.setUndecorated(true); this.setBackground(new Color(0,0,0));this.setForeground(new Color(255,255,255)); this.setBounds(100,100,100,100); this.setVisible(true);
textarea.requestFocus(); }
public void paint(Graphics g){ for(int i = 0;i<=10;i++){ try{Thread.sleep(10);}catch(InterruptedException e){} g.fillRect(i,10,10,10);} }
public static void main(String args[]){new A15();}}
こんなふうにコードを書くと 画像の描画が終わった後でしかtextareaに 書けないんです。
あとtextareaも変なんです。
したいことは、swingのパーツと 画像描画を一緒のフレームで使用したいんです。 フレームを二つするのは嫌なんです。 どうしたらswingのパーツと画像描画を一つのフレームで使えますか?
|