以圖片為背景 的登陸介面

來源:互聯網
上載者:User
//以圖片為背景 的登陸介面import java.awt.*;import javax.swing.*;public class Image extends JFrame {private JLabel jlable1, jlable2, jlable3;private JTextField jtext1, jtext2;private JButton jbutton1, jbutton2;private ImageIcon ico;private JLayeredPane lay;private JPanel jpan1;public Image() {setBounds(300, 200, 300, 250);jlable1 = new JLabel("使用者名稱:");jlable2 = new JLabel("密碼:");jtext1 = new JTextField(20);jtext2 = new JTextField(20);jbutton1 = new JButton("登陸");jpan1 = new JPanel();jpan1.setLayout(null);jpan1.add(jlable1);jlable1.setBounds(30, 40, 50, 20);jpan1.add(jtext1);jtext1.setBounds(80, 40, 150, 20);jpan1.add(jlable2);jlable2.setBounds(30, 80, 50, 20);jpan1.add(jtext2);jtext2.setBounds(80, 80, 150, 20);jpan1.add(jbutton1);jbutton1.setBounds(80, 150, 100, 30);ico = new ImageIcon("images/1.jpg");jlable3 = new JLabel(ico);jlable3.setBounds(0, 0, ico.getIconWidth(), ico.getIconHeight());this.getLayeredPane().setLayout(null);this.getLayeredPane().add(jlable3, new Integer(Integer.MIN_VALUE));this.setContentPane(jpan1);jpan1.setOpaque(false);}public static void main(String args[]) {new Image().setVisible(true);}}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.