import java.awt.*;import java.awt.event.*;import java.util.*; import javax.swing.*;public class RandomTest extends JFrame{ private Vector zahlen; private JList list; JPanel mainPanel; public RandomTest() { setDefaultCloseOperation(EXIT_ON_CLOSE); setBounds(500,400,150,150); zahlen=new Vector(); for(int i=1;i<6;i++){zahlen.addElement(""+i);} list =new JList(zahlen); mainPanel=new JPanel(new BorderLayout()); mainPanel.add(list,BorderLayout.CENTER); JButton newRndBut = new JButton("neue Reihenfolge"); newRndBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { newRandom(); mainPanel.repaint(); } }); mainPanel.add(newRndBut,BorderLayout.SOUTH); setContentPane(mainPanel); setVisible(true); } private void newRandom() { Collections.shuffle(zahlen); list=new JList(zahlen); } public static void main(String[] args) { new RandomTest(); }}