80分求JAVA高手。
来源:百度知道 编辑:UC知道 时间:2024/06/04 07:12:31
匆忙,界面写的简单
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Mconversion extends JFrame implements ActionListener {
private JTextField f1;
private JTextField f2;
private JRadioButton binary, octal, hexadecimal;
private ButtonGroup radioGroup;
private int n = 0;
public Mconversion() {
super("进制转换");
Container c = getContentPane();
c.setLayout(new FlowLayout());
f1 = new JTextField("输入:", 20);
f2 = new JTextField("输出:", 20);
f1.addActionListener(this);
f2.addActionListener(this);
binary = new JRadioButton("二进制", false);
octal = new JRadioButton("八进制", false);
hexadecimal = new JRadioButton("十六进制", false);
binary.addItemListener(new RadioButtonHandler(2));
octal.addItemListener(new RadioButtonHandler(