⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icondemo.java

📁 金旭亮的java教案
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class IconDemo {

    static JFrame jframe = new JFrame("Example");

    public static void setupjframe() {
        jframe.setSize(200,200);
        jframe.setVisible(true);
        jframe.getContentPane().setLayout( new FlowLayout() );

        WindowListener l = new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        };
        jframe.addWindowListener(l);
    }

    public static void main(String[] args) {
        setupjframe();

	// alternatively, load the image from a file Toolkit 
	//Toolkit t = MyFrame.getToolkit(); 
	// Image FrameIcon = t.getImage(filename); 
 
        // this has to be an image that the OS
        // accepts as a suitable size for an icon
        ImageIcon ii = new ImageIcon("star.gif");
	jframe.setIconImage( ii.getImage() ); 
    }
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -