⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iconobject.java

📁 sifi-0.1.6.tar.gz 出自http://www.ifi.unizh.ch/ikm/SINUS/firewall/ 一个linux的防火墙工具。
💻 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.awt.image.*;import java.io.*;/** * General drag and drop object that uses an icon to draw itself. This is * the parent class of Host, Net and Internet. The icons are stored as * static arrays in private classes, because the applet is not allowed * to load icons from the disk. * @version 1.0 03 Dec 1996 * @author Roland E. Schmid */public class IconObject extends ManageObject {  /**   * Initialize object   */  public IconObject() {    // implicit call to super()  }  /**   * Initialize icon<br>   * The drag and drop panel calls this method.   * @see DragDropObj   */  public void initImage(Component target, MediaTracker mt) {    if ((target != null) && (iconLoaded == ICON_STATE_NONE)) {      if (icon == null)        if (iconName != null)          icon = Toolkit.getDefaultToolkit().getImage(iconName);        else           icon = Toolkit.getDefaultToolkit().createImage(new UtilsBrokenImageSource());      mt.addImage(icon, 0);      iconLoaded = ICON_STATE_REQUESTED;    }  }	public void update(Graphics g, int x_offset, int y_offset) {		draw(g, x_offset, y_offset);	}	  /**   * Draw icon<br>   * The drag and drop panel calls this method.   * @param g Graphics context of drag and drop canvas   * @param x_offset Current horizontal offset of virtual viewport   * @param y_offset Current vertical offst of virtual viewport   * @see DragDropObj   */  public void draw(Graphics g, int x_offset, int y_offset) {    if (iconLoaded == ICON_STATE_REQUESTED) {      dX = icon.getWidth(null) / 2;      dY = icon.getHeight(null) / 2;      iconLoaded = ICON_STATE_LOADED;    }    if (iconLoaded != ICON_STATE_LOADED)       super.draw(g, x_offset, y_offset);    else {      g.drawImage(icon, actX-x_offset-dX, actY-y_offset-dY, null);      if (isHighlighted) {        Color savecolor = g.getColor();        g.setColor(Color.blue);        g.drawRect(actX-x_offset-dX-1, actY-y_offset-dY-1, 2*dX+2, 2*dY+2);        g.setColor(savecolor);      }    }  }  /**   * Draw Icon that inidcates the configuration to be consistent.   * @param dd DragDrop   */	public void setOKIcon(DragDrop dd) {}  /**   * Draw Icon that inidcates the configuration not to be consistent.   * @param dd DragDrop   */	public void setNOKIcon(DragDrop dd) {}  private static final int ICON_STATE_NONE = 0;  private static final int ICON_STATE_REQUESTED = 1;  private static final int ICON_STATE_LOADED = 2;  protected Image icon;  protected int iconLoaded = ICON_STATE_NONE;  protected String iconName;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -