Java中Applet小程序的编写

发布网友 发布时间:2022-04-24 03:15

我来回答

5个回答

热心网友 时间:2023-10-24 06:34

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.");
}
}

热心网友 时间:2023-10-24 06:34

我写了一个
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();
}
}

热心网友 时间:2023-10-24 06:34

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.");
}
}

热心网友 时间:2023-10-24 06:34

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.");
}
}

热心网友 时间:2023-10-24 06:34

我写了一个
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();
}
}

热心网友 时间:2023-10-24 06:35

这发不过去啊!

热心网友 时间:2023-10-24 06:35

这发不过去啊!

热心网友 时间:2023-10-24 06:35

代码不多,要得话Call我

热心网友 时间:2023-10-24 06:35

代码不多,要得话Call我

热心网友 时间:2023-10-24 06:36

hsdsjdkasajska/idsidjasda.dasjakjshajh

热心网友 时间:2023-10-24 06:36

hsdsjdkasajska/idsidjasda.dasjakjshajh

热心网友 时间:2023-10-24 06:34

我写了一个
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();
}
}

热心网友 时间:2023-10-24 06:35

这发不过去啊!

热心网友 时间:2023-10-24 06:35

代码不多,要得话Call我

热心网友 时间:2023-10-24 06:36

hsdsjdkasajska/idsidjasda.dasjakjshajh

热心网友 时间:2023-10-24 06:34

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.");
}
}

热心网友 时间:2023-10-24 06:34

我写了一个
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();
}
}

热心网友 时间:2023-10-24 06:35

这发不过去啊!

热心网友 时间:2023-10-24 06:35

代码不多,要得话Call我

热心网友 时间:2023-10-24 06:36

hsdsjdkasajska/idsidjasda.dasjakjshajh

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com