📄 conversationpanel.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 java.awt.event.MouseEvent;import java.awt.event.MouseListener;import javax.swing.BoxLayout;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import main.Main;@SuppressWarnings("serial")public class ConversationPanel extends JPanel { SummaryTextArea ta; public ConversationPanel() { setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); ta = new SummaryTextArea(); ta.setBorder(Main.emptyBdr4); add(new JScrollPane(ta)); } public void setText(String s) { ta.setText(s); } public class SummaryTextArea extends JTextArea implements MouseListener { public SummaryTextArea () { setCaretPosition(0); setTabSize(6); setEditable(false); addMouseListener(this); } public void mouseClicked(MouseEvent event) { try { int line = ta.getLineOfOffset(ta.getCaretPosition()); int startOffset = ta.getLineStartOffset(line); int len = ta.getLineEndOffset(line) - startOffset; String[] s = ta.getText(startOffset,len).trim().split("\\s+"); if (s[0].equals("STA") || s[0].equals("AP")) { String macAddr = s[1]; if (macAddr.length() == 17) { Long.parseLong(macAddr.replace(":",""),16); String host = JOptionPane.showInputDialog(this, "Enter hostname for "+macAddr.toUpperCase()); if (host!=null && host!="") Main.properties.updateProperty(macAddr,host); } } } catch (Exception e) { e.printStackTrace();// System.out.println(e.getMessage()); } } public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -