📄 scrollpanedemo_gui.java
字号:
/**
*A simple scroll panel program in GUI
*2004.11.27. xhcprince
*Pay attention,it's not ScrollPanel, but ScrollPane!Without 'l' at last!
*/
import java.awt.*;
import java.applet.*;
public class scrollpaneDemo_GUI extends Applet
{
private canvas A;
private ScrollPane B;
public void init()
{
A = new canvas(300,160);
B = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
B.add(A);
this.add(B);
}
}
class canvas extends Canvas
{
protected canvas(int width, int height)
{
super();
this.setSize(width,height);
}
public void paint(Graphics g)
{
int width = this.getBounds().width;
int height = this.getBounds().height;
g.drawString("I will be tall!\n",150,80);
g.drawLine(height,0,0,width);
}
}
/*
<applet code = "scrollpaneDemo_GUI.class" width = 600 height = 600>
</applet>
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -