This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to make scrolling area bigger.  i.e. increase window size? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "How to make scrolling area bigger.  i.e. increase window size?" Watch "How to make scrolling area bigger.  i.e. increase window size?" New topic
Author

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

Paul Adcock
Ranch Hand

Joined: Jan 22, 2011
Posts: 41

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.


Hi all.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4203
    
    3

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.


luck, db
There are no new questions, but there may be new answers.
Paul Adcock
Ranch Hand

Joined: Jan 22, 2011
Posts: 41

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.

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to make scrolling area bigger. i.e. increase window size?
 
Similar Threads
How to repaint/refresh/redraw JPanel
Repaint and ComponentListener
dynamically adding a JPanel in JFrame - not reflecting
Swing : refreshing panels
Removing component