SHARE
TWEET

Untitled

a guest Nov 22nd, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package test;
  2.  
  3. import java.awt.BorderLayout;
  4. import javax.swing.JList;
  5. import java.awt.EventQueue;
  6. import java.util.ArrayList;
  7.  
  8. import javax.swing.DefaultListModel;
  9. import javax.swing.JFrame;
  10. import javax.swing.JPanel;
  11. import javax.swing.border.EmptyBorder;
  12.  
  13. public class s extends JFrame {
  14.  
  15.     private JPanel contentPane;
  16.  
  17.     /**
  18.      * Launch the application.
  19.      */
  20.     public static void main(String[] args) {
  21.         JFrame frame = new JFrame("AREA TEST");
  22.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  23.         frame.setBounds(100, 100, 450, 300);
  24.         JPanel pannel =new JPanel();
  25.        
  26.         ArrayList<String> al = new ArrayList<String>();
  27.         al.add("AAA");
  28.         al.add("PD");
  29.         al.add("Funziona");
  30.        
  31.         DefaultListModel<String> model = new DefaultListModel<String>();
  32.         for(String s:al){
  33.             model.addElement(s);
  34.         }
  35.         JList<String> contactList = new JList<String>(model);
  36.        
  37.    
  38.         frame.add(contactList);
  39.         frame.setVisible(true);
  40.     }
  41.  
  42.  
  43.  
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top