📄 a5_8.java
字号:
/*<APPLET Code="a5_8.class"
Width=300 Height=300>
</APPLET>*/
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class a5_8 extends Applet implements ActionListener
{
int x =10;
Button buttonbig = new Button("big");
Button buttonsmall =new Button("small");
public void init()
{
setLayout(new FlowLayout());
add(buttonbig);
add(buttonsmall);
buttonsmall.addActionListener(this);
buttonbig.addActionListener(this);
}
public void paint (Graphics g)
{
g.setFont(new Font("Dialog",Font.BOLD,x));
g.drawString("aaaa",100,100);
}
public void actionPerformed (ActionEvent e)
{
if(e.getSource()== buttonbig)
x+=10;
else if(e.getSource()== buttonsmall)
x-=10;
if (x<10)
x=10;
if (x>100)
x=100;
repaint();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -