【单选按钮选中事件】JFrame中单选按钮事件控制jtable显示不同的列当radiobutton1选中...
答案:2 悬赏:40 手机版
解决时间 2021-02-16 16:16
- 提问者网友:练爱
- 2021-02-15 22:02
【单选按钮选中事件】JFrame中单选按钮事件控制jtable显示不同的列当radiobutton1选中...
最佳答案
- 五星知识达人网友:狂恋
- 2021-02-15 23:00
【答案】 import java.awt.Container;
import java.awt.FileDialog;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
public class FrameWork extends JFrame{
FrameWork1 fw = new FrameWork1();
JRadioButton jr1 = new JRadioButton(hello1);
JRadioButton jr2 = new JRadioButton(hello2);
public FrameWork() {
this.setName(Log Tools);
this.setSize(295, 260);
final Container con = getContentPane();
con.setLayout(null);
ButtonGroup myrou= new ButtonGroup();
jr1.setBounds(5, 5, 100, 30);
jr2.setBounds(5, 45, 100, 30);
myrou.add(jr1);
myrou.add(jr2);
this.add(jr1);
this.add(jr2);
//myrou.
jr1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
if(arg0.getSource()==jr1){
jr2.setText(hello2222);
}
}
});
//jr1.addItemListener();
///jr2.addItemListener(this.myli1());
this.setVisible(true);
this.repaint();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[]) {
FrameWork fw = new FrameWork();
}
}
import java.awt.FileDialog;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
public class FrameWork extends JFrame{
FrameWork1 fw = new FrameWork1();
JRadioButton jr1 = new JRadioButton(hello1);
JRadioButton jr2 = new JRadioButton(hello2);
public FrameWork() {
this.setName(Log Tools);
this.setSize(295, 260);
final Container con = getContentPane();
con.setLayout(null);
ButtonGroup myrou= new ButtonGroup();
jr1.setBounds(5, 5, 100, 30);
jr2.setBounds(5, 45, 100, 30);
myrou.add(jr1);
myrou.add(jr2);
this.add(jr1);
this.add(jr2);
//myrou.
jr1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
if(arg0.getSource()==jr1){
jr2.setText(hello2222);
}
}
});
//jr1.addItemListener();
///jr2.addItemListener(this.myli1());
this.setVisible(true);
this.repaint();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[]) {
FrameWork fw = new FrameWork();
}
}
全部回答
- 1楼网友:慢性怪人
- 2021-02-15 23:11
和我的回答一样,看来我也对了
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