demotitleicon.java

来自「基于netbeans的java桌面应用程序合集」· Java 代码 · 共 34 行

JAVA
34
字号
/*
 * DemoTitleIcon.java
 *
 * Created on 2007年10月3日, 上午10:13
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.Adam;
import java.awt.*;
import javax.swing.*;
/**
 *
 * @author acer
 */
public class DemoTitleIcon extends JFrame{
    Image iconImage;
    String imageName="myIco.gif";
    /** Creates a new instance of DemoTitleIcon */
    public DemoTitleIcon() {
        iconImage=Toolkit.getDefaultToolkit().getImage(imageName);
        this.setIconImage(iconImage);
        //this.setBounds(300,200,250,200);
        this.setSize(500,200);
        this.setTitle("设置窗口的图标");
        this.setVisible(true);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
    public static void main(String[] args) {
        new DemoTitleIcon();
    }
}

⌨️ 快捷键说明

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