如何在Appliction中添加显示图像??? 用javax包里的imageico,读取,然后把他放在一个label里就行了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.awt.*;import java.awt.event.*;import javax.swing.*;public class ImageTest extends JFrame{ public ImageTest() { ImageIcon imageIcon = new ImageIcon("images\\big.jpg"); JLabel label = new JLabel(imageIcon); Container contentPane = getContentPane(); contentPane.add(label); setTitle("Image Test"); setSize(800,600); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } public static void main(String[] args) { JFrame frame = new ImageTest(); frame.setVisible(true); }} 求Java一个正则表达式替换。 用java找对称数 关于字符串数组元素进行随机连接 正则表达式--possessive问题 java中 float求和的小数点精度问题 请各位大虾帮帮忙看问题出在哪? 怎么实现可变变量? 求高手帮忙!!!急~~~~ 问一个郁闷的问题! 方法(method)和函数(function)有什么区别? 关于string&stringBuffer 请问启动的多个java虚拟机如何共享一个连接池?
import java.awt.event.*;
import javax.swing.*;public class ImageTest extends JFrame
{
public ImageTest()
{
ImageIcon imageIcon = new ImageIcon("images\\big.jpg");
JLabel label = new JLabel(imageIcon);
Container contentPane = getContentPane();
contentPane.add(label);
setTitle("Image Test");
setSize(800,600);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public static void main(String[] args)
{
JFrame frame = new ImageTest();
frame.setVisible(true);
}
}