/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package texteditor;
//import java.awt.*;
import javax.swing.*;
/**
*
* @author
*/
public class TextEditor {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
JFrame window = new JFrame("Text Editor");
//JMenuBar menuBar = window.getJMenuBar();
//Create menu bar
JMenuBar menuBar= new JMenuBar();
//File Menu
JMenu fileMenu = new JMenu("File");
fileMenu.add(new JMenuItem("Save"));
menuBar.add(fileMenu);
window.setJMenuBar(menuBar);
JTextPane textArea= new JTextPane();
Document d= textArea.getDocument();
window.add(textArea);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
}
}
错误
Exception in thread "main" java.lang.RuntimeException: Uncompilable
source code - cannot find symbol symbol: class Document
location: class texteditor.TextEditor at
texteditor.TextEditor.main(TextEditor.java:33) Java Result: 1 BUILD
SUCCESSFUL (total time: 2 seconds)
如何解决?