この記事では、参照用のJava Swing Imitation QQログインインターフェイスに表示される特定のコードを共有しています。特定のコンテンツは次のとおりです
以前に実装したQQログインインターフェイスを実行できますが、それは純粋に手作りです(つまり、NetBeansとMyEclipseのドラッグ関数は使用しません)。
ソースコードは次のとおりです。
パッケージibees.qq; java.awt.borderlayoutをインポートします。 java.net.urlをインポートします。 javax.swing.imageiconをインポートします。 javax.swing.jbuttonをインポートします。 javax.swing.jcheckboxをインポートします。 javax.swing.jcomboboxをインポートします。 javax.swing.jframeをインポートします。 javax.swing.jlabelをインポートします。 javax.swing.jpanelをインポートします。 javax.swing.jpasswordfieldをインポートします。 javax.swing.jtextfieldをインポートします。 / ** * Imitation QQログインインターフェイスは、参照のみを学習するために、ウィンドウセンター、JPANEL、およびLayOutManagerの使用を伴います * @Author HHZXJ2008 */ public class qqloginview {/ ** * */ private static final serialversionuid = -5665977770170821790753l; public qqloginview(){initcomponent(); } private void initComponent(){settitle( "user login"); //ロゴURLイメージを設定= qloginview.class.getClassLoader()。getResource( "ibees/qq/images/year.jpg"); add(imagelogo、borderlayout.north); // qq番号とパスワードjpanel jp = new JPanel(); jPanel jpaccount = new JPanel(); jpaccount.add(new Jlabel( "account")); jtextfield usertextfield = new jtextfield(15); jpaccount.add(usertextfield); jpaccount.add(new Jlabel( "ユーザー登録")); jp.add(jpaccount); jpanel jppass = new JPanel(); jppass.add(new Jlabel( "pass")); jPasswordfield passtextfield = new JPasswordfield(15); jppass.add(passtextfield); jppass.add(new Jlabel( "Passwordの取得")); jp.add(jppass); //ログイン設定jpanel jpstatus = new JPanel(); jpstatus.add(new Jlabel( "status")); jcombobox statuscombobox = new jcombobox(); statuscombobox.additem( "qi"); StatusComboBox.Additem( "オンライン"); statuscombobox.additem( "Invisible"); statuscombobox.additem( "offline"); jpstatus.add(statuscombobox); jpstatus.add(new jcheckbox( "remember password")); jpstatus.add(new JCheckbox( "Automatic Login")); jp.add(jpstatus); add(jp); //ボトムログインボタンjpanel bottompanel = new JPanel(); bottompanel.setlayout(new borderlayout()); bottompanel.add(new jbutton( "settings")、borderlayout.west); bottompanel.add(new jbutton( "login")、borderlayout.east); add(bottompanel、borderlayout.south); SetSize(324,230); setDefaultCloseoperation(exit_on_close); setLocationRelativeto(null); } / ** * @param args * / public static void main(string [] args){java.awt.eventqueue.invokelater(new runnable(){@override public void run(){new qloginview()。setVisible(true);}}); }}}効果:
上記はこの記事のすべての内容です。みんなの学習に役立つことを願っています。誰もがwulin.comをもっとサポートすることを願っています。