public Renderer renderer() { if (renderers.getSelectedItem().equals("Serial")) { return new SerialRenderer(); } else if (renderers.getSelectedItem().equals("Parallel")) { return new ForkJoinRenderer(); } else { throw new RuntimeException("Unknown renderer selected: " + renderers.getSelectedItem()); } }
public RendererOptions() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); renderers.addItem("Parallel"); renderers.addItem("Serial"); renderers.addActionListener(actionProvider.actionDelegate()); renderers.setSelectedItem("Parallel"); JPanel upper = new JPanel(); upper.add(new LabeledItem("Render:", renderers)); this.add(upper); }