• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make scrolling area bigger. i.e. increase window size?

 
Ranch Hand
Posts: 48
Firefox Browser Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know that you use either the JPanel revalidate() or the JScrollPane revalidate().

Which one I don't know. However, I did both and still it's not resizing.

I know that there's some other line of code I needed but can't recall what it was.

I thought it might be the JFrame pack() method, but that didn't do it either.

 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm finding it difficult to guess what information you are looking for. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.
 
Paul Adcock
Ranch Hand
Posts: 48
Firefox Browser Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I have a class that is a JPanel subclass itself.

And I have a JFrame object that has as content pane a JScrolllPane that has a JPanel that holds 3 JPanels, one of them being the class itself.

The one for the class itself also got added scrolls to it.

The contentPane of the JFrame is called bigPanel. The JFrame is called jf.

The JScrollPane, I think of the entire thing, the content pane of the JFrame, is called jsp. (The JScrollPane with the class itself was a simple object with the new ScrollPane(.....,.....,.....)) and no name.
revalidate();
bigPanel.revalidate();
bigPanel.setSize(5000,5000);
jf.setSize(5100,5100);

revalidate();
bigPanel.revalidate();
jsp.revalidate();


Though it has no components being added, though I might add JComponent or Canvas items later, right now I want to know how to make the size of everything be 5000, I made the JFrame be a bit bigger as it has a few other things. Anyway, it's not resizing and I can't scroll down. (I don't think a 5000 by 5000 screen would show up all in view at once.)


I wonder if the method setPreferredSize() was the other part I was looking for.


Yep, that's what it was.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic