Custom Method for Java Applications Title Bar Icon

xiaoxiao2021-03-06  19

I have a short time for Java, but I have been able to customize the title bar icon of the Java program, but I find a lot of information this paper is very pitiful.

Today I accidentally discovered in Java

Java.awt.frame.seticonImage () method.

The routines are as follows:

Import javax.swing. *; public class java_titlebar_ICON EXTENDS JFRAME {JLabel JLABLE1 = New Jlabel ("Demo the method of custom java_titlebar_icon); string image = new string (" img / aa.gif "); // Establish a string Save the path to the icon you want to use, please refer to other documents ImageICON test = new imageicon (image); // creation of an ImageCIMAG JAVA_TITLEBAR_ICON () {Super ("demo) Custom Java_TITLEBAR_ICON method "); this.setiMage ()); // Set the icon of the title bar to aa.gif this.setDefaultcloseOperation; jPanel Pane = new jPanel (); Pane.Add (JLABLE1); this.SetContentPane (PANE); this.show ();} public static void main (string [] args) {java_titlebar_icon jti = new java_titlebar_icon ();}}

转载请注明原文地址:https://www.9cbs.com/read-39918.html

New Post(0)