package 窗口;
import java.awt.*;
import javax.swing.*;
public class TestFrame1 extends JFrame
{
private static final long serialVersionUID = 1L;
private Image image = null;
private ImageIcon icon = new ImageIcon("images/1.jpg");
JPanel jp1,jp2,jp3;
JButton jb1,jb2,jb3;
JLabel jl1,jl2;
public TestFrame1()
{
super("测试窗口");
jl1=new JLabel("");
jl2=new JLabel("");
jp1=new JPanel();
jp2=new JPanel();
jp3=new JPanel();
jb1=new JButton(" 借书 ");
jb2=new JButton(" 还书 ");
jb3=new JButton(" 租还查询 ");
jp1.add(jb1);
jp2.add(jb2);
jp3.add(jb3);
this.setLayout(new GridLayout(4, 1));
this.add(jl1);
this.add(jp1);
this.add(jp2);
this.add(jp3);
this.setSize(500,360);
this.setVisible(true);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
public static void main(String[] args)
{
new TestFrame();
}
public void paint(Graphics g)
{
super.paint(g);
image = icon.getImage();
g.drawImage(image, 0, 0, null);
}
}
Java 为什么鼠标移动到按钮的位置时才会显示按钮
答案:1 悬赏:50 手机版
解决时间 2021-02-10 23:07
- 提问者网友:我一贱你就笑
- 2021-02-10 05:03
最佳答案
- 五星知识达人网友:老鼠爱大米
- 2021-02-10 06:35
绘背景后,再绘一下
jb1.repaint();
jb2.repaint();
jb3.repaint();
~
~
~~~~~
jb1.repaint();
jb2.repaint();
jb3.repaint();
~
~
~~~~~
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