Ok, ive gotten most of it to work, thank god.. anyways My problem is with the border layout. I need two textfields in the NORTH, but when i add both of them, they just become one big textfield. I think that the last one i add just overwrites the one before it. Is there a way i can get around that and put two textfields in the same area? I tried using the GridLayout, but i only have three components to add, and i need the third one centered. The Grid Layout wont let me center the third one, so i cant use it. Anyways Here's my code , if someone can help me, that would be greatly appreciated.
:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Pgm6 extends JFrame
{
private JTextField txt;
private JTextField txt2;
private BorderLayout layout;
private FlowLayout layout2;
private JCustom cust;
public Pgm6()
{
super("Frame Title");
layout = new BorderLayout();
Container c = getContentPane();
c.setLayout(layout);
txt = new JTextField(10);
txt2 = new JTextField(10);
cust = new JCustom();
c.add(txt, BorderLayout.NORTH);
c.add(txt2, BorderLayout.NORTH);
c.add(cust, BorderLayout.CENTER);
setSize(100,100);
setVisible(true);
}
class JCustom extends JPanel
{
public Dimension getPrefferedSize()
{
return new Dimension (50,90);
}
public void paintComponent(Graphics g)
{
super.paintComponent (g);
setBackground(Color.yellow);
}
public JCustom()
{
setLayout (new BorderLayout());
JPanel p = new JPanel();
p.setLayout(new FlowLayout());
add(p,BorderLayout.NORTH);
add(txt,BorderLayout.SOUTH);
}
}
public static void main(String args[])
{
Pgm6 application = new Pgm6();
application.setDefaultCloseOperation(JFrame.EXIT_O N_CLOSE );
}
}
:
There it is, don't laugh

. If you compile it, you'll see that there is only one textfield at the top, i need two of them there.