📄 statustoolbar.java
字号:
/**
*
*/
package eti.bi.alphaminer.ui.ToolBar;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;
import eti.bi.alphaminer.core.observer.Observer;
import eti.bi.alphaminer.jhelpcomponent.JHelpToolBar;
import eti.bi.alphaminer.tools.SystemTools.SystemToolPage.OperatorProgress;
import eti.bi.common.ImageLocation;
import eti.bi.common.Locale.Resource;
import eti.bi.exception.SysException;
import eti.bi.util.ResourceLoader;
/**
* @author Xiaojun Chen
*
*/
public class StatusToolBar extends JHelpToolBar implements Observer{
/**
*
*/
private static final long serialVersionUID = 8873765370319617409L;
private JLabel m_StatusBarMessage = new JLabel();
private OperatorProgress operatorProgress;
private JButton stopButton;
/**
* @param name
*/
public StatusToolBar(String name) {
super(name);
createToolBar();
}
private void createToolBar() {
setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 0));
setBorder(BorderFactory.createBevelBorder(
BevelBorder.LOWERED, Color.white, Color.white, new Color(103,
101, 98), new Color(148, 145, 140)));
// StatusBar Message Font Style
m_StatusBarMessage.setFont(new java.awt.Font("SansSerif", 0, 14));
m_StatusBarMessage.setAlignmentX((float) 0.0);
m_StatusBarMessage.setAlignmentY((float) 0.0);
m_StatusBarMessage.setVerticalAlignment(SwingConstants.BOTTOM);
m_StatusBarMessage.setVerticalTextPosition(SwingConstants.BOTTOM);
add(m_StatusBarMessage, null);
addSeparator(new Dimension(4,2));
createOperatorProgress();
add(Box.createHorizontalStrut(5));
setFloatable(false);
}
private void createOperatorProgress(){
JPanel panel = new JPanel();
// Progress bar
operatorProgress = OperatorProgress.getOperatorProgress();
operatorProgress.setPreferredSize(new Dimension(200, 26));
stopButton = new JButton();
stopButton.setPreferredSize(new Dimension(20,20));
try {
stopButton.setIcon(ResourceLoader.getImageIcon(ImageLocation.STOP));
} catch (SysException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
stopButton.setToolTipText(Resource.srcStr("stopOperatorThread"));
stopButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
operatorProgress.stopOperatorThread();
}
});
panel.add(operatorProgress,null);
panel.add(stopButton,null);
add(panel,null);
}
public JLabel getStatusBarMessage(){
return m_StatusBarMessage;
}
public void sendNotify(String a_Message) {
if(a_Message!=null && a_Message.equals(Resource.CHANGE_LOCALE)){
stopButton.setText(Resource.srcStr("stopOperatorThread"));
}
}
public void sendNotify(int a_Message) {
// TODO Auto-generated method stub
}
public void sendNotify(int a_Message, Object a_Object) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -