你要先學會截圖哦,你發(fā)的看不清楚,重新寫了一個你參考參考!
10年積累的成都網(wǎng)站設(shè)計、成都做網(wǎng)站經(jīng)驗,可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認識你,你也不認識我。但先網(wǎng)站設(shè)計后付款的網(wǎng)站建設(shè)流程,更有常州免費網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
import java.awt.GridLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
public class Day30A extends JFrame {
private static final long serialVersionUID = 1L;
private JLabel labelName,labelId,labelPass,labelMoney,labelSelect,labelCar;
private JComboBoxString jcb;
private JPanel jp1,jp2,jp3,jp4,jp5,jp6,jp7;
private ButtonGroup btg;
private JRadioButton jr1,jr2;
Day30A(){
this.setTitle("注冊賬戶");
this.setLayout(new GridLayout(7,1));
this.setSize(300,280);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
init();
this.setVisible(true);
}
private void init() {
String str="卡片類型1,卡片類型2,卡片類型3,卡片類型4,卡片類型5";
jcb=new JComboBox(str.split(","));
labelId=new JLabel("賬號: ");
labelName=new JLabel("姓名: ");
labelPass=new JLabel("密碼: ");
labelMoney=new JLabel("開戶金額:");
labelSelect=new JLabel("存款類型:");
labelCar=new JLabel("卡片類型:");
addFun1();
addFun2();
}
private void addFun2() {
this.add(jp1);
this.add(jp2);
this.add(jp3);
this.add(jp4);
this.add(jp5);
this.add(jp6);
this.add(jp7);
}
private void addFun1() {
jp1=new JPanel();
jp1.add(labelId);
jp1.add(new JTextField(15));
jp2=new JPanel();
jp2.add(labelName);
jp2.add(new JTextField(15));
jp3=new JPanel();
jp3.add(labelPass);
jp3.add(new JTextField(15));
jp4=new JPanel();
jp4.add(labelMoney);
jp4.add(new JTextField(13));
jp5=new JPanel();
jp5.add(labelSelect);
btg=new ButtonGroup();
jr1=new JRadioButton("定期");
jr2=new JRadioButton("活期",true);
btg.add(jr1);
btg.add(jr2);
jp5.add(jr1);
jp5.add(jr2);
jp6=new JPanel();
jp6.add(labelCar);
jp6.add(jcb);
jp7=new JPanel();
jp7.add(new JButton("確定"));
jp7.add(new JButton("取消"));
}
public static void main(String[] args) {
new Day30A();
}
}
public class Use {
public static void main(String args[]){
User user1=new User();
user1.setUsername("joyce717533");
user1.setPassword("千總四級");
System.out.println("user1:"+user1.toString());
User user2=new User("joyce717533");
user2.setPassword("千總四級");
System.out.println("user2:"+user2.toString());
User user3=new User("joyce717533","千總四級");
System.out.println("user3:"+user3.toString());
}
}
class User {
public String username;
public String password;
public static int record;
public User() {
}
public User(String username){
this.username=username;
}
public User(String username,String password){
this.username=username;
this.password=password;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String toString(){
return "username: "+username+",passwrod: "+password;
}
}
已經(jīng)給樓主寫好了...祝樓主早日成功哈!!!!!
程序如下:
class User{
private String userName;
private String passWord;
private Role role;
public User(String userName, String passWord, Role role){
this.userName = userName;
this.passWord = passWord;
this.role = role;
}
public Role getRole() {
return role;
}
public String getUserName() {
return userName;
}
}
class Role{
private int roleId;
private String roleText;
private String users;
private Right rights;
public Role(int roleId, String roleText, String users, Right rights){
this.roleId = roleId;
this.roleText = roleText;
this.users = users;
this.rights = rights;
}
public int getRoleId() {
return roleId;
}
}
class Right{
private int rightId;
private String rightText;
private String roles;
public Right(int rightId, String rightText, String roles){
this.rightId =rightId;
this.rightText= rightText;
this.roles = roles;
}
}
public class Test {
public static void main(String[] args) {
Right rights = new Right(2013012701, "banana", "host");
Role role = new Role(20130127, "apple", "Zhang San", rights);
User user = new User("Zhang San", "zhangsan123", role);
System.out.println("The ID of user: " + user.getUserName() + "'s role is " + (user.getRole()).getRoleId());
}
}
當前標題:用戶類java代碼 java客戶端代碼
網(wǎng)站URL:http://jinyejixie.com/article30/dodoiso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動網(wǎng)站建設(shè)、手機網(wǎng)站建設(shè)、搜索引擎優(yōu)化、品牌網(wǎng)站建設(shè)、網(wǎng)站設(shè)計、動態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)