(出现Accessrestriction:Thetype'JButton'isnotAPI(restrictiononrequiredlibrary'C:\ProgramFiles\Java\jre1.8.0_60\lib\rt.jar')importjava.awt.*;importjava.awt.*;importjavax.sw...
(出现Access restriction: The type 'JButton' is not API (restriction on required library 'C:\Program Files\Java\jre1.8.0_60\lib\rt.jar')
import java.awt.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class student extends Frame {
public student(){
setTitle("登陆界面");
Panel p1 =new Panel();
Panel p2 =new Panel();
Button j =new Button("登陆");
Label l1 =new Label("用户名");
Label l2 =new Label("密码");
TextField t1 =new TextField(10);
TextField t2 =new TextField(10);
p1.add(l1);
p1.add(t1);
p2.add(l2);
p2.add(t2);
add(p1);
add(p2);
add(j);
setLayout(new GridLayout(3,1,3,3));
setVisible(true);
setBounds(300,200,300,200);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
dispose();
}
});
}
public static void main(String args[]){
new student();
}
}
展开