SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
I didn't have time at the moment to explore all different layouts
JTextArea textArea = new JTextArea(4, 20);
JScrollPane scrollPane = new JScrollPane( textArea );
somePanel.add( scrollPane );
Nicol Green wrote:I use null layout, since I am Java beginner, and I didn't have time at the moment to explore all different layouts, so I choose null, because I can put controls like I would like.
Ok, is it possible somehow to add here vertical scroll bar, in null layout ? And how to do it ?
Paul Clapham wrote:
Nicol Green wrote:I use null layout, since I am Java beginner, and I didn't have time at the moment to explore all different layouts, so I choose null, because I can put controls like I would like.
Ok, is it possible somehow to add here vertical scroll bar, in null layout ? And how to do it ?
Then presumably, since you chose the null layout so you could put the components (they are called "controls" in Visual Basic if I recall right) where you wanted, you should be able to put that scroll pane where you wanted it. But you didn't do that.
Nicol Green wrote:Ok, this is not an issue, lets suppose I can locate components where I want in my panel, but I don't now how to add ScrollBar to my TextArea, which is placed in the panel.
Nicol Green wrote:I just thought this is a friendly place for greenhorns.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:
Nicol Green wrote:I just thought this is a friendly place for greenhorns.
It usually is, but some people don't appreciate it if you ignore their advice, then post a problem that could have been prevented by following that advice.
As SSCCE concerned I am really trying to provide it, but I have about 1000 line of code, and mistakes are possible when copying, once more, sorry for that.
Rob Camick wrote:
Rob Prime wrote:
Nicol Green wrote:I just thought this is a friendly place for greenhorns.
It usually is, but some people don't appreciate it if you ignore their advice, then post a problem that could have been prevented by following that advice.
Add me to that list. And to further the point, there have been several pieces of advice in this posting, yet we still don't have a SSCCE (which has also been suggested in more than one of her postings) to see how all this advice has been applied. So is the problem bad advice or bad implementation of the advice?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Here it is with null layout,
Rob Camick wrote:all Swing components (except for JFrame and JDialog) are visible by default.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:
Rob Camick wrote:all Swing components (except for JFrame and JDialog) are visible by default.
And JInternalFrame (for completeness).
As Rob pointed out you are using the FlowLayout by default on your panel, which mean the setBounds(...) code is completely unnecessary since the layout manager will reset the size and location of the scrollpane based on the rules of the layout manager.
It's exactly the same and completely different as this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|