JPanel を拡張してゲーム ボードを表示し、下部に JEditorPane を追加してステータス テキストを保持します。残念ながら、ゲーム ボードは問題なく表示されますが、JEditorPane は、その中のテキストを強調表示するまで、空白の灰色の領域にすぎません。super.paintComponent(g) は他の子 (つまり、JEditorPane) をレンダリングする必要があるため、Swing を正しく理解していれば機能するはずです。教えてください、すばらしいスタックオーバーフローよ、私が犯している骨の折れる間違いは何ですか?
public GameMap extends JPanel {
public GameMap() {
JEditorPane statusLines = new JEditorPane("text/plain","Stuff");
this.setLayout(new BoxLayout(this,BoxLayout.PAGE_AXIS));
this.add(new Box.Filler(/*enough room to draw my game board*/));
this.add(statusLines);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
for ( all rows ){
for (all columns){
//paint one tile
}
}
}
}