Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Title from Jpanel to Jframe

 
Venkatesh Raman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have two Radio Buttons on a Jpanel. And this Jpanel is placed on a JFrame. Now based on the radio buttons the user clicks I need to change the title on the Jframe.
Can anybody help me on this.
Thanks
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this, not sure it works or not.
myJFrame.setTitle("Some Title");
myJFrame.repaint();

------------------
Happy Coding,
Gregg Bolinger
 
Venkatesh Raman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How do I get the Frame from the Jpanel ?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume your code looks similar to this??

frame is your JFrame.
In your Radio Button Listener, just access frame like, frame.setTitle("fjdsk");

------------------
Happy Coding,
Gregg Bolinger
[This message has been edited by Gregg Bolinger (edited October 25, 2001).]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have two choices... you can either do things the "normal" way...


Or, if you have a specialized child of Panel... the "other" way...




-Nate
 
Venkatesh Raman
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot guys !!! It works perfectly !!! It is really great to post on this site..
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even better to get the answers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic