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

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

 
Paul Adcock
Ranch Hand
Posts: 48
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • 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.

 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • 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 Java Notepad
  • Mark post as helpful
  • send pies
  • 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.

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