package FaultDiagnose;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;public class YeYaMain extends JFrame implements ActionListener{
private static final long serialVersionUID = 1L;
JButton jb2 = new JButton(" 一 因  一  果      ");
JButton jb8 = new JButton("非一因一果关系");
JButton jb6 = new JButton(" 返  回  上  层      ");
JButton jb7 = new JButton(" 退  出  系  统      ");

TitledBorder tb1=new TitledBorder("请选择");


JLabel jl1=new JLabel("欢迎使用起重车液压系统智能故障诊断系统"); 
//创建横向Box容器
private Box box0=Box.createVerticalBox();
private Box box1=Box.createHorizontalBox(); 
private Box box2=Box.createHorizontalBox();
private Box box3=Box.createVerticalBox();
private Box box4=Box.createVerticalBox();

  public YeYaMain(){
super("欢迎使用起重车智能故障诊断系统");
jb2.setSize(150,25);
jb6.setSize(150,25);

//加入图片
jl1.setBounds(150,100,1000,700); // 设置标签的显示位置及大小
jl1.setFont(new Font("", Font.BOLD, 28)); 


//加入下拉列表
this.add(box0);
box0.add(Box.createVerticalStrut(30));
box0.add(box1);    box1.add(jl1);
box0.add(Box.createVerticalStrut(15));
box0.add(box2);
box2.add(Box.createHorizontalGlue());
box2.add(box3);
box3.setBorder(new TitledBorder(tb1));



box3.add(Box.createVerticalStrut(22));
box3.add(jb2);
jb2.addActionListener(this);

box3.add(Box.createHorizontalGlue());
box3.add(Box.createVerticalStrut(22));
box3.add(jb8);
    jb8.addActionListener(this);

box3.add(Box.createHorizontalGlue());
box3.add(Box.createVerticalStrut(22));
box3.add(jb6);
    jb6.addActionListener(this);
    box3.add(Box.createHorizontalGlue());
box3.add(Box.createVerticalStrut(22));
box3.add(jb7);
    jb7.addActionListener(this);
    
    
   
          
    
    box3.add(Box.createVerticalStrut(60));
    box2.add(Box.createHorizontalGlue());
box2.add(box4);//添加图片
box2.add(Box.createHorizontalGlue());
box0.add(Box.createVerticalStrut(22)); this.setVisible(true);
this.setResizable(false);
    this.setBounds(320,60,800,620);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }

  public void actionPerformed(ActionEvent e) {
  if(e.getSource() == jb2){
  HuiMain frame=new HuiMain();
  frame.setVisible(true);
  this.setVisible(false);
  }     
 
  if(e.getSource() == jb8){
  DuoxitongMain frame=new DuoxitongMain();
  frame.setVisible(true);
  this.setVisible(false);
  
  }      if (e.getSource() == jb6){
       this.setVisible(false);
       new Main2();
         }
     
   
      else 
         if (e.getSource() ==jb7 ){ //退出系统
            System.exit(0);
        }
   
 }
}

