1_3_231164288张成伟.zip
大小:7.62KB
价格:11积分
下载量:0
评分:
5.0
上传者:2401_87328114
更新日期:2024-09-23

1_3_231164288张成伟.zip

资源文件列表(大概)

文件名
大小
231164288张成伟/
-
231164288张成伟/.idea/
-
231164288张成伟/.idea/.gitignore
190B
231164288张成伟/.idea/misc.xml
278B
231164288张成伟/.idea/modules.xml
267B
231164288张成伟/out/
-
231164288张成伟/out/production/
-
231164288张成伟/out/production/untitledwe/
-
231164288张成伟/out/production/untitledwe/Main.class
516B
231164288张成伟/out/production/untitledwe/xdfg/
-
231164288张成伟/out/production/untitledwe/xdfg/LoginForm.class
3.54KB
231164288张成伟/src/
-
231164288张成伟/src/Main.java
116B
231164288张成伟/src/xdfg/
-
231164288张成伟/src/xdfg/LoginForm.java
2.18KB

资源内容介绍

1_3_231164288张成伟.zip
package xdfg;import javax.swing.*;import java.awt.*;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import javax.imageio.ImageIO;public class LoginForm extends JFrame { public LoginForm() { try { setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icon.png"))); setTitle("登录页面 - [示例应用]"); } catch (Exception e) { e.printStackTrace(); } setLocationRelativeTo(null); setSize(300, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); try { BufferedImage img = ImageIO.read(new File("background.jpg")); JLabel backgroundLabel = new JLabel(new ImageIcon(img)); add(backgroundLabel); setContentPane(backgroundLabel); setLayout(new FlowLayout()); } catch (IOException e) { e.printStackTrace(); } JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new GridLayout(3, 2)); JLabel usernameLabel = new JLabel("用户名:"); usernameLabel.setFont(new Font("宋体", Font.PLAIN, 14)); usernameLabel.setBackground(Color.CYAN); usernameLabel.setOpaque(true); JTextField usernameField = new JTextField(); JLabel passwordLabel = new JLabel("密码:"); passwordLabel.setFont(new Font("宋体", Font.PLAIN, 14)); passwordLabel.setBackground(Color.CYAN); passwordLabel.setOpaque(true); JPasswordField passwordField = new JPasswordField(); JButton loginButton = new JButton("登录"); JButton cancelButton = new JButton("取消"); panel.add(usernameLabel); panel.add(usernameField); panel.add(passwordLabel); panel.add(passwordField); panel.add(loginButton); panel.add(cancelButton); add(panel); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> { LoginForm loginForm = new LoginForm(); loginForm.setVisible(true); }); }}

用户评论 (0)

发表评论

captcha