色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

如何用java程序構造以下圖形用戶界面

榮姿康2年前24瀏覽0評論

如何用java程序構造以下圖形用戶界面?

我寫了swing版的和web版的,可以根據實際情況使用,希望能幫到你:swing版:package com.tarena.elts.ui;import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;import javax.swing.border.EmptyBorder;public class LoginFrame extends JFrame { public LoginFrame() { init(); } /** * 初始化用戶界面,在構造時調用該方法 * */ private void init() { // 調用父類的方法是設置窗口的標題的大小 setTitle("歡迎登錄考試系統"); setSize(300, 188); // 設置該窗口的面板(Pane) setContentPane(createContentPane()); // 取消系統默認的關閉窗口操作 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); // 設置Window監聽器用于監聽用戶的關閉窗口操作 addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { // TODO 關閉該窗口時的操作 } }); } /** * 返回一個窗口上的主Pane init方法中會調用 * * @return */ private JPanel createContentPane() { // 實例化一個基于BorderLayout布局的Panel JPanel p = new JPanel(new BorderLayout()); p.setBorder(new EmptyBorder(8, 8, 8, 8)); p.add(BorderLayout.NORTH, new JLabel("登錄系統", JLabel.CENTER)); p.add(BorderLayout.CENTER, createCenterPane()); p.add(BorderLayout.SOUTH, createBtnPane()); return p; } /** * 返回主Pane上的中間位置的Panel * @return */ private JPanel createCenterPane() { JPanel p = new JPanel(new BorderLayout()); p.setBorder(new EmptyBorder(6, 6, 6, 6)); p.add(BorderLayout.NORTH, createIdPwdPane()); return p; } /** * 返回主Pane上的底部按鈕的Panel * @return */ private JPanel createBtnPane() { JPanel p = new JPanel(new FlowLayout()); JButton login = new JButton("登錄"); JButton cancel = new JButton("取消"); p.add(login); p.add(cancel); login.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO .... } }); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO ... } }); return p; } private JPanel createIdPwdPane() { JPanel p = new JPanel(new GridLayout(2, 1, 0, 6)); p.add(createIdPane()); p.add(createPwdPane()); return p; } private JPanel createIdPane() { JPanel p = new JPanel(new BorderLayout()); p.add(BorderLayout.WEST, new JLabel("編號:")); JTextField idField = new JTextField(); p.add(BorderLayout.CENTER, idField); return p; } private JPanel createPwdPane() { JPanel p = new JPanel(new BorderLayout()); p.add(BorderLayout.WEST, new JLabel("密碼:")); JPasswordField pwdField = new JPasswordField(); pwdField.enableInputMethods(true); p.add(BorderLayout.CENTER, pwdField); return p; }}web版:<%@page pageEncoding="utf-8" contentType="text/html;charset=utf-8" %><html> <head> <style> </style> </head> <body style="font-size:30px;"> <form action="login.do" method="post"> <fieldset> <legend>登錄</legend> 用戶名:<input name="username"/> 密碼:<input type="password" name="pwd"/><br/> <input type="submit" value="確定"/> </fieldset> </form> </body></html>

java 圖形,如何用java程序構造以下圖形用戶界面