• 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

Layout Problems

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I am attempting to set up a GUI that looks like this:



I am creating a custom frame, and inside the frame I am building panels to house the components. The button at the bottom is in a panel, the JTextAreas in the middle are in a panel, and the display area at the top is in a panel. I am trying BorderLayout, adding the text areas to the center, but they are squeezed together, leaving blank spaces for east and west. Is there any way to either have the center panel expand (essentially removing east and west) or place the JTextAreas in east and west, but have them close in (removing center)?

Or should I throw out BorderLayout altogether and use something else?
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One approach is to nest different layouts.

BorderLayout might be fine for establishing your top, center, and bottom regions. But in the center of this BorderLayout, you could add a single panel that uses a different layout Manager -- perhaps a GridLayout.

The following link should help...

http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html
 
Greg Roberts
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I pretty much worked out the display, now I'm on the hard part. I need to be able to open up a directory, rename some files in the directory, and write those files with their new filenames to some new directories. I've set up the JFileChoosers so they come up and only let the user select directories. Now I'm not sure how to proceed from here. The Java book we're using doesn't cover what I need here.

Here's what I've got so far. These are only the action listeners for the menu choices to select source and destination folders.



 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Following code should quiz the content of a directory
and show the non-directory files in the jtextarea
 
reply
    Bookmark Topic Watch Topic
  • New Topic