?? jtpimage.java
字號:
package com.sunking.tp.swing;
import javax.swing.*;
import java.awt.*;
/**
*
* <p>Title: </p>
* <p>Description: 圖片組件</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author <a href="mailto:sunkingxie@hotmail.com">SunKing</a>
* @version 1.0
*/
public class JTPImage extends JTPButton {
private static final long serialVersionUID = -3000000000000000010L;
public JTPImage(ImageIcon icon) {
setBorder(null);
setOpaque(true);
setIcon(icon);
}
public String getText(){
return "";
}
/**
*繪制圖片組件
*/
public void paint(Graphics g){
int w = getWidth();
int h = getHeight();
Image image =( (ImageIcon) getIcon()).getImage();
g.drawImage(image, 0, 0, w, h, this);
if (isSelected) {
Rectangle[] rec = getHandleRectangles();
for (int i = 0; i < rec.length; i++) {
g.drawRect(rec[i].x, rec[i].y, rec[i].width, rec[i].height);
}
}
}
public Object clone(){
JTPImage cloneObject = new JTPImage((ImageIcon)getIcon());
cloneObject.setSelect(isSelected);
cloneObject.setSize(getSize());
return cloneObject;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -