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

📄 buttonicon.java

📁 简单的书店管理系统,是课设期间教师指导完成的,希望会对大家有帮助!
💻 JAVA
字号:
package book;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;

public class ButtonIcon extends JButton {
	ButtonIcon(String s) {
		this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
		if (s.equals("确定")) {
			this.setIcon(new ImageIcon("./data/image/button/ok1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/ok2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/ok3.jpg"));
			this.setDisabledIcon(new ImageIcon("./data/image/button/ok4.jpg"));
		}

		if (s.equals("取消")) {
			this.setIcon(new ImageIcon("./data/image/button/quxiao1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/quxiao2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/quxiao3.jpg"));
			this.setDisabledIcon(new ImageIcon("./data/image/button/quxiao4.jpg"));
		}

		if (s.equals("关闭")) {
			this.setIcon(new ImageIcon("./data/image/button/close1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/close2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/close3.jpg"));
			this.setDisabledIcon(new ImageIcon("./data/image/button/close4.jpg"));
		}

		if (s.equals("添加")) {
			this.setIcon(new ImageIcon("./data/image/button/add1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/add2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/add3.jpg"));
			this.setDisabledIcon(new ImageIcon("./data/image/button/add4.jpg"));
		}

		if (s.equals("删除")) {
			this.setIcon(new ImageIcon("./data/image/button/del1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/del2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/del3.jpg"));
			this.setDisabledIcon(new ImageIcon("./data/image/button/del4.jpg"));
		}

		if (s.equals("查询")) {
			this.setIcon(new ImageIcon("./data/image/button/query1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/query2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/query3.jpg"));
	     	this.setDisabledIcon(new ImageIcon("./data/image/button/query4.jpg"));
		}

		if (s.equals("修改")) {
			this.setIcon(new ImageIcon("./data/image/button/xiugai1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/xiugai2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/xiugai3.jpg"));
			this.setDisabledIcon(new ImageIcon("./data/image/button/xiugai4.jpg"));
		}

		if (s.equals("保存")) {
			this.setIcon(new ImageIcon("./data/image/button/save1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button/save2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button/save3.jpg"));
			this.setDisabledIcon(new ImageIcon("./data/image/button/save4.jpg"));
		}
		
		if (s.equals("数据备份")) {
			this.setIcon(new ImageIcon("./data/image/button2/databeifen1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/databeifen2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/databeifen3.jpg"));
		}
		
		if (s.equals("数据恢复")) {
			this.setIcon(new ImageIcon("./data/image/button2/datahuifu1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/datahuifu2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/datahuifu3.jpg"));
		}
		
		if (s.equals("借书")) {
			this.setIcon(new ImageIcon("./data/image/button2/jieshu1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/jieshu2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/jieshu3.jpg"));
		}
		
		if (s.equals("还书")) {
			this.setIcon(new ImageIcon("./data/image/button2/huanshu1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/huanshu2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/huanshu3.jpg"));
		}
		
		if (s.equals("所有读者")) {
			this.setIcon(new ImageIcon("./data/image/button2/allduzhe1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/allduzhe2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/allduzhe3.jpg"));
		}
		
		if (s.equals("所有图书")) {
			this.setIcon(new ImageIcon("./data/image/button2/allbook1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/allbook2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/allbook3.jpg"));
		}
		
		if (s.equals("借书记录")) {
			this.setIcon(new ImageIcon("./data/image/button2/jiebook1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/jiebook2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/jiebook3.jpg"));
		}
		
		if (s.equals("还书记录")) {
			this.setIcon(new ImageIcon("./data/image/button2/huanbook1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/huanbook2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/huanbook3.jpg"));
		}
		
		if (s.equals("未还图书")) {
			this.setIcon(new ImageIcon("./data/image/button2/weibook1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/weibook2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/weibook3.jpg"));
		}
		
		if (s.equals("超期未还")) {
			this.setIcon(new ImageIcon("./data/image/button2/chaobook1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/chaobook2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/chaobook3.jpg"));
		}
		
		if (s.equals("已还未罚")) {
			this.setIcon(new ImageIcon("./data/image/button2/weifa1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/weifa2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/weifa3.jpg"));
		}
		
		if (s.equals("登陆")) {
			this.setIcon(new ImageIcon("./data/image/button2/enter1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/enter2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/enter3.jpg"));
		}
		
		if (s.equals("登陆关闭")) {
			this.setIcon(new ImageIcon("./data/image/button2/dclose1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/dclose2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/dclose3.jpg"));
		}
		
		if (s.equals("T借书")) {
			this.setIcon(new ImageIcon("./data/image/button2/tjieshu1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/tjieshu2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/tjieshu3.jpg"));
		}
		
		if (s.equals("T还书")) {
			this.setIcon(new ImageIcon("./data/image/button2/thuanshu1.jpg"));
			this.setRolloverIcon(new ImageIcon("./data/image/button2/thuanshu2.jpg"));
			this.setPressedIcon(new ImageIcon("./data/image/button2/thuanshu3.jpg"));
		}
	}
}

⌨️ 快捷键说明

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