I created a GUI that extends JFrame. The GUI has several textfields, buttons, labels and lists. The problem arises when i minimise the window and then maximise it. The textfields stay in place but the list, labels and buttons stick to the top of the window after maximising! Please Help
this is the part of the code where i add a list, label and button for example:
l = new List(); l.setSize(250, 200); l.setLocation(500, 250); l.setVisible(true); l.setFocusable(true); M.add(l);//was M l.setFont(new Font("sansserif", Font.BOLD, 15));//set the txt font n size patientListTitle=new Label("PID: Patient's Name:"); patientListTitle.setSize(200, 50); patientListTitle.setLocation(500, 200); patientListTitle.setForeground(Color.BLACK); patientListTitle.setBackground(Color.white); patientListTitle.setVisible(true); patientListTitle.setFocusable(true); M.add(patientListTitle);//was M Select.setSize(50, 25); Select.setLocation(500, 580); Select.setVisible(true); Select.setFocusable(true); M.add(Select);//was M Select.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { System.out.println("Select Button clicked"); // ADD STUFF HERE :D getIndexedItem=l.getItem(l.getSelectedIndex()); System.out.println(getIndexedItem); try { deletePatient(getIndexedItem, l.getSelectedIndex()); } catch (SQLException ex) { Logger.getLogger(javaapplication2.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(javaapplication2.class.getName()).log(Level.SEVERE, null, ex); } } }); repaint(); try { retrievePatient(); } catch (SQLException ex) { Logger.getLogger(javaapplication2.class.getName()).log(Level.SEVERE, null, ex); } repaint();