これは、ポップアップ ウィンドウに白い四角形を描画するだけの非常に単純なプログラムです。プログラムは問題なくコンパイルおよび実行され、ウィンドウがポップアップ表示されますが、何も表示されず、灰色になっています。なぜ何も描かれていないのですか?
import java.awt.*;
import javax.swing.*;
public class DrawPanel extends JPanel {
public void paintcompnent(Graphics g) {
int width = getWidth();
int height = getHeight();
super.paintComponent(g);
g.setColor(Color.WHITE);
g.fillRect(10, 10, 200, 200);
}
public static void main(String[] args) {
DrawPanel panel = new DrawPanel();
JFrame window = new JFrame();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.add(panel);
window.setSize(550,550);
window.setVisible(true);
}
}