Ejemplo n.º 1
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   dlg.panelMain.mark.setObject(Obj.UNKOBJ);
   dlg.panelMain.mark.setCategory(Cat.NOCAT);
   dlg.panelMain.mark.setTopmark(Top.NOTOP);
   if (mooringButton.isSelected()) {
     dlg.panelMain.mark.setObject(Obj.MORFAC);
     categoryBox.setVisible(false);
     mooringBox.setVisible(true);
     pillarButton.setEnabled(false);
     sparButton.setEnabled(false);
     beaconButton.setEnabled(false);
     towerButton.setEnabled(false);
     stakeButton.setEnabled(false);
     cairnButton.setEnabled(false);
     mooringButton.setBorderPainted(true);
   } else {
     mooringBox.setVisible(false);
     categoryBox.setVisible(true);
     pillarButton.setEnabled(true);
     sparButton.setEnabled(true);
     beaconButton.setEnabled(true);
     towerButton.setEnabled(true);
     stakeButton.setEnabled(true);
     cairnButton.setEnabled(true);
     mooringButton.setBorderPainted(false);
   }
   syncPanel();
 }
Ejemplo n.º 2
0
 /** Sets the selection back to move/select. */
 private void resetSelectMove() {
   JToggleButton selectButton = getButtonForType(selectType);
   if (!(selectButton.isSelected())) {
     selectButton.doClick();
     selectButton.requestFocus();
   }
 }
 public synchronized void setPlayer(Player player) {
   if (this.player != null) {
     this.player.removeChangeListener(this);
     player.removePropertyChangeListener(this);
   }
   this.player = player;
   //        boundedRangeModel = player == null ? null : player.getBoundedRangeModel();
   boundedRangeModel = player == null ? null : player.getTimeModel();
   slider.setModel(boundedRangeModel);
   if (player != null) {
     if (player.getState() >= Player.REALIZED
         && boundedRangeModel != null
         && boundedRangeModel.getMaximum() == 0) {
       setPlayerControlsVisible(false);
     }
     slider.setProgressModel(player.getCachingModel());
     startButton.setSelected(player.isActive());
     player.addChangeListener(this);
     player.addPropertyChangeListener(this);
     audioButton.setVisible(player.isAudioAvailable());
     audioButton.setSelected(player.isAudioEnabled());
     colorCyclingButton.setVisible(
         (player instanceof ColorCyclePlayer)
             ? ((ColorCyclePlayer) player).isColorCyclingAvailable()
             : false);
     colorCyclingButton.setSelected(
         (player instanceof ColorCyclePlayer)
             ? ((ColorCyclePlayer) player).isColorCyclingStarted()
             : false);
     validate();
     repaint();
     BoundedRangeModel cachingControlModel = slider.getProgressModel();
   }
 }
  public void actionPerformed(ActionEvent event) {
    Object source = event.getSource();
    if (boundedRangeModel != null) {
      int value = boundedRangeModel.getValue();
      if (source == forwardButton) {
        boundedRangeModel.setValue(
            value == boundedRangeModel.getMaximum() ? boundedRangeModel.getMinimum() : value + 1);
      } else if (source == rewindButton) {
        boundedRangeModel.setValue(
            value == boundedRangeModel.getMinimum() ? boundedRangeModel.getMaximum() : value - 1);
      } else if (source == startButton) {
        if (startButton.isSelected() != player.isActive()) {
          if (startButton.isSelected()) {
            player.start();
          } else {
            player.stop();
          }
        }
      } else if (source == audioButton) {

        player.setAudioEnabled(audioButton.isSelected());
      } else if (source == colorCyclingButton) {
        if (player instanceof ColorCyclePlayer) {
          ((ColorCyclePlayer) player).setColorCyclingStarted(colorCyclingButton.isSelected());
        }
      }
    }
  }
 @Override
 public void actionPerformed(ActionEvent e) {
   for (JToggleButton radio : radioButtons) {
     radio.setSelected(false);
     context.setCurrentOutputTool(QueryContext.TABLE_VIEW);
   }
 }
Ejemplo n.º 6
0
 public void mouseEntered(MouseEvent e) {
   JToggleButton btn = (JToggleButton) c;
   btn.setForeground(Color.red);
   btn.setBackground(Color.orange);
   Cursor cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
   btn.setCursor(cursor);
 }
Ejemplo n.º 7
0
 public void actionPerformed(ActionEvent event) {
   if (event.getSource() == joinButton) {
     if (joinButton.isSelected()) {
       mThread =
           new MulticastThread(
               Integer.valueOf(portField.getText()), chatIPField.getText(), chatroomArea, true);
       (new Thread(mThread)).start();
     }
   }
   if (event.getSource() == sendButton) {
     mThread.send(usernameField.getText(), chatMsgField.getText());
     chatMsgField.setText("");
   }
   if (event.getSource() == leaveButton) {
     try {
       joinButton.setSelected(false);
       mThread.leave();
       System.out.println("Disconnected from chat ");
     } catch (Exception e) {
     }
   }
   if (event.getSource() == exitButton) {
     System.exit(0);
   }
 }
Ejemplo n.º 8
0
 public void hide(boolean refresh) {
   container.remove(layout);
   if (showMeasurements.isSelected()) {
     container.remove(measurements);
     showMeasurements.setSelected(false);
   }
   if (refresh) core.refreshDisplay();
 }
Ejemplo n.º 9
0
 public JToggleButton addToggleAction(IToggleAction action) {
   JToggleButton tglBtn = new JToggleButton();
   tglBtn.setAction(action);
   super.add(tglBtn);
   action.getToggleComponentHolder().addToggleableComponent(tglBtn);
   initialiseButton(action, tglBtn);
   return tglBtn;
 }
Ejemplo n.º 10
0
  public void addButton(JToggleButton b) {
    imagePanel.add(b);

    b.setForeground(Color.black);
    b.setBackground(Color.white);
    b.setFocusable(false);
    b.addMouseListener(new PopupMouseListener(b));
    b.addActionListener(new PopupActionListener(b));
  }
Ejemplo n.º 11
0
 private void jbInit() throws Exception {
   panel1.setLayout(xYLayout1);
   panel1.setBackground(new Color(251, 236, 175));
   jToggleButton5.setText("Done");
   jToggleButton5.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jToggleButton5_actionPerformed(e);
         }
       });
   jLabel1.setToolTipText("");
   jList1.addMouseListener(
       new java.awt.event.MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           jList1_mouseClicked(e);
         }
       });
   HireFire.setText("Hire/Fire");
   HireFire.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           HireFire_actionPerformed(e);
         }
       });
   jButtonAdvertise.setText("Advertise");
   jButtonAdvertise.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jButtonAdvertise_actionPerformed(e);
         }
       });
   jTextFieldWage.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           jTextFieldWage_actionPerformed(e);
         }
       });
   jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
   jLabel3.setText("Amount");
   jLabel5.setText("jLabel5");
   jTextFieldWage.setText("100");
   panel1.add(jList1, new XYConstraints(9, 10, 206, 250));
   panel1.add(jTextPane2, new XYConstraints(9, 262, 467, 109));
   panel1.add(jLabel1, new XYConstraints(476, 9, 10, 226));
   panel1.add(jLabel2, new XYConstraints(2, 454, 58, 12));
   panel1.add(jToggleButton5, new XYConstraints(385, 397, 75, 26));
   panel1.add(HireFire, new XYConstraints(9, 429, 134, 26));
   panel1.add(jPanel1, new XYConstraints(217, 10, 259, 250));
   this.getContentPane().add(panel1, BorderLayout.SOUTH);
   panel1.add(jButtonAdvertise, new XYConstraints(183, 401, 116, -1));
   panel1.add(jTextFieldWage, new XYConstraints(69, 403, 102, 24));
   panel1.add(jLabel3, new XYConstraints(19, 400, 46, 29));
   panel1.add(jLabel4, new XYConstraints(155, 460, 44, 6));
   panel1.add(jLabel5, new XYConstraints(507, 92, 5, 47));
   this.setVisible(true);
 }
Ejemplo n.º 12
0
 private void disconnect() {
   if (session != null && session.isConnected()) {
     session.disconnect();
   }
   jToggleButtonConnect.setSelected(false);
   jToggleButtonConnect.setText("Connect");
   jToggleButtonRegister.setSelected(false);
   onlineUsers.clear();
   jToggleButtonRegister.setText("Register");
 }
Ejemplo n.º 13
0
 public void actionPerformed(ActionEvent e) {
   // String currentMessage = clientWindowFrame.massageField.getText();
   // clientWindowFrame.massageField.setText(currentMessage+"/*" +((JButton) c).getText()+"*/");
   JToggleButton btn = (JToggleButton) c;
   btn.setForeground(Color.black);
   btn.setBackground(Color.white);
   mouseMenu.setVisible(false);
   actionButton.setIcon(btn.getIcon());
   actionButton.setToolTipText(btn.getToolTipText());
 }
Ejemplo n.º 14
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   dlg.panelMain.mark.clrMark();
   if (noticeButton.isSelected()) {
     dlg.panelMain.mark.setObject(Obj.NOTMRK);
     noticeButton.setBorderPainted(true);
   } else {
     dlg.panelMain.mark.setObject(Obj.UNKOBJ);
     noticeButton.setBorderPainted(false);
   }
   dlg.panelMain.syncPanel();
 }
  public void setValueIn(final Component comp) {
    //			SwingUtilities.invokeAndWait(new Runnable() {

    //				public void run() {
    JToggleButton fl = (JToggleButton) comp;
    if (log.isLoggable(Level.INFO)) {
      log.info("pref:" + pref + ", def=" + def + ", val=" + pr.getBoolean(pref, def));
    }
    fl.setSelected(pr.getBoolean(pref, def));
    //				}
    //			});
  }
Ejemplo n.º 16
0
  public void actionPerformed(java.awt.event.ActionEvent event) {
    if (TRACE) System.out.println("CutPanelView actionPerformed: view: " + viewName);

    if (event.getSource() == closeButn) {
      JToggleButton jtb = (JToggleButton) event.getSource();
      jtb.setSelected(false);
      // System.out.println("Close!");
      vm.hideView(this);
      toolbarButton.setSelected(false);
    } else if (toolbarButton.isSelected()) {
      vm.showView(this);
    } else vm.hideView(this);
  }
Ejemplo n.º 17
0
  /**
   * Constructs the button with the given node type and image prefix. If the node type is "Select",
   * constructs a button that allows nodes to be selected and moved. If the node type is "Edge",
   * constructs a button that allows edges to be drawn. For other node types, constructs buttons
   * that allow those type of nodes to be added to the workbench. If a non-null image prefix is
   * provided, images for <prefix>Up.gif, <prefix>Down.gif, <prefix>Off.gif and <prefix>Roll.gif are
   * loaded from the /images directory relative to this compiled class and used to provide up, down,
   * off, and rollover images for the constructed button. On construction, nodes are mapped to their
   * node types in the Map, <code>nodeTypes</code>. Listeners are added to the node.
   *
   * @param buttonInfo contains the info needed to construct the button.
   */
  private JToggleButton constructButton(ButtonInfo buttonInfo) {
    String imagePrefix = buttonInfo.getImagePrefix();

    if (imagePrefix == null) {
      throw new NullPointerException("Image prefix must not be null.");
    }

    JToggleButton button = new JToggleButton();

    button.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            setShiftDown(e.isShiftDown());
            //                setControlDown(e.isControlDown());
          }
        });

    if ("Select".equals(buttonInfo.getNodeTypeName())) {
      button.setIcon(new ImageIcon(ImageUtils.getImage(this, "move.gif")));
    } else if ("Edge".equals(buttonInfo.getNodeTypeName())) {
      button.setIcon(new ImageIcon(ImageUtils.getImage(this, "flow.gif")));
    } else {
      button.setName(buttonInfo.getNodeTypeName());
      button.setText("<html><center>" + buttonInfo.getDisplayName() + "</center></html>");
    }

    button.setMaximumSize(new Dimension(110, 40)); // For a vertical box.
    button.setToolTipText(buttonInfo.getToolTipText());
    this.nodeTypes.put(button, buttonInfo.getNodeTypeName());

    return button;
  }
