Napozicoval jsem si tlacitka a krasne se mi zobrazili do spodni casti, ale ve chvili, kdy vlozim JTextField tak se mi to vsechno narve na 1. radek a pozicovani proste nejde. Nemel by nekdo tip jak to rozchodit a jak pozicovat ten JTextField? Diky moc.
*kod orezan importy*
public class GUI extends JDialog implements ActionListener {
public JButton quit = new JButton("Quit");
public JButton logged = new JButton("Logged");
public JTextField day = new JTextField(Date.day(), 2);
public JTextField month = new JTextField(Date.month(), 2);
public JTextField year = new JTextField(Date.year(), 4);
public FlowLayout layout = new FlowLayout();
public GUI() {
super();
setSize(500, 500);//doupravit velikost okna
Dimension obrazovka = Toolkit.getDefaultToolkit().getScreenSize();
setLocation(obrazovka.width / 4, obrazovka.height / 4);
setResizable(false);
setModal(true);
setTitle("Logged geocoin(s)");
quit.setSize(60, 30);//doupravit pozici
quit.setLocation(420, 430);
logged.setSize(80, 30);//doupravit pozici
logged.setLocation(15, 430);
getContentPane().setLayout(null);
getContentPane().add(quit);
getContentPane().add(logged);
quit.addActionListener(this);
quit.setActionCommand("quit");
logged.addActionListener(this);
logged.setActionCommand("logged");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
day.setLocation(15, 430);
getContentPane().setLayout(layout);
getContentPane().add(day);
getContentPane().add(month);
getContentPane().add(year);
}
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("quit")) {
dispose();
} else if (e.getActionCommand().equals("logged")) {
//dodefinovat main
}
}
public static void main(String args[]) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GUI dlg = new GUI();
dlg.setVisible(true);
}
});
}
}