1

PlayFrame というクラスに次のコードがあります。

public void construct(FieldPanel fPanel){
    this.setTitle("Play");
    Dimension dimension = new Dimension(1200,600);
    this.setSize(dimension);
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.pack();
    GridLayout gLayout = new GridLayout();
    this.setLayout(layout);
    score.setText("Score: " + pField.scoreValue);
//      this.add(score);
//      this.add(scoreList);
//      this.add(status);

ご覧のとおり、新しい GridLayout オブジェクトを作成しようとしましたが、それを使用して必要なコンポーネントを表示する方法がわかりません。左上に大きなパネル、右上にスコア リスト パネル、左下に小さなステータス ラベル、右下に小さなスコア ラベルを配置したレイアウトが必要です。そのため、それらが機能するかどうか、または正確に何をするかわからないため、いくつかコメントアウトしています。PlayFrameにfPanel、2つのラベル、およびフレームに配置する必要がある別のパネルを表示するにはどうすればよいですか? GridLayout オブジェクトを作成して使用する方法を知る必要があるだけです。ありがとう。

ウィンドウは次のようになります。

________________________________________________________________________________
|Play                                                                     - 0 x |
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Score List:     | 
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Mario: 100      | 
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Luigi: 50       |        
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Waluigi: 20     | 
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Wario: 10       |       
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 | 
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 |       
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 | 
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 |       
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 | 
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 |       
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 | 
|%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                 |    
|Status: Ready!                                                       Score: 30 |
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

パーセント記号は、ゲームが行われる画面です。これが役立つことを願っています。

4

1 に答える 1

0

Eclipse を使用している場合、Window Builderが GUI の作成に非常に役立つことがわかりました。そうでなければ、他の人が言ったように、オラクルのウェブサイトは始めるのに最適な場所です.

于 2013-10-31T07:04:00.650 に答える