java GUI 怎么插入图片 15
importjava.awt.*;importjava.awt.event.KeyAdapter;importjava.awt.event.KeyEvent;import...
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.*;
public class MyFrame extends JFrame {
MyFrame(){
setTitle("aaa");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
JLabel textLabel = new JLabel("제임스 고슬링 입니더!");
ImageIcon img = new ImageIcon("images/abc.jpg");
JLabel imageLabel = new JLabel(img);
c.add(textLabel);
c.add(imageLabel);
setSize(300,500);
setVisible(true);
}
public static void main(String[] args) {
new MyFrame();
}
}
图片已经上传了, 为什么运行之后不显示 展开
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.*;
public class MyFrame extends JFrame {
MyFrame(){
setTitle("aaa");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
JLabel textLabel = new JLabel("제임스 고슬링 입니더!");
ImageIcon img = new ImageIcon("images/abc.jpg");
JLabel imageLabel = new JLabel(img);
c.add(textLabel);
c.add(imageLabel);
setSize(300,500);
setVisible(true);
}
public static void main(String[] args) {
new MyFrame();
}
}
图片已经上传了, 为什么运行之后不显示 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询