Home > Net >  BorderLayout JSwing java
BorderLayout JSwing java

Time:02-10

Suspect is a class type like student

How can i create a GUI like this

How can i create jlist like this and how i can go to the previous gui where i am searching for Suspects?

import java.util.ArrayList;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class SuspectPage extends JFrame  {
private JPanel panel = new JPanel();
private JButton sms = new JButton ("Find SMS");
private JButton back = new JButton ("Back to Search Screen") ;
private Suspect s ;
private ArrayList<Suspect> sus ; 
private JTextField name ;
private JTextField codename ; 
private JTextField number ;
private JTextField text ;
private JTextField partners ;
private JTextField suggested  ;
private JLabel label1 = new JLabel ("Parnters ") ;
private JLabel label2 = new JLabel ("Suggested Parnters ----> ") ; 
private JList numbers = new JList() ;



public SuspectPage(Suspect aSuspect , ArrayList<Suspect> suspects) {
    s=aSuspect ;
    sus= suspects ; 
    this.setVisible(true) ;
    this.setContentPane(panel) ;
    this.setTitle("SuspectPage");
    this.setSize(400,700) ;
    this.setDefaultCloseOperation(EXIT_ON_CLOSE) ;
    name =new JTextField (s.getName());
    codename = new JTextField (s.getCodename()) ;
    panel.add(sms) ;
    panel.add(back); 
    panel.add(name) ; 
    panel.add(codename) ;
    
}
    
        
    }

CodePudding user response:

  •  Tags:  
  • Related