精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • JAVAEclipse:could not find the main class,program will exit!

    JAVAEclipse:could not find the main class,program will exit!
    我在Eclipse中寫了以下一個程序:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    //森林狀的關(guān)系圖
    public class JTreeDemo
    extends JFrame{
    JTextField jtfInfo; //文本域,用于顯示點擊的節(jié)點名稱

    public JTreeDemo(){
    super("森林狀的關(guān)系圖");//調(diào)用父類構(gòu)造函數(shù)

    DefaultMutableTreeNode root = new DefaultMutableTreeNode("設(shè)置"); //生成根節(jié)點
    DefaultMutableTreeNode node1=new DefaultMutableTreeNode("常規(guī)"); //生成節(jié)點一
    node1.add(new DefaultMutableTreeNode("默認路徑")); //增加新節(jié)點到節(jié)點一上
    node1.add(new DefaultMutableTreeNode("保存選項"));
    root.add(node1);//增加節(jié)點一到根節(jié)點上
    root.add(new DefaultMutableTreeNode("界面"));
    root.add(new DefaultMutableTreeNode("提示聲音"));
    root.add(new DefaultMutableTreeNode("打印"));

    JTree tree = new JTree(root);//得到JTree的實例
    DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer)tree.getCellRenderer(); //得到JTree的Renderer
    renderer.setLeafIcon(null); //設(shè)置葉子節(jié)點圖標為空
    renderer.setClosedIcon(null);//設(shè)置關(guān)閉節(jié)點的圖標為空
    renderer.setOpenIcon(null); //設(shè)置打開節(jié)點的圖標為空

    tree.addTreeSelectionListener(new TreeSelectionListener() {//選擇節(jié)點的事件處理
    public void valueChanged(TreeSelectionEvent evt) {
    TreePath path = evt.getPath();//得到選擇路徑
    String info=path.getLastPathComponent().toString(); //得到選擇的節(jié)點名稱
    jtfInfo.setText(info);//在文本域中顯示名稱
    }
    });
    JScrollPane jsp=new JScrollPane(tree); //增加JTree到滾動窗格
    jtfInfo=new JTextField(); //實例化文本域
    jtfInfo.setEditable(false); //文本域不可編輯
    getContentPane().add(jsp,BorderLayout.CENTER);//增加組件到容器上
    getContentPane().add(jtfInfo,BorderLayout.SOUTH);


    setSize(250,200);//設(shè)置窗口尺寸
    setVisible(true);//設(shè)置窗口可視
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //關(guān)閉窗口時退出程序
    }

    public static void main(String[] args){
    new JTreeDemo();
    }
    }
    運行時跳出could not find the main class,program will exit!
    誰幫我解決一下!謝謝
    我用的是JDK1.4.2,Eclipse3.2
    運行之后跳出這么一大段:
    java.lang.UnsupportedClassVersionError: JTreeDemo (Unsupported major.minor version 49.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    Exception in thread "main"
    其他人氣:419 ℃時間:2020-05-19 23:11:27
    優(yōu)質(zhì)解答
    我試過了,你的程序沒有任何問題,你運行的方式可能不正確.你在eclipse中用右鍵點擊JTreeDemo.java文件“選擇運行”->"java 應(yīng)用程序"的方式運行試試,沒問題的————————————————————————出現(xiàn)這...
    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點,以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機版