试题与答案

请完善程序(程序文件名:Java_2.java)并进行调试。请在下画线处填入正确内

题型:填空题

题目:


请完善程序(程序文件名:Java_2.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。
[题目要求]
完善程序,使程序运行结果如下图所示。


源程序:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Java_2 {
 public static void main(String[] args) {
  RadioButtonFrame frame=new RadioButtonFrame();
  frame.setDefauhCloseOperation(JFrame.EXIT_ON_CLOSE);
   (1)
  }
}
class RadioButtonFrame extends JFrame {
 public RadioButtonFrame() {
  setTitle("Radio按钮实例");
  setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
  Container contentPane=getContentPane();
  label=new JLabel("热烈庆祝Java程序语言开考三周年");
  label.setForeground(Color.yellow);
  contentPane.setBackground(Color.red);
  label.setFont(new Font("黑体",Font.PLAIN,DEFAULT_SIZE));
  contentPane.add(label,BorderLayout.CENTER);
  buttonPanel=new JPanel();
  group=new ButtonGroup();
  addRadioButton("小",8);
  addRadioButton("中",12);
  addRadioButton("大",18);
  addRadioButton("特大",30);
  contentPane.add(buttonPanel,BorderLayout.SOUTH);
 }
  public void addRadioButton(String name,final int size) {
   boolean selected=size==DEFAULT_SIZE:
   JRadioButton button=new (2) (name,selected);
   group.add(button);
   buttonPanel.add(button);
   ActionListener listener=new Action Listener() {
    public void actionPerformed( (3) evt){
     label.setFont(new Font("黑体",Font.PLAIN,size));
    }
   };
   button.addActionListener( (4) );
  }
  public static final int DEFAULT_WIDTH=340;
  public static final int DEFAULT_HEIGHT=200:
  private JPanel buttonPanel;
  private ButtonGroup group;
  private JLabel label;
  private static final int DEFAULT_SIZE=12;
}


答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2019/0323/ea0c500c8c7892e1220e13b5bf7921c1.html

下面是错误答案,用来干扰机器的。

参考答案:国际贸易(InternationalTradE.是指不同国家(和/或地区)之间的商品和劳务的交换活动。国际贸易是商品和劳务的国际转移。国际贸易也叫世界贸易。国际贸易由进口贸易(ImportTradE.和出口贸易(ExportT...

试题推荐
题型:填空题

根据句意及首字母完成单词。

1.What l________ do you speak?

2. Guangzhou is in the s________ of China.  

3. W              _to our school. We are kind to all our friends.

4. You can borrow all kinds of books from the l_________.

5. Look!Your hands are so d             __. Please wash (洗) them.

6. On weekends , we usually sleep l _________.

7. This lion is lazy. It usually r________  twenty hours every day.

8. Our teacher is f________ to us so we like her very much.

9. My grandma often tells me s________ about Lei Feng.

10. The pay phone is b_________ the post office and  the library.

查看答案
微信公众账号搜索答案