📄 buttonbar.java
字号:
package view;//Copyright (C) 2008 Harald Unander, Wang Wenjuan//// This file is part of WlanTV.//// WlanTV 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 3 of the License, or// (at your option) any later version.//// WlanTV 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 WlanTV. If not, see <http://www.gnu.org/licenses/>.import icons.MyIcons;import java.awt.Image;import java.awt.event.ActionListener;import java.awt.event.ItemListener;import javax.swing.BoxLayout;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JRadioButton;import javax.swing.JToolBar;import main.Main;import view.View;@SuppressWarnings("serial")public class ButtonBar extends JToolBar { View parent; BadfcsButton badfcsButton; LogButton logButton; AdvancedButton advancedButton; DetailsButton detailsButton; public ButtonBar(final View parent, ActionListener buttonHandler, ItemListener radioButtonHandler) { this.parent = parent; add(createButton("dead","folder.png","F","Open capture file or view (.wtvcap)",buttonHandler)); add(createButton("live","transmit.png","!","Live capture",buttonHandler)); add(createButton("setfolder","folder_edit.png","E","Set log folder",buttonHandler)); add(createButton("stop","control_stop.png","X","Stop capture",buttonHandler)); add(createButton("snap","camera.png","S","Snapshot",buttonHandler)); add(createButton("store","disk.png","S","Store view (.wtvcap)",buttonHandler));// add(new Separator());// add(createButton("back","control_rewind.png","<","Move left",buttonHandler));// add(createButton("forward","control_fastforward.png",">","Move right",buttonHandler)); add(createButton("home","house.png","R","Reset",buttonHandler));// add(createButton("zoomIn","magnifier_zoom_in.png","+","Zoom in (fixed left margin)",buttonHandler));// add(createButton("zoomOut","magifier_zoom_out.png","-","Zoom out (fixed left margin)",buttonHandler));// add(new Separator()); add(createButton("beer","chart_pie.png","P","Pie chart",buttonHandler)); add(createButton("load","chart_curve.png","L","Load chart",buttonHandler));// add(new Separator()); add(createButton("help","help.png","?","Help",buttonHandler)); add(createButton("information","information.png","i","Information",buttonHandler));// add(new Separator()); add(detailsButton = new DetailsButton("Details",radioButtonHandler)); add(badfcsButton = new BadfcsButton("FCS",radioButtonHandler)); add(advancedButton = new AdvancedButton("Expert",radioButtonHandler)); add(logButton = new LogButton("Log",radioButtonHandler)); setLayout(new BoxLayout(this,BoxLayout.X_AXIS)); } private JButton createButton(String command,String image,String k,String toolTip,ActionListener actionListener) { JButton button = new JButton(); button.setActionCommand(command); button.setToolTipText(toolTip); Image i = MyIcons.getImage((JFrame)this.parent,image); if (i != null) button.setIcon(new ImageIcon(i)); else button.setText(k); button.addActionListener(actionListener); return button; } public class BadfcsButton extends JRadioButton { public BadfcsButton(String name,ItemListener handler) { super(name); setSelected(true); addItemListener(handler); setToolTipText("Show packets with bad FCS"); if (Main.properties.getProperty("bad.fcs","include").equals("include")) setVisible(true); else setVisible(false); } } public class LogButton extends JRadioButton { public LogButton(String name,ItemListener handler) { super(name); setSelected(true); addItemListener(handler); setToolTipText("Show logging"); setVisible(true); } } public class AdvancedButton extends JRadioButton { public AdvancedButton(String name,ItemListener handler) { super(name); setSelected(false); addItemListener(handler); setToolTipText("Show advanced menus"); setVisible(true); } } public class DetailsButton extends JRadioButton { public DetailsButton(String name,ItemListener handler) { super(name); setSelected(false); addItemListener(handler); setToolTipText("Show packet details at higher zoom levels"); } } public boolean getBadfcsValue() { return badfcsButton.isSelected(); } public boolean getAdvancedValue() { return advancedButton.isSelected(); } public boolean getDetailsValue() { return detailsButton.isSelected(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -