?? swtpicture.java
字號:
/*
* Created on 2004-8-13
* Author: Xuefeng, Copyright (C) 2004, Xuefeng.
*/
package jexi.ui.swt;
import java.io.*;
import jexi.core.Picture;
import jexi.ui.Graphics;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
/**
* SWTPicture is the implementation of jexi.core.Picture,
* it is a Glyph.
*
* @author Xuefeng
*/
public class SWTPicture extends Picture {
private Image image;
private int width;
private int height;
SWTPicture(String filename) throws IOException {
try {
image = new Image(Display.getCurrent(), filename);
Rectangle r = image.getBounds();
this.width = r.width;
this.height = r.height;
}
catch(Exception e) {
e.printStackTrace();
throw new IOException();
}
}
/* (non-Javadoc)
* @see jexi.core.Glyph#draw(jexi.ui.Graphics)
*/
public void draw(Graphics g) {
SWTGraphics swtg = (SWTGraphics)g;
swtg.gc.drawImage(image, g.getCurrentX(), g.getCurrentY());
}
/* (non-Javadoc)
* @see jexi.core.Glyph#width()
*/
public int width() {
return this.width;
}
/* (non-Javadoc)
* @see jexi.core.Glyph#height()
*/
public int height() {
return this.height;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -