Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 [求助]这个程序编译出错了
mitnickcbc





发贴: 165
积分: 60
于 2002-12-13 19:57 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
import java.awt.*;
import java.awt.event.*;

public class StickyPad implements ActionListener, WindowListener
{
  private Frame frm;
  private TextArea noteTA, responseTA;
  private Button submitBtn, leaveBtn, returnBtn;
  private String savedMessages;
  
  public StickyPad()
  {
    savedMessages = "";
    frm = new Frame("Sticky Pad");
    
    Panel centerPnl = new Panel();
    centerPnl.setLayout(new FlowLayout());
    
    noteTA = new TextArea(6, 40);
    //set the color of the text area to yellow
    noteTA.setBackground(Color.yellow);
    //set the font of the text area to a large 20 point font
    noteTA.setFont(new Font("Dialog", Font.PLAIN, 20));
    centerPnl.add(noteTA);
    
    responseTA = new TextArea(6, 40);
    //set the color of the text area to green
    responseTA.setBackground(Color.green);
    //set the font of the text area to a large 20 point font
    responseTA.setFont(new Font("Dialog", Font.PLAIN, 20));
    centerPnl.add(responseTA);
    
    Panel southPnl = new Panel();
    southPnl.setLayout(new FlowLayout());
    
    submitBtn = new Button("Submit");
    southPnl.add(submitBtn);
    submitBtn.addActionListener(this);
    submitBtn.setEnabled(false);
    
    leaveBtn = new Button("Leave");
    southPnl.add(leaveBtn);
    leaveBtn.addActionListener(this);
    
    returnBtn = new Button("Return");
    southPnl.add(returnBtn);
    returnBtn.addActionListener(this);
    returnBtn.setEnabled(false);
    
    frm.add(centerPnl, BorderLayout.CENTER);
    frm.add(southPnl, BorderLayout.SOUTH);
    
    frm.setSize(500, 420);
    frm.show();
    frm.addWindowListener(this);
  }//constructor
  public void windowClosing(ActionEvent e)
  {
    System.exit(0);
  }
  
  public void windowOpened(ActionEvent e) {}
  public void windowClosed(ActionEvent e) {}
  public void windowIconified(ActionEvent e) {}
  public void windowDeiconified(ActionEvent e) {}
  public void windowActivated(ActionEvent e) {}
  public void windowDeactivated(ActionEvent e) {}
  
  public void actionPerformed(ActionEvent e)
  {
    if (e.getActionCommand().equals("Leave"))
    {
      //Disable the outgoing text area so it can
      //not be changed and enable the response text
      //area and buttons
      noteTA.setEnabled(false);
      leaveBtn.setEnabled(false);
      returnBtn.setEnabled(true);
      submitBtn.setEnabled(true);
    }
    else if (e.getActionCommand().equals("Submit"))
    {
      //Save the message and clear the response text
      //area for the next visitor
      savedMessages += responseTA.getText() + "\n";
      responseTA.setText("");
    }
    else if (e.getActionCommand().equals("Return"))
    {
      //Disable the response text area and buttons and
      //display the save messages
      responseTA.setText(savedMessages);
      submitBtn.setEnabled(false);
      returnBtn.setEnabled(false);
    }
  }
  public static void main(String args[])
  {
    StickyPad sp = new StickyPad();
  }//main
}//class StickyPad

出错信息:
C:\j2sdk1.4.1_01\myprogram\StickyPad.java:4: StickyPad should be declared abstract; it does not define windowOpened(java.awt.event.WindowEvent) in StickyPad
public class StickyPad implements ActionListener, WindowListener
^
1 error

大虾帮忙!




话题树型展开
人气 标题 作者 字数 发贴时间
6627 [求助]这个程序编译出错了 mitnickcbc 3166 2002-12-13 19:57
5057 Re:[求助]这个程序编译出错了 Biubiu 382 2002-12-13 21:17
4957 Re:[求助]这个程序编译出错了 Biubiu 170 2002-12-13 21:21
5056 Re:[求助]这个程序编译出错了 mitnickcbc 9 2002-12-13 21:59
5326 Re:[求助]这个程序编译出错了 archonLing 316 2002-12-17 14:13

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923