• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beginner Swing - TextAerea size problem

 
Jochen Rittmann
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, i´am beginner. After hours of trying and searching in forums i give up.

I have a simple form with a textarea. Created with VisualEditor.

How can i resize the textarea??? There is no attribute or other possiblities to make it bigger with mouse action in development.

function 'initcompontents'
add(getJScrollPane0(), new Constraints(new Leading(8, 100, 10, 10), new Leading(151, 80, 47, 47)));

private JScrollPane getJScrollPane0() {
if (jScjtLog == null) {
jScjtLog = new JScrollPane();
jScjtLog.setViewportView(getJtLog());
}
return jScjtLog;
}

private JTextArea getJtLog() {
if (jtLog == null) {
jtLog = new JTextArea(240,240);
jtLog.setEditable(false);
jtLog.setText("");
jtLog.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
return jtLog;
}

Thank you,
Jochen
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out setPreferredSize()

Note: Not all layout managers respect the preferred size. Usually one does not set the size for the text area. Just wrap it in a JScrollPane and add the pane to the parent container. The scroll pane helps the user view/interact with the "hidden" text.
Also, do yourself a favor and drop the visual editor. You end up learning the editors than the actual coding. Search the forums to find many discussions on why editors are a bad idea.
 
Rob Camick
Ranch Hand
Posts: 2613
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Use more realistic values. Now you are asking for a text area with 240 rows and 240 columns.

If you do set the preferred size, it should be done on the scroll pane, NOT the text area.
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please UseCodeTags next time. See how much better Rob's little code snippet looks compared to yours.
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote: See how much better Rob's little code snippet looks compared to yours.

Er Rob, surely you mean Rob's code snippet
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what I said!

Seriously, Rob, I apologize for mistaking you for Michael. It's just that you two are both such helpful members here in the GUI forum.
 
Jochen Rittmann
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

thank you for help!

The problem was the Dialog add functionallity like


The other size functions for the objects did not work, because this one is the one, that is working. I learned a lot.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic