How do I place the JToolBar at the bottom of my JFrame (like a MS visual component)?

I am building a Swing MDI application with many JInternalFrames and all. Now I want to create a JToolBar and place it at the bottom of the main JFrame (like a MS visual component)?

What would be the best implementation?

I try so hard, but this is not a visually good approach:

jDesktopPane.add(jToolBar1);
jToolBar1.setSize(new Dimension(?, ?));
jToolBar1.setLocation(?, ?);

      

+3


source to share


1 answer


You can use the borderLayout class: this is an example from: http://docs.oracle.com/javase/7/docs/api/java/awt/BorderLayout.html



import java.awt.*;
 import java.applet.Applet;

 public class buttonDir extends Applet {
   public void init() {
     setLayout(new BorderLayout());
     add(new Button("North"), BorderLayout.NORTH);
     add(new Button("South"), BorderLayout.SOUTH);
     add(new Button("East"), BorderLayout.EAST);
     add(new Button("West"), BorderLayout.WEST);
     add(new Button("Center"), BorderLayout.CENTER);
   }
 }

      

+1


source







All Articles