package pkg1;
import java.awt.*;
import javax.swing.*;
public class Main {
public static void main(String[] args) {
JFrame frm = new JFrame("Title");
JTextField txt = new JTextField();
JLabel lbl = new JLabel("To");
JTextField txt2 = new JTextField();
frm.setLayout(new GridLayout(2,2,5,5));
frm.add(txt);
frm.add(lbl);
frm.add(txt2);
frm.setSize(500,100);
frm.setVisible(true);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setLocationRelativeTo(null);
}
}
Someone please explaine to me how to change the location on my txt2 to be aligned w/ my txt1.
I habe been searching the net for hours but the solutions they show seems to have no effect?