| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 694 人关注过本帖
标题:谁能凋试一下
只看楼主 加入收藏
大嘴先生2
Rank: 1
等 级:新手上路
威 望:2
帖 子:815
专家分:0
注 册:2006-4-17
收藏
 问题点数:0 回复次数:3 
谁能凋试一下
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class RadioButton extends JFrame implements ItemListener
{
JLabel label;
JRadioButton eastButton;
JRadioButton southButton;
JRadioButton westButton;
JRadioButton northButton;
JPanel panel;
RadioButon(String s)
{
super(s);
panel=new JPanel();
eastButton=new JRadioButton("EAST");
southButton=new JRadioButton("SOUTH");
westButton=new JRadioButton("WEST");
northButton=new JRadioButton("NORTH");
ButtonGroup group=new ButtonGroup();
group.add(eastButton);
group.add(southButton);
group.add(westButton);
group.add(northButton);
Container con=getContentPane();
con.add(label);
con.add(panel,BorderLayout.SOUTH);
panel.add(eastButton);
panel.add(southButton);
panel.add(westButton);
panel.add(northButton);
eastButton.addItemListener(this);
southButton.addItemListener(this);
westButton.addItemListener(this);
northButton.addItemListener(this);
label=new JLabel("you choose:");
setSize(300,200);
setVisible(true);
}
public void itemStateChanged(ItemEvent e)
{
if(e.getItemSelectLable()==eastButton)
label.setText("you choosed EAST");
if(e.getItemSelectLable()==southButton)
label.setText("you choosed SOUTH");
if(e.getItemSelectLable()==westButton)
label.setText("you choosed WEST");
if(e.getItemSelectLable()==northButton)
label.setText("you choosed NORTH");
}
}
public class Bh35
{
public static void main(String args[])
{
RadioButon a=new RadioButon("小程序");
a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
搜索更多相关主题的帖子: JRadioButton import awt java panel 
2006-07-06 22:55
hujf_go
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2006-5-13
收藏
得分:0 

天未塌,我还在,就让风雨迎面来~
2006-07-07 07:50
hellboy
Rank: 1
等 级:新手上路
威 望:1
帖 子:245
专家分:0
注 册:2006-6-24
收藏
得分:0 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class RadioButton extends JFrame implements ItemListener
{
JLabel label;
JRadioButton eastButton;
JRadioButton southButton;
JRadioButton westButton;
JRadioButton northButton;
JPanel panel;
RadioButton(String s)
{
super(s);
panel=new JPanel();
eastButton=new JRadioButton("EAST");
southButton=new JRadioButton("SOUTH");
westButton=new JRadioButton("WEST");
northButton=new JRadioButton("NORTH");
label=new JLabel();
ButtonGroup group=new ButtonGroup();
group.add(eastButton);
group.add(southButton);
group.add(westButton);
group.add(northButton);
Container con=getContentPane();
con.add(label);
con.add(panel,BorderLayout.SOUTH);
panel.add(eastButton);
panel.add(southButton);
panel.add(westButton);
panel.add(northButton);
eastButton.addItemListener(this);
southButton.addItemListener(this);
westButton.addItemListener(this);
northButton.addItemListener(this);
label=new JLabel("you choose:");
setSize(300,200);
setVisible(true);
}
public void itemStateChanged(ItemEvent e)
{

if(e.getSource()==eastButton)
label.setText("you choosed EAST");
if(e.getSource()==southButton)
label.setText("you choosed SOUTH");
if(e.getSource()==westButton)
label.setText("you choosed WEST");
if(e.getSource()==northButton)
label.setText("you choosed NORTH");
}
}
public class Bh35
{
public static void main(String args[])
{
RadioButton a=new RadioButton("小程序");
a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}改过了 你自己看看吧

努力 努力 !!!!!!
2006-07-07 23:52
huangcx
Rank: 1
等 级:新手上路
帖 子:64
专家分:0
注 册:2006-5-26
收藏
得分:0 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class RadioButton extends JFrame implements ItemListener
{
JLabel label;
JRadioButton eastButton;
JRadioButton southButton;
JRadioButton westButton;
JRadioButton northButton;
JPanel panel;
RadioButton(String s)//这里名字要写对
{
super(s);
panel=new JPanel();
eastButton=new JRadioButton("EAST");
southButton=new JRadioButton("SOUTH");
westButton=new JRadioButton("WEST");
northButton=new JRadioButton("NORTH");
label=new JLabel("you choose:");
ButtonGroup group=new ButtonGroup();
group.add(eastButton);
group.add(southButton);
group.add(westButton);
group.add(northButton);
Container con=getContentPane();
con.add(label);
con.add(panel,BorderLayout.SOUTH);
panel.add(eastButton);
panel.add(southButton);
panel.add(westButton);
panel.add(northButton);
eastButton.addItemListener(this);
southButton.addItemListener(this);
westButton.addItemListener(this);
northButton.addItemListener(this);

setSize(300,200);
setVisible(true);
}
public void itemStateChanged(ItemEvent e)
{

if(e.getSource()==eastButton)
label.setText("you choosed EAST");
if(e.getSource()==southButton)
label.setText("you choosed SOUTH");
if(e.getSource()==westButton)
label.setText("you choosed WEST");
if(e.getSource()==northButton)
label.setText("you choosed NORTH");
}
}
public class Bh35
{
public static void main(String args[])
{
RadioButton a=new RadioButton("小程序");
a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
改了这些,自己好好看看吧

以我平凡的天分和不平凡的毅力,可完成所有事!
2006-07-12 00:39
快速回复:谁能凋试一下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025022 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved