JAVA编程中的问题 十万火急 !!!高手帮帮我吧!!! 5

源程序如下:为什么我用Jbuilder2006调试的时候会出现nointerfaceexpectedhereatline(29:36);这是为什么啊?高手帮帮我!!!pa... 源程序如下 :为什么我用Jbuilder2006 调试的时候会出现
no interface expected here at line (29:36);

这是为什么啊?高手帮帮我!!!

package myframe;

import java.awt.*;
import java.awt.event.*;

public class myframe {
public static void main(String[] args) {
Frame f=new Frame();
f.setTitle("my web") ;
f.setSize(400,400) ;
f.setLocation(400,400) ;
f.setBackground(Color.BLUE ) ;
f.setLayout(new GridLayout(3,2));
Button btn1=new Button("north");
Button btn2=new Button("south");
Button btn3=new Button("west");
Button btn4=new Button("east");
Button btn5=new Button("center");
f.add(btn1);
f.add(btn2);
f.add(btn3);
f.add(btn4);
f.add(btn5);
f.setVisible(true);

}
}
class MywindowListener extends WindowListener {
void windowOpened(WindowEvent e)
{

}
void windowClosing(WindowEvent e)
{

}
void windowClosed(WindowEvent e)
{

}
void windowIconified(WindowEvent e)
{

}
void windowDeiconified(WindowEvent e)
{

}
void windowDeactivated(WindowEvent e)
{

}

}
展开
 我来答
MBox
2006-10-23 · TA获得超过1282个赞
知道小有建树答主
回答量:423
采纳率:0%
帮助的人:632万
展开全部
WindowListener 是接口,不是类,实现接口不用是extends,要用implements,应该写成class MyWindowListener implements WindowListener,实现接口还有要实现这个接口中的所有方法。。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
webstar16
2006-10-25 · TA获得超过580个赞
知道小有建树答主
回答量:434
采纳率:100%
帮助的人:324万
展开全部
import java.awt.*;
import java.awt.event.*;
public class myframe extends Frame
{
public myframe()
{
this.addWindowListener(new MywindowListener());
Frame f=new Frame();
f.setTitle("my web") ;
f.setSize(400,400) ;
f.setLocation(400,400) ;
f.setBackground(Color.BLUE ) ;
f.setLayout(new GridLayout(3,2));
Button btn1=new Button("north");
Button btn2=new Button("south");
Button btn3=new Button("west");
Button btn4=new Button("east");
Button btn5=new Button("center");
f.add(btn1);
f.add(btn2);
f.add(btn3);
f.add(btn4);
f.add(btn5);
f.setVisible(true);
}
public static void main(String[] args)
{
new myframe();
}

class MywindowListener implements WindowListener {

public void windowActivated(WindowEvent e)
{
System.out.println("Window Activated");
}

public void windowClosed(WindowEvent e)
{
System.out.println("Window Closed");
System.exit(0);
}

public void windowClosing(WindowEvent e)
{
System.out.println("Window Closing....");
Window w=e.getWindow();
w.dispose();
}

public void windowDeactivated(WindowEvent e)
{
System.out.println("Window Deactivated");
}

public void windowDeiconified(WindowEvent e)
{
System.out.println("Window Deiconified");
}

public void windowIconified(WindowEvent e)
{
System.out.println("Window Iconified");
}

public void windowOpened(WindowEvent e)
{
System.out.println("Window Opened");
}
}
}
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
karenpeng123
2006-10-23 · TA获得超过710个赞
知道小有建树答主
回答量:564
采纳率:0%
帮助的人:407万
展开全部
line 29:36是哪行啊
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式