api 过时是什么问题
编译的时候出现api过时是什么意思,是指程序里用的语句在以前的某一版本里用到了,在某一版本开始后就不用了吗?程序代码:
import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPasswordField; import javax.swing.JTextField; public class Test26 { public static void main(String[] args) { final String userName = "abc"; final String passwrod = "123"; JFrame jFrame = new JFrame("登陆界面"); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); jFrame.setBounds(280, 280, 200, 150); jFrame.setResizable(false); jFrame.setLayout(null); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label1 = new JLabel("姓名"); label1.setBounds(10, 10, 100, 30); jFrame.add(label1); JLabel label2 = new JLabel("密码"); label2.setBounds(10, 40, 100, 30); jFrame.add(label2); final JTextField text1 = new JTextField(); text1.setBounds(50, 15, 130, 20); jFrame.add(text1); final JPasswordField text2 = new JPasswordField(); text2.setBounds(50, 45, 130, 20); jFrame.add(text2); JButton button = new JButton("Login"); button.setBounds(10, 75, 170, 40); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(userName.equals(text1.getText()) && passwrod.equals(text2.getText())) { JOptionPane.showMessageDialog(null, "登陆成功误", "提示", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null, "错误", "提示", JOptionPane.ERROR_MESSAGE); text1.setText(""); text2.setText(""); } } }); jFrame.add(button); jFrame.setVisible(true); } }