Java 图片上的组件显示不出来,下面是我写的,请大神帮忙 10
importjava.awt.*;importjavax.swing.*;publicclassJieMianextendsJFrame{Imageimage=Toolk...
import java.awt.*; import javax.swing.*; public class JieMian extends JFrame{ Image image = Toolkit.getDefaultToolkit().createImage("bin\\a.jpg"); JieMian(){ JFrame f=new JFrame("myto"); f.setSize(680,520); JPanel p=new JPanel(){public void paint(Graphics g){ g.drawImage(image,0,0,this); }}; JLabel jb = new JLabel("确定"); p.add(jb); f.add(p); f.setVisible(true); } public static void main(String[] a){ new JieMian(); } }
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询