用JAVA写一个制定单词表的小程序。 JList

2025-01-01 11:17:33
推荐回答(1个)
回答1:

import java.applet.Applet;
import java.awt.Color;
import java.awt.Label;
import javax.swing.*;
public class ApplicationTest extends Applet{
JList myList;
public void init(){
Label myLabel = new Label("单词表",Label.LEFT);
myLabel.setBackground(Color.blue);
add (myLabel);

String[] data = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"};
myList = new JList(data);

add (myList);
}
public void start(){

}
public void stop(){

}
public void destroy(){}

}