Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Resizing JFrame

 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have the following requirement. Any idea on how to implement would be of great help.

I have a JFrame and a JTable sitting inside it. Now when user resizes the JFrame (reduces the size), after certain size, somepart of the JTable is being cut (out of view). Instead what I need is, to change the font size of all the components in JTable and fit it inside the resized JFrame. Can someone let me know of how to approach this. What listener to be added to JFrame to get notified of the above mentioned scenario.

Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> What listener to be added to JFrame to get notified of the above mentioned scenario.

ComponentListener's componentResized(...)

add it to the frame, it will fire after resize
or, add it to the contentPane and it will fire during resize i.e. multiple times
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthick Dharani Vidhya wrote: Instead what I need is, to change the font size of all the components in JTable and fit it inside the resized JFrame. Can someone let me know of how to approach this.


Just out of curiosity, why do you want to do that? To maintain the user experience, are you also going to increase the font size if the user has a bigger screen or a higher screen resolution?
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maneesh,

Not with the Resolution of screen.

But when he increases the size of the window, font size of all the components insde it should increase. And in reverse, when he reduces the JFrame size, all components font size should come down so that it fits inside the small JFrame.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but you missed out on my first question. Why do you want to do that? I have never seen any application which behaves this way.
 
Karthick Dharani Vidhya
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Requirement from Clients :-)
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thought as much
Thank you and the very best of luck with this particular client

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!