Ejemplo n.º 18
0
 public void actionPerformed(java.awt.event.ActionEvent e) {
   if (topmarkButton.isSelected()) {
     dlg.panelMain.mark.setTopmark(Top.X_SHAPE);
     dlg.panelMain.mark.setTopPattern(Pat.NOPAT);
     dlg.panelMain.mark.setTopColour(Col.YELLOW);
     topmarkButton.setBorderPainted(true);
   } else {
     dlg.panelMain.mark.setTopmark(Top.NOTOP);
     dlg.panelMain.mark.setTopPattern(Pat.NOPAT);
     dlg.panelMain.mark.setTopColour(Col.UNKCOL);
     topmarkButton.setBorderPainted(false);
   }
   dlg.panelMain.panelTop.syncPanel();
 }
Ejemplo n.º 19
0
  /** Creates the main frame for <code>this</code> sample. */
  public CornerRadius() {
    super("Toolbar button corner radius");

    this.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar("");
    toolBar.add(new JLabel("Sample toolbar"));
    toolBar.add(new JSeparator(SwingConstants.VERTICAL));

    JToggleButton buttonDefault = new JToggleButton("radius default");
    buttonDefault.setSelected(true);
    toolBar.add(buttonDefault);

    JToggleButton button1 = new JToggleButton("radius 5");
    // set corner radius to 5 pixels
    button1.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, Float.valueOf(5.0f));
    button1.setSelected(true);
    toolBar.add(button1);

    JToggleButton button2 = new JToggleButton("radius 0");
    // set corner radius to 0 pixels (perfect rectangle)
    button2.putClientProperty(SubstanceLookAndFeel.CORNER_RADIUS, Float.valueOf(0.0f));
    button2.setSelected(true);
    toolBar.add(button2);

    this.add(toolBar, BorderLayout.NORTH);

    this.setSize(400, 200);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
Ejemplo n.º 20
0
  public GLDemo() {
    super(VNMRFrame.getVNMRFrame(), "Jogl Demo", false);

    DisplayOptions.addChangeListener(this);

    contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    gradientPanel = createGradientPanel();

    contentPane.add(gradientPanel, BorderLayout.CENTER);

    checkBox = new JCheckBox("Transparent", true);
    checkBox.setActionCommand("transparancy");
    checkBox.addActionListener(this);
    optionsPan = new JPanel();
    optionsPan.setLayout(new SimpleH2Layout(SimpleH2Layout.LEFT, 5, 0, true, false));
    optionsPan.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

    optionsPan.add(checkBox);

    runButton = new JToggleButton("Run");
    runButton.setActionCommand("run");
    runButton.setSelected(false);
    runButton.addActionListener(this);

    optionsPan.add(runButton);

    getContentPane().add(optionsPan, BorderLayout.SOUTH);
    setSize(300, 300);
    setLocation(300, 300);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {
                      public void run() {
                        stop();
                      }
                    })
                .start();
          }
        });
    setVisible(false);
  }
Ejemplo n.º 21
0
  public static void main(String[] args) {
    final Scene scene = new Scene();
    scene.setBorder(BorderFactory.createEmptyBorder(10));
    scene.setLayout(
        LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 10));

    JTextField textField =
        new JTextField(
            "Text for editing - try to edit me. When the JTextField component is hidden, then the Widget just renders it.");
    final ComponentWidget textFieldWidget = new ComponentWidget(scene, textField);

    JToggleButton button =
        new JToggleButton(
            "Click to hide/show JTextField component bellow. The ComponentWidget is still in the scene and rendered.");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            textFieldWidget.setComponentVisible(!textFieldWidget.isComponentVisible());
            scene.validate();
          }
        });

    scene.addChild(new ComponentWidget(scene, button));
    scene.addChild(textFieldWidget);

    SeparatorWidget separator = new SeparatorWidget(scene, SeparatorWidget.Orientation.HORIZONTAL);
    scene.addChild(separator);

    JTextField textField2 = new JTextField("Text for editing - try to edit me.");
    final ComponentWidget textFieldWidget2 = new ComponentWidget(scene, textField2);

    JToggleButton button2 =
        new JToggleButton("Click to remove/add ComponentWidget from/to the scene.");
    button2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (textFieldWidget2.getParentWidget() != null) scene.removeChild(textFieldWidget2);
            else scene.addChild(textFieldWidget2);
            scene.validate();
          }
        });

    scene.addChild(new ComponentWidget(scene, button2));
    scene.addChild(textFieldWidget2);

    SceneSupport.show(scene);
    // TODO - call detach method on all ComponentWidget to prevent memory leaks
  }
