Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ajit Kanada
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Chhaya Dhanani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx chaya ...its perfectly fine
thanx again
Ajit
 
Rahul Goel
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic