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 98
|
public JMaFrame(String aNameString){
super(aNameString);
setSize(1024,768);
JBackPanel jc = new JBackPanel();
jc.setPreferredSize(new Dimension(800,600));
this.getContentPane().add(jc);
jc.setLayout(new GridBagLayout());
//ajout du bouton
GridBagConstraints gbc = new GridBagConstraints();
gbc.weightx = 1;
gbc.weighty = 1;
gbc.gridx = 0;
gbc.gridwidth = 3;
gbc.gridheight = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.NONE;
anOKButton=new JButton("OK");
jc.add( anOKButton, gbc);
//ajout de la liste
gbc=new GridBagConstraints();
gbc.weightx = 1;
gbc.weighty = 1;
gbc.gridx = 0;
gbc.gridwidth = 1;
gbc.gridheight = 3;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.BOTH;
aCapList=new JList(aCapFile);
aCapList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
aCapList.setOpaque(false);
aCapList.setCellRenderer(new Cellrender());
//JScrollPane aScrollPane=new JScrollPane(aCapList);
//aScrollPane.setOpaque(false);
//aScrollPane.setBackground(new Color(0,0,0,0));
//jc.add( aScrollPane, gbc);
jc.add(aCapList, gbc);
//ajout de la liste de cases à cocher
gbc=new GridBagConstraints();
gbc.weightx = 1;
gbc.weighty = 1;
gbc.gridx = 2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridy = 2;
//gbc.fill = GridBagConstraints.HORIZONTAL;
groupe = new ButtonGroup();
bouton1 = new JRadioButton("Test 1");
groupe.add(bouton1);
bouton2 = new JRadioButton("Test 2");
groupe.add(bouton2);
unpanel=new JPanel(new BorderLayout());
JLabel label=new JLabel("Test");
unpanel.add(label,BorderLayout.NORTH);
unpanel.add(bouton1,BorderLayout.CENTER);
unpanel.add(bouton2,BorderLayout.SOUTH);
label.setForeground(Color.red);
bouton1.setOpaque(false);
bouton1.setForeground(Color.RED);
bouton1.setSelected(true);
bouton2.setOpaque(false);
bouton2.setForeground(Color.RED);
unpanel.setOpaque(false);
jc.add(unpanel,gbc);
this.pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
} |
Partager