This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Replacinf Java cup icon of JFrame and changing default folder look in JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Replacinf Java cup icon of JFrame and changing default folder look in JTree" Watch "Replacinf Java cup icon of JFrame and changing default folder look in JTree" New topic
Author

Replacinf Java cup icon of JFrame and changing default folder look in JTree

Ajit Kanada
Ranch Hand

Joined: Jan 23, 2001
Posts: 95
Hi
I m doing a GUI application.I want to replace the JAVA cup on the JFrame with my image.How can this be done?
Also i have a JTree.I want to change default look of Java folders to Windows look .Is it possible??
Can somebody help...
Thanx in advance
Ajit


Thankx
Ajit
Chhaya Dhanani
Ranch Hand

Joined: Apr 11, 2001
Posts: 70
Hi ajit,
if u carefully go thru' the methods inherited by various classes in the JFRame api,
u will notice that there is method setImageIcon(Image i) which JFrame inherits from Frame
u can use this in the following manner:

//import statements
public class Test extends JFrame
{
Toolkit kit;
IamgeIcon i;
public Test()// constructor
{
kit=Toolkit.getDefaultToolkit();
i=kit.createImage("YOUR IMAGE FILE PATH GOES HERE");
setImageIcon(i);
}//end of constructor
}//end of class
that should solve ur problem
Chhaya



Chhaya Dhanani
Ranch Hand

Joined: Apr 11, 2001
Posts: 70
Hi once again ajit,
for the windows look and feel
just insert the following code in your constructor:
try
{
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception exc){ }
thats it
happy coding
Chhaya
Ajit Kanada
Ranch Hand

Joined: Jan 23, 2001
Posts: 95
Thanx chaya ...its perfectly fine
thanx again
Ajit
Rahul Goel
Greenhorn

Joined: Jul 05, 2002
Posts: 1
hai everyBody,
My Name is Rahul Goel
I have a Problem in the Java in preparing the Online Testing Software. Plz tell me ho can I Hide the Title Bar of the JFrame and please send me the whole code of Changing the Icon of JFrame and adding a JMenuBar on the JPanel


rahul
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Replacinf Java cup icon of JFrame and changing default folder look in JTree
 
Similar Threads
icon on JFrame
Remove default window icon from JFrame
JFrame
JFrame
Remove the "java" icon from a frame?