文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 资格考试/认证 > IT认证 > 全国计算机等级考试二级Java上机真题南开一百题
侵权投诉

全国计算机等级考试二级Java上机真题南开一百题

}

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;

//*********Found**********

JRadioButton button = new ____________________(name, selected);

group.add(button);

buttonPanel.add(button);

ActionListener listener = new

ActionListener(){

//*********Found**********

public void actionPerformed(_____________________ evt){

label.setFont(new Font("黑体", Font.PLAIN, size));

}

};

//*********Found**********

button.addActionListener(__________________);

}

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;

}

解题思路:

Java程序修改如下:

上一页第20页

你可能喜欢

  • 考试二级JAVA真题及答案
  • 模电期末考试试题及答案
  • 全国计算机等级考试二级c++题库
  • 全国计算机等级考试二级C++

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email