来源:蜘蛛抓取(WebSpider)
时间:2016-06-01 06:00
标签:
tpo34独立写作题目
安徽农业大学JAVA试题 (6)_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
安徽农业大学JAVA试题 (6)
上传于||文档简介
&&J​A​V​A​考​试
阅读已结束,如果下载本文需要使用2下载券
想免费下载本文?
下载文档到电脑,查找使用更方便
还剩6页未读,继续阅读
你可能喜欢求一道java用户界面设计题的代码_百度知道
求一道java用户界面设计题的代码
com/zhidao/pic/item//zhidao/wh%3D450%2C600/sign=b5f97d190abf5a1e473817d/cadd547de6e0f2d409b3de9d824896;
来自团队:
其他类似问题
为您推荐:
其他2条回答
&import&& .setBounds(150;&import&area.ActionEvent.setBounds(500;import&ActionListener()&ActionListener() .append(&&import&&&import&void&&&&&)!&300).75;{&30);).EXIT_ON_CLOSE); .JScrollP\n& .static&10;&clearButton=new&{& .addActionListener(new&&JButton&& ,& ,&&e)&JPanel .jf=new&actionPerformed(ActionEvent&}& .ActionL);&200;&JFrame .{ , .JBJPanel(null);static&&});import&&public& .setResizable(false).setDefaultCloseOperation(JFjavax.setBounds(10;con=new .swing.JF+&} ,& ,&&&JButton&&&e)&& ,& .&&&JTextArea();&&&&jp=new .add(clearButton); .JPargs)&&&& .setVisible(true);&clearButton.swing.add(jp);clearBHJButton(&clear&public&Multilistener".JTextA&&public .setBounds(70;&&area,&main(String[]&class&&&220;Demo{&&void&&private&200);JTextArea&&&&);Hpublic&&220;&void&&&helloButton=new&actionPerformed(ActionEvent&75;{&&JScrollPane&&JFrame();&& .add(helloButton)import&&@Override&& ,&&}); .setText("!".add(con);&&new&&@Override&&&);&&30);JScrollPane(area);=&JButton(&&helloB&java, ,&300;{ .addActionListener(new&& ,&area&280; .setLineWrap(true),&&&con.helloButton.setTitle("
竟然还是英文的,稍等。
很简单 就是一个界面 点击按钮显示hello
import java.awt.BorderL import java.awt.F import java.awt.event.*; import javax.swing.*; public class SayHello extends JFrame {
public static void main(String[] args) {
new SayHello(&SayHello&).display();;
public void display(){
setVisible(true);
private JL
private JTextArea textA
private JB
private JB
private JScrollPane scrollP
public SayHello(String title){
super(title);
initLabel();
initTextArea();
initButton();
initListener();
private void init(){
setResizable(false);
setSize(400, 350);
setDefaultCloseOperation(EXIT_ON_CLOSE);
private void initLabel(){
label = new JLabel(&you have clicked & + times +& times&,JLabel.CENTER);
add(label, BorderLayout.NORTH);
private void initTextArea(){
textArea = new JTextArea();
textArea.setFont(new Font(Font.SERIF, Font.PLAIN, 18));
scrollPane = new JScrollPane(textArea);
scrollPane.setAutoscrolls(true);
add(scrollPane, BorderLayout.CENTER);
private void initButton(){
hello = new JButton(&Hello!&);
clear = new JButton(&Clear&);
JPanel pan = new JPanel();
pan.add(hello);
pan.add(clear);
add(pan, BorderLayout.SOUTH);
private void initListener(){
hello.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(times & 0)
textArea.append(&\n&);
textArea.append(&Hello!&);
updateTimes(times);
clear.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
textArea.setText(&&);
times = 0;
updateTimes(times);
private void updateTimes(int times){
label.setText(&you have clicked & + times +& times&);
用户界面设计的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