?? navigationbar.java
字號(hào):
/* * @(#) NavigationBar.java * Copyright 2004 HWStudio. All rights reserved. */package hws.item.smart.panel.navbar;//導(dǎo)入核心Java類(lèi)庫(kù)import java.awt.Dimension;//導(dǎo)入自定義Java類(lèi)庫(kù)import hws.item.smart.misc.XMLConfig;import hws.item.smart.panel.function.FunctionPanel;/** * 導(dǎo)航欄 * * @version 0.1 2005-06-24 * @author Hwerz */public class NavigationBar extends NAVPanel implements SonButtonClickedListener { /*------------------------------------------------------------------------* * 屬性定義 * *------------------------------------------------------------------------*/ /** * 該類(lèi)自身的一個(gè)靜態(tài)引用 */ private static NavigationBar bar; /*------------------------------------------------------------------------* * 構(gòu)造函數(shù) * *------------------------------------------------------------------------*/ /** * 構(gòu)造函數(shù)為私有,這樣在整個(gè)運(yùn)行過(guò)程中該類(lèi)就只能有一個(gè)實(shí)例 */ private NavigationBar() { super(); addSonButtonClickedListener(this); for (int i = 0; i < XMLConfig.getParentButtonCount(); i++) { addParentButton(XMLConfig.getParentButtonLabel(i)); for (int j = 0; j < XMLConfig.getSonButtonCount(i); j++) { addSonToParent(i, XMLConfig.getSonButtonImage(i, j), XMLConfig.getSonButtonLabel(i, j)); } } setSelectedParentButton(XMLConfig.getDefaultParentButtonIndex()); } /*------------------------------------------------------------------------* * 公共方法 * *------------------------------------------------------------------------*/ /** * 對(duì)該類(lèi)提供的一個(gè)全局訪(fǎng)問(wèn)點(diǎn),用來(lái)實(shí)例化該對(duì)象 * * @return 該類(lèi)唯一的一個(gè)實(shí)例 */ public static NavigationBar getInstance() { if (bar == null) { bar = new NavigationBar(); } return bar; } /*------------------------------------------------------------------------* * 覆蓋方法 * *------------------------------------------------------------------------*/ /** * 覆蓋超類(lèi)JComponent的方法 * * @return the value of the preferredSize property */ public Dimension getPreferredSize() { return new Dimension(80, getHeight()); } /*------------------------------------------------------------------------* * 實(shí)現(xiàn)方法 * *------------------------------------------------------------------------*/ /** * 實(shí)現(xiàn)接口SonButtonClickedListener的方法 * * @param event SonButtonClickedEvent對(duì)象 */ public void sonButtonClicked(SonButtonClickedEvent event) { String label = event.getSonButtonLabel(); FunctionPanel.getInstance().show(label); }}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -