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

📄 systemdataresetdialog.java

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

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import librarymanagement.action.dialogAction.SystemDataResetAction;
import librarymanagement.view.common.CenterLoction;
import librarymanagement.view.common.GBC;

/**
 * 初始化数据库
 * 
 * @author 虎兴龙
 * 
 */
public class SystemDataResetDialog extends JDialog {
	JPanel p1, p2, p3, p4;
	public JCheckBox box1,box2,box3;

	public SystemDataResetDialog() {
		super();	
		this.setFeat();
		this.setTitle("清理数据");
		this.setSize(400, 300);
		CenterLoction.locateCenter(this);
		this.setLayout(new BorderLayout());
		this.add(buildImagePanel(), "Center");
		this.add(buildNPanel(), "North");
		this.add(buildSPanel(), "East");
		this.setBackground(Color.MAGENTA);
		this.setModal(true);
		this.setResizable(false);

	}

	/**
	 * 设置该对话框皮肤
	 * 
	 */
	private void setFeat() {
		try {
			UIManager.setLookAndFeel("com.nilo.plaf.nimrod.NimRODLookAndFeel");
			//UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
		} catch (InstantiationException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (IllegalAccessException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (UnsupportedLookAndFeelException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (ClassNotFoundException e) {

		}
		// SubstanceLookAndFeel.setSkin(new OfficeBlue2007Skin());
	}

	private JPanel buildSPanel() {
		if (p3 == null) {
			buildCheckBox();
			p3 = new JPanel();
			p3.setLayout(new GridBagLayout());
			p3.add(box1, new GBC(0, 0, 1, 1));
			
			p3.add(buildBtn("返回"), new GBC(1, 1, 1, 2));
			p3.add(box2, new GBC(0, 2, 1, 1));
			p3.add(box3, new GBC(0, 3, 1, 1).setInset(5));
			p3.add(buildBtn("执行"), new GBC(1, 3, 1, 2));
			p3.setBorder(BorderFactory.createLineBorder(Color.BLUE));
		}
		return p3;
	}
   private JButton buildBtn(String name){
	   JButton b = new JButton(name);
	   b.addActionListener(new SystemDataResetAction(this));
	   return b;
   }
   public void  buildCheckBox(){
	   box1 = new JCheckBox("删除图书信息");
	   box2 = new JCheckBox("删除读者信息");
	   box3= new JCheckBox("删除借阅记录");

   }
	private JPanel buildNPanel() {
		if (p2 == null) {
			p2 = new JPanel();
			p2.setLayout(new GridLayout(2, 1));
			p2.add(new JLabel("次步操作将永久删除数据信息!"));
			p2.add(new JLabel("强烈建议用户将数据备份后执行次操作!"));
			p2.setBorder(BorderFactory.createTitledBorder("重要提示"));
			p2.setBorder(BorderFactory.createLineBorder(Color.RED));
			// p2.setForeground(Color.RED);
		}
		return p2;
	}

	private JPanel buildImagePanel() {
		if (p1 == null) {
			p1 = new ImagePanel("img/panelimg/数据库初始化.jpg");

		}
		return p1;
	}

	class ImagePanel extends JPanel {
		ImageIcon icon;

		/**
		 * 内部类构造方法
		 * 
		 * @param image
		 *            panel背景图片路径
		 */
		public ImagePanel(String image) {
			icon = new ImageIcon(image);
			// this.setSize();
			// this.setBorder(BorderFactory.createLineBorder(Color.ORANGE,10)/*(
			// Color.ORANGE)*/);

		}

		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			Image i = icon.getImage();
			g.drawImage(i, 0, 0, this);
		}
	}
}

⌨️ 快捷键说明

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