1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package projet;
/**
*
* @author abouchan
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Form_ordre extends JFrame {
private JList colorList,personneList, copyList;
private JButton copyButton;
private String colorNames[] = {"Black", "Blue", "Cyan", "Dark Gray", "Gray", "Green", "Light Gray", "Magenta",
"Orange", "Pink", "Red", "White", "Yellow"};
private String personne[]={"omar", "hicham"};
public Form_ordre() {
super("Multiple Selection");
Container container = getContentPane();
container.setLayout(new FlowLayout());
colorList = new JList(colorNames);
colorList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
container.add(colorList);
personneList = new JList(personne);
personneList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
container.add(personneList);
copyButton = new JButton("Ajouter>>>");
copyButton.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent event) {
copyList.setListData(colorList.getSelectedValues());
}
});
container.add(copyButton);
copyList = new JList();
copyList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
container.add(copyList);
setSize(400, 400);
setVisible(true);
}
} |
Partager