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
|
this.panelPlanScenario = new PanelPlanScenario(this.imagePath,(String)this.comboBox.getSelectedItem());
this.panelPlanScenario.setBounds(0,0,this.getWidth()*3/4, this.getHeight()-33);
this.panelCreationScenario = new PanelCreationScenario((String)this.comboBox.getSelectedItem(), (String)this.comboBoxScenario.getSelectedItem(), this, this.panelPlanScenario);
this.panelCreationScenario.setBounds(this.getWidth()*3/4,0,this.getWidth()/4-33, this.getHeight()-33); //Problème avec les -33 pixels
JScrollPane js = new JScrollPane(this.panelCreationScenario);
JScrollPane scroll = new JScrollPane(this.panelPlanScenario);
scroll.setAutoscrolls(true);
scroll.setSize(this.panelPlanScenario.getSize());
scroll.setPreferredSize(this.panelPlanScenario.getSize());
scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scroll.setViewportBorder(new LineBorder(Color.RED));
js.setAutoscrolls(true);
js.setSize(this.panelCreationScenario.getSize());
js.setPreferredSize(this.panelCreationScenario.getSize());
js.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
js.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
js.setViewportBorder(new LineBorder(Color.RED));
js.setBounds(this.getWidth()*3/4,0,this.getWidth()/4-100,this.getHeight()-33);
this.setLayout(new GridBagLayout());
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.VERTICAL;
c.anchor = GridBagConstraints.NORTH;
c.gridx = 0;
c.gridy = 0;
this.add(scroll,c);
c.gridx = 1;
this.add(js,c);
// this.repaint();
this.validate(); |
Partager