• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Displaying text area  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I have a little GUI with 5 buttons down the left and a text area on the right, it does not display the text area unless i instantiate it with some text, and even then, its only 1 line big. How can i get it to show when i run my app on the entire right hand side of my GUI?
Also, how do I set the size of my GUI, I want it to start in a position centered in my screen and at least double the sixe it is at the moment.
My code is attached.
Many thanks
Ian
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could add the JTextArea to the center of your BorderLayout directly and not to a panel first. There should be some center logic in this forum somewhere. Try a search and let us know if you find it.
We really need a forum FAQ.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ian,
For the textarea, u can set the size using setPreferredSize.. u that u need not have to instantiate textarea with some text...
If you are using BorderLayout, put the entire app in the center..
If you want you GUI to appear in the center of th e window, then use the following code :
JDialog d = new JDialog();
Dimension size = d.getToolkit().getScreenSize();
setLocation((size.width - 750) / 2, (size.height - 500) / 2);
Hope this helps you,
Deepa Raghuraman
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!