Я хотел бы знать, как я могу изменить положение JTextField.Если я делаю так:
top.add(tdate);
, это помещает JTextField в то же направление / линию, что и мой JComboBox.Я хотел бы изменить положение Y и X моего JTextField.Можете ли вы сказать мне, как я могу это сделать?
//Button CreateM
public class ActionMariage extends JFrame implements ActionListener
{
JComboBox combo1 = new JComboBox();
JComboBox combo2 = new JComboBox();
JComboBox combo3 = new JComboBox();
JComboBox combo4 = new JComboBox();
public void actionPerformed(ActionEvent evt)
{
JPanel container = new JPanel();
JButton bAjouterm = new JButton ("Ajouter");
JTextField tdate=new JTextField("Entrez la date du mariage");
JLabel labelm = new JLabel("Date du mariage :");
this.setTitle("Filliations");
this.setSize(1000, 400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null);
container.setBackground(Color.white);
container.setLayout(new BorderLayout());
combo1 = new JComboBox(tab3);
combo2 = new JComboBox(tab1);
combo3 = new JComboBox(tab3);
combo4 = new JComboBox(tab2);
combo1.setPreferredSize(new Dimension(100,20));
combo1.setForeground(Color.black);
combo2.setPreferredSize(new Dimension(300,20));
combo2.setForeground(Color.black);
combo3.setPreferredSize(new Dimension(100,20));
combo3.setForeground(Color.black);
combo4.setPreferredSize(new Dimension(300,20));
combo4.setForeground(Color.black);
JPanel top = new JPanel();
top.add(combo1);
top.add(combo2);
top.add(combo3);
top.add(combo4);
top.add(bAjouterm);
top.add(bModifierm);
top.add(labelm);
top.add(tdate);
combo1.addActionListener(new cm1());
combo2.addActionListener(new cp1());
combo3.addActionListener(new cm2());
combo4.addActionListener(new cp2());
bAjouterm.addActionListener(new ajouterm());
container.add(top, BorderLayout.NORTH);
this.setContentPane(container);
this.setVisible(true);
}
}