📄 listheader.java
字号:
/* ---------------------------------------------------------------------- The SINUS Firewall -- a TCP/IP packet filter for Linux Written within the SINUS project at the University of Zurich, SWITCH, Telekurs Payserv AG, ETH Zurich. originally based on the sf Firewall Software (C) 1996 by Robert Muchsel and Roland Schmid. 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. SINUS Firewall resources: SINUS Homepage: http://www.ifi.unizh.ch/ikm/SINUS/ Firewall Homepage: http://www.ifi.unizh.ch/ikm/SINUS/firewall.html Frequently asked questions: http://www.ifi.unizh.ch/ikm/SINUS/sf_faq.html Mailing list for comments, questions, bug reports: firewall@ifi.unizh.ch ---------------------------------------------------------------------- */package sfclasses;import java.awt.*;import java.util.*;/** * <b>List Header</b><br> * This is an abstract class. Subclasses of ListHeader can be used as * header bar of ListPanel. For examples of subclasses see ShowHeader * and TcpHeader in FirewallAction.java or RuleHeader in RuleEditor.java. * @version 1.0 23 Jan 1997 * @author Roland E. Schmid */abstract public class ListHeader extends Canvas { /** * Initialize object. * @param listCanvas Corresponding subclass of ListCanvas */ public ListHeader(ListCanvas listCanvas) { this.listCanvas = listCanvas; } public synchronized void paint(Graphics g) { FontMetrics fm = g.getFontMetrics(); int maxascent = fm.getMaxAscent(); // draw vertical lines for (int col=1; col < listCanvas.column_no; col++) g.drawLine(listCanvas.column_pos[col], 0, listCanvas.column_pos[col], canvas_height); // draw headers for (int col=0; col < listCanvas.column_no; col++) g.drawString(listCanvas.clipString(header[col], listCanvas.column_size[col]-3, fm), listCanvas.column_pos[col]+1, maxascent); g.drawLine(0, canvas_height-1, canvas_width, canvas_height-1); } // paint public Dimension getPreferredSize() { Graphics g = getGraphics(); FontMetrics fm = g.getFontMetrics(); g.dispose(); return new Dimension(100, fm.getHeight()+1); } public Dimension getMinimumSize() { return getPreferredSize(); } /** * called when panel size changes (e.g. on startup) */ public synchronized void setBounds(int x, int y, int width, int height) { // call setBounds() of superclass super.setBounds(x, y, width, height); canvas_width = width; canvas_height = height; } private ListCanvas listCanvas; private int canvas_width, canvas_height; protected String header[];}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -