package com.imooc;//(报错一)import java.awt.FlowLayout;import java.awt.GridLayout;import javax.swing.JCheckBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.UIManager;public class LottoMadness extends JFrame {private static final long serialVersionUID = 1L;JPanel[] row=new JPanel[6];//创建组件JCheckBox[] check=new JCheckBox[2];JLabel quick=new JLabel("Quick");JLabel personal=new JLabel("Personal");public LottoMadness(){//创建外框super("Lotto Madness");setSize(600,400);setLookAndFeel();setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setVisible(true);//分配空间for(int i=0;i<6;i++){row[i]=new JPanel();}for(int i=0;i<2;i++){check[i]=new JCheckBox();}//添加组件,管理器GridLayout layout=new GridLayout(6,1,1,1);setLayout(layout);for(int i=0;i<6;i++){add(row[i]);//(报错二)}// FlowLayout layout0=new FlowLayout(FlowLayout.CENTER);}public void setLookAndFeel(){try{UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");}catch(Exception e){System.out.println("setLookAndFeel出错"+e);}}/*** @param args*/public static void main(String[] args) {// TODO Auto-generated method stubnew LottoMadness();}}
3 回答
炎炎设计
TA贡献1808条经验 获得超4个赞
我的myeclipse6.5也出现了这个问题,我是这样修改的,先装jdk-7u79-windows-x64,然后右击项目->Build Path->confidure Build Path->Java Build Path->Libraries->JRE System Library[Myexlipse 6.5]->Edit->Alternate JRE->Installed JRES->Add->Browse选择你新安装的jre地址就可以了,希望可以帮到你
添加回答
举报
0/150
提交
取消
