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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
import javax.swing.JScrollPane;
import javax.swing.border.LineBorder;
import java.awt.GridLayout;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import javax.swing.JLabel;
public class Test extends javax.swing.JDialog
{
private static final long serialVersionUID = 1L;
private JScrollPane Scroll;
private JPanel myPanel ;
private JButton Return;
private JLabel Message;
public Test(JFrame jf) // Constructeur
{
super(jf,true);
setSize(416,644);
getContentPane().setLayout(null);
getContentPane().setBackground(Color.BLACK);
LineBorder border = new LineBorder(Color.YELLOW, 3);
getRootPane().setBorder(border);
this.setUndecorated(true);
myPanel = new JPanel();
myPanel.setBackground(Color.BLACK);
myPanel.setLayout(new GridLayout(0, 1));
Scroll = new JScrollPane( );
Scroll.setViewportView(myPanel);
Scroll.setBounds(10, 10, 393, 535);
Scroll.setLocation(10, 10);
Return = new JButton("Return");
Return.setBounds(152, 582, 89, 23);
Return.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0) { finish();}
});
Message = new JLabel("Cocher les lignes à conserver.");
Message.setForeground(Color.CYAN);
Message.setBounds(20, 557, 375, 14);
getContentPane().add(Scroll);
getContentPane().add(Return);
getContentPane().add(Message);
loadTitres();
this.setLocationRelativeTo(null);
setVisible(true);
}
private void finish()
{
this.setVisible(false);
return;
}
private void loadTitres()
{
System.out.println("Début du chargement.");
try
{
String line = "Ceci est la ligne : ";
for (int i =0; i<7000; i++)
{
String curline = line + (i+1) ;
JCheckBox cb = new JCheckBox(curline);
cb.setForeground(Color.YELLOW);
cb.setBackground(Color.BLACK);
myPanel.add(cb);
}
myPanel.revalidate();
myPanel.repaint();
System.out.println("Fin du chargement");
}
catch (Exception ex) { System.out.println("Erreur de chargement");}
}
public static void main(String[] args)
{
new Test(new JFrame());
}
} |
Partager