📄 scrolltext.java
字号:
import java.awt.*;
public class ScrollText
{
private Dimension position;
private int x=10,y=10;
private int totalLine=1;
private String text[];
private Graphics g;
private Font font;
private Color back=Color.black,fore=Color.white;
private Rectangle r;
public ScrollText()
{
totalLine = 1;
}
public ScrollText(Graphics gra)
{
g = gra;
r = g.getClipBounds();
}
public void setLines(int L)
{
totalLine = L;
text = new String[totalLine];
}
public int getLines()
{
return totalLine;
}
public void show()
{
g.setColor(fore);
for(int i=0,a,b; i<text.length; i++)
{
a = x;
b = y+(i+1)*20;
g.drawString(text[i],a,b);
}
}
public void setForeground(Color c)
{
fore = c;
}
public Color getForeground()
{
return fore;
}
public void setBackground(Color c)
{
back = c;
}
public Color getBackground()
{
return back;
}
//========================================
public int getX()
{
return x;
}
public void setX(int x)
{
this.x = x;
}
public void setPosition(int x, int y)
{
this.x = x;
this.y = y;
}
public int getY()
{
return y;
}
public void setY(int y)
{
this.y = y;
}
//========================================
public void setText(int index, String s)
{
text[index] = s ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -