Java中Applet小程序的编写
完成下列的Applet:当用户单击“Buttonone”或“Buttontwo”,浏览器的状态栏显示"Oneofmybuttonswasclicked."信息。在下面给出...
完成下列的Applet:当用户单击“Button one” 或“Button two”,浏览器的状态栏显示"One of my buttons was clicked." 信息。
在下面给出的框架中填个空就成了~~
import java.awt.*;
import java.applet.*;
public class L07_D extends Applet {
public void init() {
Button two;
one = new Button("Button one");
add( );
}
public void actionPerformed(ActionEvent e) {
}
}
谢谢啊~~~ 展开
在下面给出的框架中填个空就成了~~
import java.awt.*;
import java.applet.*;
public class L07_D extends Applet {
public void init() {
Button two;
one = new Button("Button one");
add( );
}
public void actionPerformed(ActionEvent e) {
}
}
谢谢啊~~~ 展开
展开全部
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class L07_D extends Applet implements ActionListener{
public void init() {
Button one;
Button two;
one = new Button("Button one");
two = new Button("Button two");
add(one);add(two);
one.addActionListener(this);
two.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
showStatus("One of my buttons was clicked.");
}
}
import java.applet.*;
import java.awt.event.*;
public class L07_D extends Applet implements ActionListener{
public void init() {
Button one;
Button two;
one = new Button("Button one");
two = new Button("Button two");
add(one);add(two);
one.addActionListener(this);
two.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
showStatus("One of my buttons was clicked.");
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我写了一个
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.applet.*;
public class Body extends Applet implements ActionListener {
public void init() {
Button two = new Buttons("Button two", this);
Button one = new Buttons("Button one", this);
two.addActionListener(this);
one.addActionListener(this);
this.add(two);
this.add(one);
}
@Override
public void actionPerformed(ActionEvent e) {
Buttons c = (Buttons) e.getSource();
c.b.showStatus("One of the button is clicked");
}
class Buttons extends Button {
String name;
Body b;
Buttons(String name, Body a) {
super(name);
this.b = a;
}
}
public static void main(String[] args) {
Body b = new Body();
b.init();
}
}
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.applet.*;
public class Body extends Applet implements ActionListener {
public void init() {
Button two = new Buttons("Button two", this);
Button one = new Buttons("Button one", this);
two.addActionListener(this);
one.addActionListener(this);
this.add(two);
this.add(one);
}
@Override
public void actionPerformed(ActionEvent e) {
Buttons c = (Buttons) e.getSource();
c.b.showStatus("One of the button is clicked");
}
class Buttons extends Button {
String name;
Body b;
Buttons(String name, Body a) {
super(name);
this.b = a;
}
}
public static void main(String[] args) {
Body b = new Body();
b.init();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这发不过去啊!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
代码不多,要得话Call我
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
hsdsjdkasajska/idsidjasda.dasjakjshajh
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询