コード例 #1
0
 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());
   }
 }
コード例 #2
0
  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);
  }