📄 imagescale.java
字号:
import java.applet.*;
import java.awt.*;
import javax.swing.*;
public class ImageScale extends JApplet
{
private Image narrow;
private ImageIcon narrow2;
private int w,h,iw,ih;
public void init()
{
narrow=getImage(getDocumentBase(),"gif-1000.gif");
narrow2=new ImageIcon("gif-1000.gif");
w=getWidth();
h=getHeight();
iw=narrow2.getIconWidth();
ih=narrow2.getIconHeight();
}
public void paint(Graphics g)
{
narrow2.paintIcon(this,g,(w-iw)/2,0);
g.drawImage(narrow,0,ih+10,w,h-(ih-10),this);//最后一个参数是观察者
showStatus("\t\t狭桥!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -