登录界面
:import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Enter_Interface {
public static void main(String args[]){
new EnterFrame(); }
}
@SuppressWarnings("serial")
class EnterFrame extends JFrame{
public EnterFrame(){
EnterPanel lp;
setTitle("Enter_Interface");
setSize(300,200);
setLocation(500,300);
setResizable(false);
lp=new EnterPanel(this);
this.getContentPane().add(lp);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}
@SuppressWarnings("serial")
class EnterPanel extends JPanel{
private JLabel namelable,pwdlable,titlelable;
private JButton enterbutton;
private JTextField namefield;
private JPasswordField pwdfield;
@SuppressWarnings("unused")
private JFrame iframe;
public EnterPanel(JFrame frame){
iframe=frame;
this.setLayout(null);
titlelable=new JLabel("登录界面");
titlelable.setFont(new Font("细黑",Font.BOLD,24));
namelable=new JLabel("用户 :");
namefield=new JTextField(16);
pwdlable=new JLabel("密码 :");
pwdfield=new JPasswordField(16);
pwdfield.setEchoChar('*');
enterbutton=new JButton("登录");
add(titlelable);
titlelable.setBounds(100,10,150,30);
add(namelable);
namelable.setBounds(40,60,80,25);
add(pwdlable);
pwdlable.setBounds(40,90,80,25);
add(namefield);
namefield.setBounds(90,60,150,25);
add(pwdfield);
pwdfield.setBounds(90,90,150,25);
add(enterbutton);
enterbutton.setBounds(110,140,80,25);
}
}
图(1—1)
账号密码输入错误提示窗口
:import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Error_Enter {
public static void main(String args[]){
new ErrorFrame();
}
}
@SuppressWarnings("serial")
class ErrorFrame extends JFrame{
public ErrorFrame(){
ErrorPanel lp;
setTitle("Error");
setSize(300,150);
setLocation(500,300);
setResizable(false);
lp=new ErrorPanel();
getContentPane().add(lp);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}
@SuppressWarnings("serial")
class ErrorPanel extends JPanel{
private JLabel errorlabel;
public ErrorPanel(){
setLayout(null);
errorlabel=new JLabel("您输入的账号或密码错误");
errorlabel.setFont(new Font("楷体",Font.BOLD,15));
add(errorlabel);
errorlabel.setBounds(62,40,200,25);
}
}
图(1—2)
数据库信息
:
java gui 点击转跳窗口 java实现页面跳转jframe
转载文章标签 java gui 点击转跳窗口 java中界面跳转的方法 java wdl 登录界面 文章分类 Java 后端开发