Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Layout Problems

 
Greg Roberts
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • 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?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • 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
  • 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.



 
Ko Wey
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following code should quiz the content of a directory
and show the non-directory files in the jtextarea
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic