"改了。。。packagecomponent;IMPORTjava。awt。BorderLayout;IMPORTjava。awt。Dimension;IMPORTjava。 awt。GridLayout;IMPORTjava。awt。Toolkit;IMPORTjava。awt。event。ActionEvent;IMPORTjava。awt。 event。ActionListener;IMPORTjavax。swing。ButtonGroup;IMPORTjavax。swing。JButton;IMPORTjavax。 swing。JComboBox;IMPORTjavax。swing。JDialog;IMPORTjavax。swing。JFrame;IMPORTjavax。swing。 JLabel;IMPORTjavax。swing。JPanel;IMPORTjavax。swing。JRadioButton;@SuppressWarnings("serial")publicclassSolveextendsJFrame{Dialogdialog;@SuppressWarnings("deprecation")Solve(){setSize(400,300);setResizable(false);setDefaultCloseOperation(JFrame。 EXIT_ON_CLOSE);Dimensionscrsize=Toolkit。getDefaultToolkit()。getScreenSize();setLocation((scrsize。 width-300)/2,(scrsize。height-150)/2);add();show();}publicvoidadd(){JLabeljlabel=newJLabel("请输入你所选取的问题:");finalJComboBoxjcombobox=newJComboBox();JButtonjbutton=newJButton("确定");JPaneljpanel1=newJPanel(newGridLayout(2,1,0,4));JPaneljpanel2=newJPanel();add(jpanel1,BorderLayout。 NORTH);add(jpanel2,BorderLayout。SOUTH);jpanel1。add(jlabel,BorderLayout。NORTH);jpanel1。 add(jcombobox,BorderLayout。CENTER);jpanel2。add(jbutton);jcombobox。addItem("没方法开机");jcombobox。 addItem("没方法连接网络(互联网)");jcombobox。addItem("没方法关电脑");jbutton。addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){inti=jcombobox。 getSelectedIndex();StringresolveDesc="";switch(i){case0:resolveDesc="请检查电源是不是接好";break;case1:resolveDesc="请检查是不是是机箱静电";break;case2:resolveDesc="请检查硬件是不是有松动";break;default:resolveDesc="我也不知道要怎样弄才好啊。 。。";}dialog=newDialog(resolveDesc);}});}classDialogextendsJDialog{@SuppressWarnings("deprecation")Dialog(StringresolveDesc){setSize(350,200);setResizable(false);Dimensionscrsize=Toolkit。 getDefaultToolkit()。getScreenSize();setLocation((scrsize。width-250)/2,(scrsize。height-100)/2);JLabeljlabel=newJLabel("处理方法:"resolveDesc);JButtonjbutton=newJButton("好的,我去试试");JPaneljpanel1=newJPanel(newGridLayout(3,1,4,4));JPaneljpanel2=newJPanel();JPaneljpanel3=newJPanel();add(jpanel1,BorderLayout。 NORTH);add(jpanel2);add(jpanel3);jpanel1。add(jlabel);jpanel2。 add(jbutton);jpanel3。add(jbutton);jbutton。 addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){//newDialog2();}});show();}}publicstaticvoidmain(String[]args){newSolve();}}"。
阅读全文 >