📄 toolbar.java
字号:
package lib;
import javax.swing.*;
public class Toolbar extends JToolBar {
/***************************************************************************
*** declaration of the private variables used in the program ***
***************************************************************************/
//for creating the buttons to use them in ToolBar
public JButton[] button;
//for creating the name of the image file 24*24
public String[] imageName24 = {"images/AddBook.gif", "images/ListBook.gif",
"images/ListNotBorrow.gif", "images/ListBorrow.gif",
"images/EditBook.gif", "images/DeleteBook.gif",
"images/InformationBook.gif", "images/AddMember.gif",
"images/ListMember.gif", "images/EditMember.gif",
"images/DeleteMember.gif", "images/InformationMember.gif",
"images/Find.gif", "images/Export24.gif",
"images/Import24.gif", "images/Help24.gif",
"images/About24.gif","images/Print.gif","images/Exit24.gif"};
//for creating the tipText for the toolbar
public String[] tipText = {"添加图书", "列出所有图书", "列出未借图书",
"列出已借图书", "编辑图书", "删除图书", "图书信息",
"添加用户", "列出所有用户", "编辑用户", "删除用户", "用户信息",
"搜索", "借出图书","归还图书", "帮助", "关于","打印","退出"};
public Toolbar() {
button = new JButton[19];
for (int i = 0; i < imageName24.length; i++) {
if (i == 7 || i == 12 || i == 15 || i == 17)
//for adding separator to the toolBar
addSeparator();
//for adding the buttons to toolBar
try{
add(button[i] = new JButton(new ImageIcon(ClassLoader.getSystemResource(imageName24[i]))));
//for setting the ToolTipText to the button
}
catch(NullPointerException e){
System.out.println("i:"+i);
}
button[i].setToolTipText(tipText[i]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -