java 图形用户界面
importjava.awt.*;importjavax.swing.*;importjava.awt.event.*;publicclassgui2extendsJFr...
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class gui2 extends JFrame{
String path="E:/pic/";
public gui2() {
this.setTitle("picture");
this.setSize(400,200);
this.show();
Container c=this.getContentPane();
c.setLayout(new FlowLayout());
Icon p=new ImageIcon(path,"p.gif");
JPanel jp=new JPanel();
c.add(jp);
JButton j=new JButton("java",p);
jp.add(j);
}
public static void main(String args[]){
new gui2();
}
}
似乎是按钮不够大,不但图片没显示出来,java也没完整的显示出来,怎么解决 展开
import javax.swing.*;
import java.awt.event.*;
public class gui2 extends JFrame{
String path="E:/pic/";
public gui2() {
this.setTitle("picture");
this.setSize(400,200);
this.show();
Container c=this.getContentPane();
c.setLayout(new FlowLayout());
Icon p=new ImageIcon(path,"p.gif");
JPanel jp=new JPanel();
c.add(jp);
JButton j=new JButton("java",p);
jp.add(j);
}
public static void main(String args[]){
new gui2();
}
}
似乎是按钮不够大,不但图片没显示出来,java也没完整的显示出来,怎么解决 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询