aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes converting borderlayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "converting borderlayout" Watch "converting borderlayout" New topic
Author

converting borderlayout

shaon husain
Ranch Hand

Joined: Mar 20, 2013
Posts: 37
hi, im having trouble using borderlayout, and how its beheaving,


this code produces

however i need it to look like this, but this is done by absolute positioning, and giving me a few problems later on the code:



if you could possibly write the code that would be very generous, but i dont mind examples showing how to do it, or what i can do to fix it
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
You appear to be mixing the old names for the areas in BorderLayout and the new names. Use one or the other. I suggest you start by adding the panels in those positions only, and giving each panel a different colour. Then you can see where they sit. Then try adding the controls to those panels.
What layout are you giving the panels?
Why have you given the class a lower‑case name (pte)?
shaon husain
Ranch Hand

Joined: Mar 20, 2013
Posts: 37
Campbell Ritchie wrote:You appear to be mixing the old names for the areas in BorderLayout and the new names. Use one or the other. I suggest you start by adding the panels in those positions only, and giving each panel a different colour. Then you can see where they sit. Then try adding the controls to those panels.
What layout are you giving the panels?
Why have you given the class a lower‑case name (pte)?


what are the old and new borderlayout styles?
also what do you mean giving the layout a panel?
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
what are the old and new borderlayout styles?


The old style uses compass directions (NORTH, SOUTH...). The new style uses PAGE..., LINE... See the Swing tutorial on Using Border Layout for more information. Also, download the example and use the structure of that program for your project. You should not be extending JFrame to build the GUI and code should execute on the EDT.

also what do you mean giving the layout a panel?


By default a JPanel uses a FlowLayout. You will probably need to change the layout on one or two panels to achieve your desired layout. Experiment with the different layout managers.

Also, don't use TextArea. Use JTextArea.
shaon husain
Ranch Hand

Joined: Mar 20, 2013
Posts: 37
Rob Camick wrote:
what are the old and new borderlayout styles?


The old style uses compass directions (NORTH, SOUTH...). The new style uses PAGE..., LINE... See the Swing tutorial on Using Border Layout for more information. Also, download the example and use the structure of that program for your project. You should not be extending JFrame to build the GUI and code should execute on the EDT.

also what do you mean giving the layout a panel?


By default a JPanel uses a FlowLayout. You will probably need to change the layout on one or two panels to achieve your desired layout. Experiment with the different layout managers.

Also, don't use TextArea. Use JTextArea.


thanks for your help, really appreciate it, take some time to get used to it though,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting borderlayout