Ejemplo n.º 22
0
  public void setData(TraceDataSet dataSet) {
    this.dataSet = dataSet;
    this.errorsOnly = false;
    this.traceLabel = null;
    this.minTraceTime = 0;

    btnFilterErrors.setSelected(false);
    txtMinTime.setText("");

    tbmTraces.setDataSet(dataSet, null);

    List<String> traceNames = new ArrayList<String>();

    for (ViewerTraceRecord rec : dataSet.getRecords()) {
      String traceName = rec.getTraceName();
      if (traceName != null && !traceNames.contains(traceName)) {
        traceNames.add(traceName);
      }
    }

    Collections.sort(traceNames);
    cmbTraceType.removeAllItems();
    cmbTraceType.addItem("*");

    for (String traceName : traceNames) {
      cmbTraceType.addItem(traceName);
    }
  }
Ejemplo n.º 23
0
 public void toggleShowMeasurements() {
   if (showMeasurements.isSelected()) {
     measurements.setStructures(currentNucId, currentStructureIdx);
     measurements.setObjects(list.getSelectedValues());
     this.container.add(measurements);
   } else this.container.remove(measurements);
   core.refreshDisplay();
 }
Ejemplo n.º 24
0
 @Override
 public void valueChanged(ListSelectionEvent lse) {
   if (lse.getValueIsAdjusting()) {
     return;
   }
   if (populatingObjects || selectingObject || !showObjects.isSelected()) {
     return;
   }
   selectingObject = true;
   if (measurements != null && showMeasurements.isSelected())
     measurements.setObjects(list.getSelectedValues());
   try {
     showRois3D();
   } catch (Exception e) {
     exceptionPrinter.print(e, "", Core.GUIMode);
   }
   selectingObject = false;
 }
Ejemplo n.º 25
0
 private void handleRegister() {
   if (session == null || !session.isConnected()) {
     jToggleButtonRegister.setSelected(false);
     jMenuItemOptionsDeregister.setEnabled(false);
     jMenuItemOptionsRegister.setEnabled(true);
     return;
   }
   if (jToggleButtonRegister.isSelected() || jMenuItemOptionsRegister.isEnabled()) {
     register();
     jToggleButtonRegister.setText("Deregister");
     jMenuItemOptionsDeregister.setEnabled(true);
     jMenuItemOptionsRegister.setEnabled(false);
   } else {
     deregister();
     jToggleButtonRegister.setText("Register");
     jMenuItemOptionsDeregister.setEnabled(false);
     jMenuItemOptionsRegister.setEnabled(true);
   }
 }
Ejemplo n.º 26
0
  private void initToolbar() {
    JToolBar tbTraceFilters = new JToolBar();
    tbTraceFilters.setFloatable(false);
    tbTraceFilters.setRollover(true);

    tbTraceFilters.add(new JLabel("Min time:"));
    txtMinTime = new JTextField(4);
    tbTraceFilters.add(txtMinTime);

    JButton btnFilterByTime = new JButton(new FilterByTimeAction());
    btnFilterByTime.setFocusable(false);
    btnFilterByTime.setToolTipText("Filter by trace execution time");
    tbTraceFilters.add(btnFilterByTime);

    tbTraceFilters.addSeparator();

    btnFilterErrors = new JToggleButton(new FilterByErrorAction());
    btnFilterErrors.setFocusable(false);
    btnFilterErrors.setToolTipText("Show only traces with errors");
    tbTraceFilters.add(btnFilterErrors);

    tbTraceFilters.addSeparator();

    cmbTraceType = new JComboBox();
    cmbTraceType.addItem("*");

    cmbTraceType.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              String item = (String) e.getItem();
              traceLabel = "*".equals(item) ? null : item;
              tbmTraces.setDataSet(dataSet, traceFilter);
            }
          }
        });

    tbTraceFilters.add(cmbTraceType);

    add(tbTraceFilters, BorderLayout.NORTH);
  }
