Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionScanSet scans;
@SuppressWarnings("serial") public class ScanSet extends TreeSet<Scan> implements Visitable { //code }
private void updateInterpolation(boolean updateReference) { Scan ref = (Scan) getProfilComboBox().getSelectedItem(); VisualisationVisitor visu; try { if (updateReference) { for (Scan scan : scans) if (scan.toString().equals(ref.toString())) { visu = new VisualisationVisitor(); scan.accept(visu); datas.removeSeries(rs.getString("measuresCurveTitle")); datas.addSeries(rs.getString("measuresCurveTitle"), visu.getDatas()); break; } } InterpolationCurveVisitor interpolate = new InterpolationCurveVisitor(getSpacing()); interpolated = (ScanSet) scans.clone(); interpolated.accept(interpolate); for (Scan scan : interpolated) if (scan.toString().equals(ref.toString())) { visu = new VisualisationVisitor(); scan.accept(visu); datas.removeSeries(rs.getString("interCurveTitle")); datas.addSeries(rs.getString("interCurveTitle"), visu.getDatas()); break; } } catch (DicomException ex) { ex.printStackTrace(); } }
public void accept(Visitor visitor) throws DicomException { visitor.visit(this); }
Dans le actionPerformed, quand tu veux récupérer l'élément sélectionné, tu n'obtiens que le premier ou le deuxième donc ?
Par contre, à l'affichage de la liste du combo, tout tes éléments sont bien affichés ?
for(int i = 0; i < 10; i++) { Scan scan = new Scan(); scan.setY(i); for(int j = 0; j < 10; j++) scan.add(new Measure(i, j)); jComboBox.addItem(scan); }
ScanSet scans = new ScanSet(); for(int i = 0; i < 10; i++) { Scan scan = new Scan(); scan.setY(i); for(int j = 0; j < 10; j++) scan.add(new Measure(i, j)); scans.add(scan); } jComboBox.setModel(new DefaultComboBoxModel(scans.toArray(new Scan[0])));