?? jhelpbutton.java
字號:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Created on 2005/7/27
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package eti.bi.alphaminer.jhelpcomponent;
import java.awt.Cursor;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.JButton;
import eti.bi.alphaminer.core.observer.HelpObserver;
import eti.bi.alphaminer.core.observer.HelpObserveSubject;
/**
* @author tyleung
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class JHelpButton extends JButton implements
MouseListener, HelpObserver {
/**
*
*/
private static final long serialVersionUID = 1L;
private boolean m_HelpState;
private boolean m_NormalState;
private Icon m_DefaultDisabledIcon;
private Icon m_HelpDisabledIcon;
public JHelpButton() {
setHelpState(false);
m_DefaultDisabledIcon = this.getDisabledIcon();
setDisabledIcon(m_DefaultDisabledIcon);
addMouseListener(this);
HelpObserveSubject.registerInterest(this);
}
public JHelpButton(Icon icon) {
super.setIcon(icon);
setHelpState(false);
m_DefaultDisabledIcon = this.getDisabledIcon();
addMouseListener(this);
HelpObserveSubject.registerInterest(this);
}
public void setDefaultDisabledIcon() {
super.setDisabledIcon(m_DefaultDisabledIcon);
}
public void setHelpDisabledIcon(Icon icon) {
m_HelpDisabledIcon = icon;
}
public void Update(boolean a_HelpState) {
setHelpMode(a_HelpState);
}
private void setHelpMode(boolean a_HelpState) {
HelpCursor helpCursor = new HelpCursor();
setHelpState(a_HelpState);
if ( a_HelpState ) {
getParent().setCursor(helpCursor.getCursor());
if ( isEnabled() ) {
setDisabledIcon(m_HelpDisabledIcon);
} else {
setDisabledIcon(m_DefaultDisabledIcon);
}
setNormalState(isEnabled());
setEnabled(false);
}
else {
getParent().setCursor(
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
setDisabledIcon(m_DefaultDisabledIcon);
setEnabled(getNormalState());
}
}
private void setNormalState(boolean state) {
m_NormalState = state;
}
private boolean getNormalState() {
return m_NormalState;
}
private void setHelpState(boolean a_HelpState) {
m_HelpState = a_HelpState;
}
private boolean isHelpMode() {
return m_HelpState;
}
/**
* @see java.awt.event.MouseListener#mouseEntered(MouseEvent)
*/
public void mouseEntered(MouseEvent e) {
}
/**
* @see java.awt.event.MouseListener#mouseExited(MouseEvent)
*/
public void mouseExited(MouseEvent e) {
}
/**
* @see java.awt.event.MouseListener#mousePressed(MouseEvent)
*/
public void mousePressed(MouseEvent e) {
if ( isHelpMode() ) {
setHelpMode(false);
HelpObserveSubject.sendNotify(false);
}
}
/**
* @see java.awt.event.MouseListener#mouseReleased(MouseEvent)
*/
public void mouseReleased(MouseEvent e) {
}
/**
* @see java.awt.event.MouseListener#mouseClicked(MouseEvent)
*/
public void mouseClicked(MouseEvent e) {
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -