This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Replacinf Java cup icon of JFrame and changing default folder look in JTree
 
Similar Threads
JFrame
JFrame
Remove default window icon from JFrame
Remove the "java" icon from a frame?
icon on JFrame