Java EE SWT 注册界面

本文档展示了如何使用Java EE和SWT库创建一个用户注册界面。通过FormLayoutGUI类,详细说明了界面元素如文本框、复选框、下拉列表等的布局和交互,包括输入验证和事件监听。
摘要由CSDN通过智能技术生成

FormLayoutGUI.Java

package com.demo.layout;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

import com.util.SWTUtil;

public class FormLayoutGUI {
 public static final int  H_GAP = 20;
 private Shell shell;
 private FormLayout layout;
 private Label lab_title;
 private FormData data;
 private Label lab_username;
 private Text txt_username;
 private Label lab_username_info;
 private Label lab_password;
 private Text txt_password;
 private Label lab_password_info;
 private Text txt_reppassword;
 private Label lab_reppassword;
 private Label lab_reppassword_info;
 private Label lab_sex;
 private Button but_sex_male;
 private Label lab_sex_male;
 private Button but_sex_female;
 private Label lab_sex_female;
 private Label lab_country;
 private Combo com_country;
 private Label lab_province;
 private Combo com_province;
 private Label lab_interest;
 private Button but_interest_dance;
 private Button but_interest_music;
 private Button but_interest_swim;
 private Button but_interest_read;
 private Label lab_intro;
 private Text txt_intro;
 private Button but_reg;
 
 public void init(){
  shell = SWTUtil.getShell();
  shell.setText("用户注册");
  shell.setSize(500, 620);
  
  //定义布局管理器,并设置窗口的内边距
  layout = new FormLayout();
  layout.marginWidth = 20;
  layout.marginHeight = 20;
  shell.setLayout(layout);
  //标题Label
  lab_title = new Label(shell,SWT.NONE);
  lab_title.setText("用户注册");
  lab_title.setFont(new Font(null,"隶书",24,SWT.NONE));
  lab_title.setForeground(new Color(null,200,100,0));
  data = new FormData();
  data.top = new FormAttachment(2,0);
  data.left =

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值