java 登陸視窗的實現

來源:互聯網
上載者:User

標籤:public   使用者名稱   frame   null   import   

import javax.swing.*;/** * Created by Administrator on 2015/4/13 0013. * <p> * 組件的絕對位置  :  使用的是  Compontent  類中的setBounds  方法 * <p> * <p> * setBounds x y  表示組件的位置   width height   組件的寬高 */public class chap15_10 {    public static void main(String[] args) {        JFrame frame = new JFrame("登陸視窗");        frame.setLayout(null);        JLabel lbLogin = new JLabel("使用者名稱");        JTextField textLogin = new JTextField();        JLabel lbPassword = new JLabel("密碼");        JTextField textPassword = new JTextField();        JButton btnCon = new JButton("串連");        JButton btnExit = new JButton("退出");        JButton btnPro = new JButton("屬性");        //容器的大小位置定義        frame.setSize(400, 200);        frame.setLocation(300, 200);        //使用者名稱   和輸入框 的定位        lbLogin.setBounds(45,5,50,20);        textLogin.setBounds(100, 5, 210, 20);        lbPassword.setBounds(45, 35, 50, 20);        textPassword.setBounds(100, 35, 210, 20);        btnCon.setBounds(45, 100, 80, 20);        btnExit.setBounds(130, 100, 80, 20);        btnPro.setBounds(220, 100, 80, 20);        frame.add(lbLogin);        frame.add(textLogin);        frame.add(lbPassword);        frame.add(textPassword);        frame.add(btnCon);        frame.add(btnExit);        frame.add(btnPro);        frame.setVisible(true);    }}


實現的為:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/6B/5F/wKiom1UryMbzHoAuAACGOOjBy84302.jpg" title="捕獲.PNG" alt="wKiom1UryMbzHoAuAACGOOjBy84302.jpg" />



本文出自 “會搬磚的猴子” 部落格,請務必保留此出處http://silianbo.blog.51cto.com/6627757/1632018

java   登陸視窗的實現

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.