我不知道在哪里查明此代码中的错误来源,希望有人可以提供帮助。错误被粘贴在源之后。直到2秒前,当我做出一个让eclipse想要终止当前正在运行的应用程序的更改时,它确实非常好。
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTree;
public class AnimationManager {
private JFrame appFrame;
private JPanel mainPanel;
private JMenuBar menuBar;
private JPanel filePanel;
private JPanel indexPanel;
private JPanel propsPanel;
private JPanel dataPanel;
private JTree index;
public AnimationManager() {
appFrame = new JFrame("Animation Manager v0.1 by Firstmate");
appFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
//save file
});
appFrame.setContentPane(createContentPane());
createMenuBar();
appFrame.setSize(1024, 768);
appFrame.setVisible(true);
}
private void createMenuBar() {
menuBar = new JMenuBar();
}
private JPanel createContentPane() {
mainPanel = new JPanel(new BorderLayout());
mainPanel.setBorder(null);
createFilePanel();
createDataPanel();
JSplitPane mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, filePanel, dataPanel);
mainPanel.add(mainSplit, BorderLayout.CENTER);
return mainPanel;
}
private void createFilePanel() {
filePanel = new JPanel(new BorderLayout());
filePanel.setPreferredSize(new Dimension(150, 700));
indexPanel = new JPanel();
indexPanel.setPreferredSize(new Dimension(150,350));
Vector vector = new Vector();
vector.add("One");
vector.add("Two");
index = new JTree(vector);
index.setSize(300, 350);
indexPanel.add(index);
propsPanel = new JPanel();
propsPanel.setPreferredSize(new Dimension(150, 350));
JSplitPane fileSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, indexPanel, propsPanel);
filePanel.add(fileSplit, BorderLayout.CENTER);
}
private void createDataPanel() {
dataPanel = new JPanel();
dataPanel.setSize(724, 700);
}
public JFrame getAppFrame() {
return appFrame;
}
public static void main(String[] args) {
try {
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
AnimationManager am = new AnimationManager();
}
}
Description Resource Path Location Type
Syntax error on token "(", ; expected AnimationManager.java /AnimationManager/src line 75 Java Problem
Syntax error on token "(", ; expected AnimationManager.java /AnimationManager/src line 75 Java Problem
Syntax error on token ")", ; expected AnimationManager.java /AnimationManager/src line 75 Java Problem
Syntax error on token ")", ; expected AnimationManager.java /AnimationManager/src line 75 Java Problem
Syntax error on token "{", invalid Type AnimationManager.java /AnimationManager/src line 42 Java Problem
Syntax error on token "{", invalid Type AnimationManager.java /AnimationManager/src line 42 Java Problem
Syntax error on token "{", invalid Type AnimationManager.java /AnimationManager/src line 51 Java Problem
Syntax error on token "{", invalid Type AnimationManager.java /AnimationManager/src line 51 Java Problem
Syntax error on token "}", delete this token AnimationManager.java /AnimationManager/src line 38 Java Problem
Syntax error on token "}", delete this token AnimationManager.java /AnimationManager/src line 38 Java Problem
Syntax error on token "}", delete this token AnimationManager.java /AnimationManager/src line 50 Java Problem
Syntax error on token "}", delete this token AnimationManager.java /AnimationManager/src line 50 Java Problem
Syntax error on token "}", delete this token AnimationManager.java /AnimationManager/src line 67 Java Problem
Syntax error on token "}", delete this token AnimationManager.java /AnimationManager/src line 67 Java Problem
Syntax error on token "}", delete this token AnimationManager.java /AnimationManager/src line 84 Java Problem
Syntax error on token "JFrame", @ expected AnimationManager.java /AnimationManager/src line 72 Java Problem
Syntax error on token "JFrame", @ expected AnimationManager.java /AnimationManager/src line 72 Java Problem
Syntax error on token "JPanel", @ expected AnimationManager.java /AnimationManager/src line 42 Java Problem
Syntax error on token "JPanel", @ expected AnimationManager.java /AnimationManager/src line 42 Java Problem
Syntax error on token "void", @ expected AnimationManager.java /AnimationManager/src line 39 Java Problem
Syntax error on token "void", @ expected AnimationManager.java /AnimationManager/src line 39 Java Problem
Syntax error on token "void", @ expected AnimationManager.java /AnimationManager/src line 51 Java Problem
Syntax error on token "void", @ expected AnimationManager.java /AnimationManager/src line 51 Java Problem
Syntax error on token "void", @ expected AnimationManager.java /AnimationManager/src line 68 Java Problem
Syntax error on token "void", @ expected AnimationManager.java /AnimationManager/src line 68 Java Problem
Syntax error on token(s), misplaced construct(s) AnimationManager.java /AnimationManager/src line 39 Java Problem
Syntax error on token(s), misplaced construct(s) AnimationManager.java /AnimationManager/src line 39 Java Problem
Syntax error on token(s), misplaced construct(s) AnimationManager.java /AnimationManager/src line 68 Java Problem
Syntax error on token(s), misplaced construct(s) AnimationManager.java /AnimationManager/src line 68 Java Problem
Syntax error, insert "}" to complete ClassBody AnimationManager.java /AnimationManager/src line 25 Java Problem
Syntax error, insert "}" to complete ClassBody AnimationManager.java /AnimationManager/src line 33 Java Problem
Syntax error, insert "}" to complete ClassBody AnimationManager.java /AnimationManager/src line 33 Java Problem
Syntax error, insert "enum Identifier" to complete EnumHeaderName AnimationManager.java /AnimationManager/src line 72 Java Problem
Syntax error, insert "enum Identifier" to complete EnumHeaderName AnimationManager.java /AnimationManager/src line 72 Java Problem
Syntax error, insert "EnumBody" to complete BlockStatement AnimationManager.java /AnimationManager/src line 72 Java Problem
Syntax error, insert "EnumBody" to complete BlockStatement AnimationManager.java /AnimationManager/src line 72 Java Problem
答案 0 :(得分:2)
你错过了一个支架。
appFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
//save file
**}** //Bracket here
});