I have this java swing application class code that I used setBounds in. I want to keep…
- User
I have this java swing application class code that I used setBounds in. I want to keep the same layout and position of all elements while replacing setBounds with BorderLayout and/or GridLayout. (use the most appropriate one). Keep in mind I want all elements' position to be as close as possible to the initial code in which I used setBounds: public class Mouvement extends JFrame {
JLabel lb1, lb2, lb3, lb4, lb6, lb7; JTextField jf4, jf2, jf5, jf6; JRadioButton jr1, jr2; JButton bt1, bt2, bt3, bt4, bt5, bt6; JComboBox<String> jcb, jcb2; JTable tb; JScrollPane sp; public Mouvement() { JPanel jp = new JPanel(); jp.setLayout(null); add(jp); lb1 = new JLabel("Interface de gestion des mouvements"); lb1.setBounds(30, 10, 300, 30); jp.add(lb1);lb2 = new JLabel("Identifiant"); lb2.setFont(new Font("Arial", Font.BOLD, 12)); lb2.setBounds(30, 50, 90, 30); jp.add(lb2); jf2 = new JTextField(); jf2.setFont(new Font("Arial", Font.BOLD, 12)); jf2.setBounds(130, 50, 90, 25); jp.add(jf2); lb3 = new JLabel("Code Produit");
lb3.setBounds(30, 90, 90, 30);jp.add(lb3); jcb2 = new JComboBox(); jcb2.setFont(new Font("Arial", Font.BOLD, 12)); jcb2.setBounds(130, 90, 90, 25); jp.add(jcb2 ); lb4 = new JLabel("Quantite"); lb4.setFont(new Font("Arial", Font.BOLD, 12)); lb4.setBounds(30, 130, 90, 30); jp.add(lb4 ); jf4 = new JTextField(); jf4.setFont(new Font("Arial", Font.BOLD, 12)); jf4.setBounds(130, 130, 90, 25); jp.add(jf4); lb7 = new JLabel("Date"); lb7.setFont(new Font("Arial", Font.BOLD, 12)); lb7.setBounds(30, 170, 90, 30); jp.add(lb7 ); jcb = new JComboBox(); jcb.setBounds(130, 170, 90, 25); jp.add(jcb ); lb6 = new JLabel("Nature"); lb6.setFont(new Font("Arial", Font.BOLD, 12)); lb6.setBounds(30, 210, 90, 30); jp.add(lb6); jr1 = new JRadioButton("Depot"); jr1.setBounds(80, 210, 70, 30); jr1.setBackground(new Color(173, 216, 230)); jp.add(jr1); jr2 = new JRadioButton("Retrait"); jr2.setBounds(150, 210, 70, 30); jr2.setBackground(new Color(173, 216, 230)); jp.add(jr2); jf5 = new JTextField(); jf5.setText("Identifiant"); jf5.setFont(new Font("Arial", Font.BOLD, 12)); jf5.setBounds(30, 290, 101, 25); jp.add(jf5); bt1 = new JButton("Rechercher"); bt1.setBounds(140, 290, 101, 25); jp.add(bt1); bt2 = new JButton("Inserer"); bt2.setBounds(30, 250, 101, 25); jp.add(bt2); bt3 = new JButton("Supprimer"); bt3.setBounds(30, 330, 101, 25); jp.add(bt3); bt4 = new JButton("Modifier"); bt4.setBounds(140, 250, 101, 25); jp.add(bt4); bt5 = new JButton("Produit"); bt5.setBounds(140, 330, 101, 25); jp.add(bt5); bt6 = new JButton("Requetes"); bt6.setBounds(85, 370, 101, 25); jp.add(bt6); DefaultTableModel df = new DefaultTableModel(); init(); jp.add(sp); public void init() { tb = new JTable(); sp = new JScrollPane(); sp.setViewportView(tb); sp.setBounds(300, 40, 450, 300);
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.