想问一下为什么运行会出现the selection cannot be launched and...?是我写的代码有错误吗?

Lselection 2016-11-05 11:03:57


哪位好心人能把我看一下,题目要求就是编写图片样式的一个面板,我感觉我写的挺正确的,在eclipse里也没报错,可就是运行不出来!!!
package ch003;

import java.awt.Dimension;
import java.awt.Font;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class Myframe extends JFrame{

JPanel PanelSouth,PanelCenter1,PanelCenter2,PanelNorth,Panellast;

JLabel NameLabel,FriuteLabel,eatfriute,GoodLabel,sexLabel;

JTextField TextInput;
JRadioButton manRadioButton,womenRadioButton;
JButton surebutton,concelbutton;
ButtonGroup buttongroup;
JCheckBox apple,juzi,xiangjiao,taozi;
JComboBox combobox;
JTextArea textarea;


public Myframe(){

this.setResizable(false);
this.setBounds(200, 200, 600, 600);
PanelNorth=new JPanel();
PanelNorth.setBounds(0, 0, 600, 150);
NameLabel=new JLabel("你的名字");

this.setLayout(null);


TextInput=new JTextField(10);
TextInput.setBounds(10,10,150, 80);
NameLabel.setBounds(170, 10, 50,50);
PanelNorth.add(NameLabel);
PanelNorth.add(TextInput);
sexLabel=new JLabel();
sexLabel.setText("性别");
sexLabel.setBounds(250, 10, 50, 50);
PanelNorth.add(sexLabel);
buttongroup=new ButtonGroup();
manRadioButton=new JRadioButton();

buttongroup.add(manRadioButton);
manRadioButton.setSelected(true);
PanelNorth.add(manRadioButton);
manRadioButton.setText("男");
manRadioButton.setBounds(350, 10, 50, 50);


womenRadioButton=new JRadioButton();
womenRadioButton.setSelected(true);
buttongroup.add(womenRadioButton);

womenRadioButton.setText("女");
womenRadioButton.setBounds(450, 10, 50, 50);
PanelNorth.add(womenRadioButton);



this.add(PanelNorth);



PanelCenter1.setBounds(0, 150, 600, 100);
FriuteLabel =new JLabel("你喜欢的水果");
PanelCenter1.add(FriuteLabel);


FriuteLabel.setBounds(10, 10, 80, 30);
PanelNorth.add(FriuteLabel);

final JCheckBox apple=new JCheckBox();
apple.setText("苹果");
apple.setBounds(90, 10, 30, 30);
PanelCenter1.add(apple);

final JCheckBox juzi=new JCheckBox();
juzi.setText("橘子");
juzi.setBounds(130, 10, 30, 30);
PanelCenter1.add(juzi);

final JCheckBox xiangjiao=new JCheckBox();
xiangjiao.setText("香蕉");
apple.setBounds(170, 10, 30, 30);
PanelCenter1.add(xiangjiao);
final JCheckBox taozi=new JCheckBox();
taozi.setText("桃子");
apple.setBounds(210, 10, 30, 30);
PanelCenter1.add(taozi);

eatfriute =new JLabel("你每次吃几个");
eatfriute.setBounds(250, 10, 100, 30);
PanelCenter1.add(eatfriute);
String[] count={"一个","两个","更多"};
combobox=new JComboBox(count);
combobox.setMaximumRowCount(3);
combobox.setSelectedItem("一个");
combobox.setBounds(290, 10, 50, 30);
PanelCenter1.add(combobox);

this.add(PanelCenter1);


PanelCenter2.setBounds(0, 250, 500, 100);
GoodLabel =new JLabel("你觉得吃水果有什么好处?");
GoodLabel.setBounds(0, 0, 400, 80);
PanelCenter2.add(GoodLabel);
this.add(PanelCenter2);




PanelSouth.setBounds(0, 350, 500, 200);
textarea=new JTextArea();
textarea.setColumns(16);
textarea.setRows(6);
textarea.setLineWrap(true);
final JScrollPane scrollpane=new JScrollPane();
scrollpane.setViewportView(textarea);
Dimension dime=textarea.getPreferredSize();
scrollpane.setBounds(0, 0, 450, 200);
surebutton=new JButton("确定");
surebutton.setBounds(460, 100, 40, 40);
PanelSouth.add(surebutton);
this.add(PanelSouth);

Panellast.setBounds(0, 550, 500, 50);
Panellast.setLayout(null);
concelbutton=new JButton("重置");
concelbutton.setBounds(200, 20, 40, 40);
Panellast.add(concelbutton);
this.add(Panellast);


this.setVisible(true);


}
}
...全文
1011 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_1773889494 2019-09-07
  • 打赏
  • 举报
回复
时隔3年 我来看看你
qq_1773889494 2019-09-07
  • 打赏
  • 举报
回复
没事 我来了
Lselection 2016-11-05
  • 打赏
  • 举报
回复
有人吗?大神在哪里?
Lselection 2016-11-05
  • 打赏
  • 举报
回复
就这么沉了么。。。。。。。

58,454

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