Ejemplo n.º 27
0
 private void handleConnect() {
   if (jToggleButtonConnect.isSelected() || jMenuItemServerConnect.isEnabled())
     try {
       jTextPaneDisplayMessages.setText("");
       session = new Session();
       try {
         String userid = jTextFieldUser.getText();
         if (jPasswordFieldPwd.getPassword() != null) {
           String pwd = String.valueOf(jPasswordFieldPwd.getPassword()).trim();
           if (!pwd.equals("")) {
             userid += ":" + pwd;
           }
         }
         if (session.connect(jTextFieldServer.getText(), userid)) {
           displayMessage("Connected\n", incomingMsgAttrSet);
           session.addListener(this);
           jToggleButtonConnect.setText("Disconnect");
           jMenuItemServerConnect.setEnabled(false);
           jMenuItemServerDisconnect.setEnabled(true);
         } else {
           jToggleButtonConnect.setSelected(false);
           jMenuItemServerConnect.setEnabled(true);
           jMenuItemServerDisconnect.setEnabled(false);
           displayMessage("Connection attempt failed\n", offlineClientAttrSet);
         }
       } catch (ConnectionException ex1) {
         jToggleButtonConnect.setSelected(false);
         jMenuItemServerConnect.setEnabled(true);
         jMenuItemServerDisconnect.setEnabled(false);
         displayMessage(
             "Connection attempt failed: " + ex1.getMessage() + "\n", offlineClientAttrSet);
       }
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   else {
     disconnect();
     jMenuItemServerConnect.setEnabled(true);
     jMenuItemServerDisconnect.setEnabled(false);
     displayMessage("Disconnected\n", offlineClientAttrSet);
   }
 }
Ejemplo n.º 28
0
 void setSelected(Object c, boolean sel) {
   if (c instanceof JToggleButton) {
     ((JToggleButton) c).setSelected(sel);
     return;
   }
   if (c instanceof JCheckBoxMenuItem) {
     ((JCheckBoxMenuItem) c).setState(sel);
     return;
   }
   // skip
 }
 public void setPlayerControlsVisible(boolean b) {
   boolean oldValue = forwardButton.isVisible();
   if (oldValue != b) {
     forwardButton.setVisible(b);
     rewindButton.setVisible(b);
     startButton.setVisible(b);
     slider.setVisible(b);
     spacer.setVisible(!b);
     revalidate();
   }
 }
  public void addColorChooserPanel(final AbstractColorChooserPanel ccp) {
    final String displayName = ccp.getDisplayName();
    if (displayName == null) {
      // Return if we haven't initialized yet
      return;
    }

    if (ccp.getClass()
        .getName()
        .equals("ch.randelshofer.quaqua.colorchooser.Quaqua15ColorPicker")) {
      northPanel.add(ccp, BorderLayout.WEST);
    } else {
      Icon displayIcon = ccp.getLargeDisplayIcon();
      JToggleButton tb = new JToggleButton(null, displayIcon);
      tb.setToolTipText(displayName);
      tb.setFocusable(false);
      tb.setHorizontalTextPosition(SwingConstants.CENTER);
      tb.setVerticalTextPosition(SwingConstants.BOTTOM);
      tb.setFont(UIManager.getFont("ColorChooser.font"));
      tb.putClientProperty("Quaqua.Button.style", "toolBarTab");
      JPanel centerView = new JPanel(new BorderLayout());
      centerView.add(ccp);
      chooserPanelHolder.add(centerView, displayName);
      toolBarButtonGroup.add(tb);
      toolBar.add(tb);

      if (toolBar.getComponentCount() == 1
          || lastSelectedChooserName != null && lastSelectedChooserName.equals(displayName)) {
        tb.setSelected(true);
        CardLayout cl = (CardLayout) chooserPanelHolder.getLayout();
        cl.show(chooserPanelHolder, displayName);
      }

      tb.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
              if (evt.getStateChange() == ItemEvent.SELECTED) {
                CardLayout cl = (CardLayout) chooserPanelHolder.getLayout();
                cl.show(chooserPanelHolder, displayName);
                lastSelectedChooserName = displayName;
              }
            }
          });
    }
  }