解决方案 »

  1.   

    rame.setVisible(true);出错了,原因为Type The method setVisible(boolean) is undefined for the type DuoxitongMain
      

  2.   


      if(e.getSource() == jb2){
              HuiMain frame=new HuiMain();
              frame.setVisible(true);
              this.setVisible(false);
          }  为什么这个地方的frame.setVisible(true)没有问题啊。
      

  3.   

    你的
    DuoxitongMain类的内容呢?
      

  4.   

    package myproject;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
     
    public class DuoxitongMain {
     
        static final int WIDTH = 400;
        static final int HEIGHT = 500;
     
        public static void main(String args[]) {
            JFrame frame = new JFrame("TCMESFD");
            frame.setSize(WIDTH, HEIGHT);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
            // 菜单栏
            JMenuBar menubar1 = new JMenuBar();// 添加菜单条组件
            frame.setJMenuBar(menubar1);// 将菜单条添加到顶层容器中
            JMenu menu1 = new JMenu("故障树"); // 设置菜单组件
            JMenu menu2 = new JMenu("知识库");
            JMenu menu3 = new JMenu("诊断结果");
            JMenu menu4 = new JMenu("返回主界面");
            JMenu menu5 = new JMenu("帮助");
            menubar1.add(menu1);// 将菜单组件添加到菜单条组件中
            menubar1.add(menu2);
            menubar1.add(menu3);
            menubar1.add(menu4);
            menubar1.add(menu5);
            // 标题、按钮和任务分解和任务分配
            JLabel title = new JLabel("欢迎");
            JLabel title1 = new JLabel("任务分解");
            JLabel title2 = new JLabel("任务分配");
            JLabel title3 = new JLabel("诊断结论");
            JLabel title4 = new JLabel("建议解决措施");
            
            
            JToggleButton StartD = new JToggleButton("开始诊断");
            JButton StopD = new JButton("停止诊断");
            frame.add(title);
            frame.add(title1);
            frame.add(title2);
            frame.add(title3);
            frame.add(title4);
            frame.add(StartD);
            frame.add(StopD);
            JTextArea jta1 = new JTextArea("1.任务分解开始;\r\n2.任务分解为4个子任务;\r\n3.任务分解结束;");
            JTextArea jta2 = new JTextArea("1.任务分配开始;\r\n2.子任务1分配给Agent9;\r\n3.子任务2分配给Agent2;\r\n"
             + "4.子任务3分配给Agent4;\r\n5.子任务4分配给Agent1;\r\n6.任务分配结束;");
            JTextArea jta3 = new JTextArea("诊断时间:2013-5-20 10:08:38\r\n故障代码:dl0056\r\n"
             + "诊断现象:变幅机构、伸缩机构和起升机构均无法动作\r\n故障位置:多路阀系统\r\n故障原因:主安全阀失效");
            JTextArea jta4 = new JTextArea("解决措施:多路阀系统主安全阀调定压力不够,排查");
            
            
            JScrollPane scr1 = new JScrollPane(jta1,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS ,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            JScrollPane scr2 = new JScrollPane(jta2,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS ,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            JScrollPane scr3 = new JScrollPane(jta3,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS ,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            JScrollPane scr4 = new JScrollPane(jta4,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS ,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            frame.add(scr1);
            frame.add(scr2);
            frame.add(scr3);
            frame.add(scr4);
            // 故障原因与结果的关系
            Container cont = frame.getContentPane();
            JRadioButton jrb1 = new JRadioButton("一一对应");
            JRadioButton jrb2 = new JRadioButton("一因多果");
            JRadioButton jrb3 = new JRadioButton("一果多因");
            JPanel pan = new JPanel();
            pan.setBorder(BorderFactory.createTitledBorder("故障原因与结果的关系")); // 设置一个边框的显示条
            pan.setLayout(new GridLayout(1, 3));
            pan.add(jrb1);
            pan.add(jrb2);
            pan.add(jrb3);
            cont.add(pan);
            frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent obj) {
                    System.exit(1);
                }
            });
            // 任务分解和任务分配
     
            frame.setLayout(null);
            title.setBounds(90, 5, 250, 20);
            title1.setBounds(15, 55, 250, 20);
            title2.setBounds(200, 55, 250, 20);
            title3.setBounds(15, 230, 250, 20);
            title4.setBounds(15, 350, 250, 20);
            
            StartD.setBounds(70, 30, 100, 20);
            StopD.setBounds(220, 30, 100, 20);
            pan.setBounds(12, 180, 360, 50);
            scr1.setBounds(15, 80, 170, 90);
            scr2.setBounds(200,80,170,90) ;
            scr3.setBounds(15,250,355,100) ;
            scr4.setBounds(15,370,355,60) ;
            
            frame.setVisible(true);
     
        }
    };
      

  5.   

    DuoxitongMain代码已经贴出来了,能具体说明吗