私のクラスのプロジェクトをしようとしています。私は3列のデータを構築することになっています。Java GUIの3列の境界線のレイアウト
public void displayArray(String[] wordArray) {
Container myContentPane = project1JFrame.getContentPane();
TextArea arrayArea = new TextArea();
for (int i = 0; i < wordArray.length; i++) {
if (wordArray[i] != null) {
arrayArea.append(wordArray[i] + "\n"); // add the words of the array into the TextArea
}
} //for
myContentPane.add(arrayArea, BorderLayout.WEST);
project1JFrame.setVisible(true);
} //displayArray
public void displaySortedArray(String[] wordArray) {
Container myContentPane = project1JFrame.getContentPane();
TextArea arrayArea = new TextArea();
for (int i = 0; i < wordArray.length; i++) {
if (wordArray[i] != null) {
arrayArea.append(wordArray[i] + "\n"); // add the words of the array into the TextArea
}
} //for
myContentPane.add(arrayArea, BorderLayout.CENTER);
project1JFrame.setVisible(true);
} //displaySortedArray
public void displaySortedList(WordList myList) {
Container myContentPane = project1JFrame.getContentPane();
TextArea listArea = new TextArea();
WordListIterator myIt;
listArea.setText("");
myIt = myList.reset();
while (myIt.hasNext()) {
myList.append(myIt.next() + "\n");
}
myContentPane.add(listArea, BorderLayout.EAST);
project1JFrame.setVisible(true);
}
私は私のメインプログラムと一緒にこのコードを実行しようとすると、私は唯一の2列を取得します:ここでGUIクラスのコードです。私は3列が欲しい。私はそれが国境のレイアウトとは何かを持っていると推測しているが、私はそれを行うように見えない。助けてください!
するためのHow to Use GridLayoutを見てください...あまり混乱し、より良いレスポンス
になります'java.awt.TextArea'ではなく、' javax.swing.JTextArea'を使用していなければなりません。すぐに問題を解決することはできませんが、おそらく他のものを解決するでしょう – MadProgrammer
[実行可能な例](https: /stackoverflow.com/help/mcve)を参照してください。これはコードダンプではありませんが、あなたがしていることの例はあなたが持っている問題を強調表示します。これにより、混乱が少なくなり、より良い応答が得られます。 – MadProgrammer