0
我是新來的JTextArea和JScrollPane,每當我編譯我得到這個錯誤,Project3.java:95:找不到符號 符號:類尺寸 位置:class Project3 scroll.setPreferredSize(new Dimension(200,400));每當編譯,我不斷收到錯誤,它找不到符號
有人可以幫我嗎?
JTextArea listBox = new JTextArea(input);
JScrollPane scroll = new JScrollPane(listBox);
listBox.setLineWrap(true);
listBox.setWrapStyleWord(true);
scroll.setPreferredSize(new Dimension(200, 400));
JOptionPane.showMessageDialog(null, scroll, "Dictionary enteries" JOptionPane.PLAIN_MESSAGE);
return aLineFromFile;
這是完整的方法。
public static String listDictionary()throws IOException
{
String input = "";
BufferedReader br = new BufferedReader(new FileReader("dictionary.txt"));
String aLineFromFile = null;
while((aLineFromFile = br.readLine()) != null)
{
input += aLineFromFile + "\n";
}
br.close();
JTextArea listBox = new JTextArea(input);
JScrollPane scroll = new JScrollPane(listBox);
listBox.setLineWrap(true);
listBox.setWrapStyleWord(true);
scroll.setPreferredSize(new Dimension(200, 400));
JOptionPane.showMessageDialog(null, scroll, "Dictionary enteries", JOptionPane.PLAIN_MESSAGE);
return aLineFromFile;
}
我已經導入,導入java.io. ;導入javax.swing。; import java.util。*;