thermometerattachment.java
来自「全面实现ilog地功能,没有使用第三方lib.」· Java 代码 · 共 41 行
JAVA
41 行
/* * This source code is part of TWaver 1.3.1 * * SERVA Software PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * Copyright 2000-2005 SERVA Software, Inc. All rights reserved. */package demo.network.customui;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import twaver.TWaverUtil;
import twaver.network.ui.ElementUI;
import twaver.network.ui.LayoutedIconAttachment;
public class ThermometerAttachment extends LayoutedIconAttachment {
public ThermometerAttachment(String name, ElementUI ui) {
super(name, ui, TWaverUtil.getImageIcon("/demo/resource/customui/thermometer.gif"));
}
public void paint(Graphics2D g2d) {
super.paint(g2d);
g2d.setStroke(new BasicStroke(2));
g2d.setColor(Color.red);
int basePoint = 27;
int topPoint = 5;
Object o = getElementUI().getElement().getClientProperty("temperature");
if (o != null) {
int value = ( (Integer) o).intValue();
g2d.drawLine(getLocation().x + 5,
getLocation().y + basePoint,
getLocation().x + 5,
getLocation().y + value + topPoint);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?