• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying text area

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic