⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemsetdialog.java

📁 一个简单的图书馆的管理系统,该系统主要是针对学校的图书馆而做的
💻 JAVA
字号:
package librarymanagement.view.dialog;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.util.Iterator;
import java.util.Vector;

import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import librarymanagement.action.dialogAction.LibraryInfoSetAction;
import librarymanagement.dao.libraryinfodao.LibraryInfoDao;
import librarymanagement.view.common.Appreance;
import librarymanagement.view.common.ButtonCommon;
import librarymanagement.view.common.CenterLoction;
import librarymanagement.vo.LibraryInfoVo;

/**
 * 构建系统设置弹出对话框
 * 
 * @author 虎兴龙
 * 
 */
public class SystemSetDialog extends JDialog {
	private JPanel basePanel, panel1, panel2, panel3, panel4;
	private JLabel libraryName, address, mail, tel, sponsorMan, faJinPerDay,
			yajinBeiShu,borrow_date,re_borrow_date;
	private JTextField libraryNameTxt, addressTxt, mailTxt, telTxt,
			faJinPerDayTxt, numLimitTxt,sponserManTxt,borrow_dateTxt,re_borrow_dateTxt;
	private JRadioButton bookIdBtn, readerIdBtn;


	public SystemSetDialog() {
		super();
		this.setTitle("书馆信息设置");
		initThisDialog();
	}
  private void initThisDialog() {
	  this.setSize(500,350);
	  this.setLayout(new BorderLayout());
	this.add(buildInfoPanel(),"North");
	 this.add(buildBtnPanel(),"Center");
	}
  public JPanel buildInfoPanel(){
	  JPanel p = new JPanel(new GridLayout(4,4,2,30));
	  initJTextField();
	  initJLabel();
	  p.add(libraryName);
	  p.add(libraryNameTxt);
	  
	  p.add(address);
	  p.add(addressTxt);
	  
	  p.add(mail);
	  p.add(mailTxt);
	  
	  p.add(tel);
	  p.add(telTxt);
	  
	  p.add(sponsorMan);
	  p.add(sponserManTxt);
	  
	  p.add(faJinPerDay);
	  p.add(faJinPerDayTxt);
	  
	  p.add(borrow_date);
	  p.add(borrow_dateTxt);
	  p.add(re_borrow_date);
	  p.add(re_borrow_dateTxt);
	  
	  JPanel p2 = new JPanel();
	  p2.add(yajinBeiShu);
	  p2.add(numLimitTxt);
	  this.add(p2);
	 return p;
  }
   
  private JPanel buildBtnPanel(){
	  JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER,50,50));
	  Icon i1 = new ImageIcon("img/dialogimg/保存.jpg");
	  Icon i2 = new ImageIcon("img/dialogimg/取消.jpg");
		  p.add(buildBtn("提交",i1));
		  p.add(buildBtn("取消",i2));
		  return p;
	  
  }
public static void main(String[] args) {
	new SystemSetDialog().setVisible(true);
}
 
	/**
	 * 初始化各个Textfield
	 */
	private void initJTextField() {
		LibraryInfoDao dao = new LibraryInfoDao();
		Vector v = dao.selectLibraryInfo();
		Iterator iter = v.iterator();
		while(iter.hasNext()){
			LibraryInfoVo value = (LibraryInfoVo)iter.next();
			
		libraryNameTxt = new JTextField(15);
		libraryNameTxt.setText(value.getName());
		
		addressTxt = new JTextField(15);
		addressTxt.setText(value.getAddress());
		
		mailTxt = new JTextField(15);
		mailTxt.setText(value.getMail());
		
		telTxt = new JTextField(15);
		telTxt.setText(value.getTel());
		
		faJinPerDayTxt = new JTextField(15);
		faJinPerDayTxt.setText(String.valueOf(value.getFajinPerDay()));
		
		numLimitTxt = new JTextField(15);
		numLimitTxt.setText(String.valueOf(value.getNum_limit()));
		
		sponserManTxt = new JTextField(15);
		sponserManTxt.setText(value.getSponsorMan());
		
		borrow_dateTxt = new JTextField(15);	
		borrow_dateTxt.setText(String.valueOf(value.getDate_limit()));
		
		re_borrow_dateTxt = new JTextField(15);
		re_borrow_dateTxt.setText(String.valueOf(value.getReborrow_date()));
		}
	}

	/**
	 * 初始化各个标签JLabel
	 */
	private void initJLabel() {
		libraryName = new JLabel("图书馆名:");
		address = new JLabel("书馆地址:");
		mail = new JLabel("书馆邮箱:");
		tel = new JLabel("联系电话:");
		sponsorMan = new JLabel("负责人:");
		faJinPerDay = new JLabel("超期每日罚金:");
		yajinBeiShu = new JLabel("借书数量限制:");
		borrow_date = new JLabel("借阅日期限制:");
		re_borrow_date = new JLabel("续借日期限制:");
		
        
	}
	/**
	 *构建JButton按钮
	 * 
	 * @return 返回一个JButton对象
	 */

	private JButton buildBtn(String name,Icon icon) {
		JButton b = new ButtonCommon(name,icon);
		b.addActionListener(new LibraryInfoSetAction(this));
		return b;
	}
	public LibraryInfoVo getInPutValue(){
		String name = libraryNameTxt.getText().trim();
		String address = addressTxt.getText().trim();
		String mail = mailTxt.getText().trim();
		String tel = telTxt.getText().trim();
		String sponsor = sponserManTxt.getText().trim();
		float fajin = Float.parseFloat(faJinPerDayTxt.getText().trim());
		int numLimit = Integer.parseInt(numLimitTxt.getText().trim());
		int borrow_date = Integer.parseInt(borrow_dateTxt.getText().trim());
		int reBorrowDate = Integer.parseInt(re_borrow_dateTxt.getText().trim());
		return new LibraryInfoVo(name,address,mail,tel,sponsor,fajin,numLimit,borrow_date,reBorrowDate);		
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -