/**
   * 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;
  }
Esempio n. 2
0
  private AbstractButton createButton(AppAction action) {
    if (action instanceof CustomizableAppAction) {
      ((CustomizableAppAction) action).requestUpdate(this);
    }
    if (action.isToggle()) {
      JToggleButton bt = new JToggleButton(action);
      bt.setOpaque(false);
      bt.setContentAreaFilled(false);
      bt.setBorderPainted(false);

      bt.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              hideThreadrunning = false;
              TrayIconPopup.this.dispose();
            }
          });

      Icon icon;
      bt.setIcon(icon = NewTheme.I().getCheckBoxImage(action.getIconKey(), false, ICON_SIZE));
      bt.setRolloverIcon(icon);
      bt.setSelectedIcon(
          icon = NewTheme.I().getCheckBoxImage(action.getIconKey(), true, ICON_SIZE));
      bt.setRolloverSelectedIcon(icon);

      bt.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      bt.setFocusPainted(false);
      bt.setHorizontalAlignment(JButton.LEFT);
      bt.setIconTextGap(5);
      bt.addMouseListener(new HoverEffect(bt));
      return bt;
    } else {
      // we use a JToggleButton here, because JToggle buttons seem to have a different left icon gap
      // the jbuttons

      JToggleButton bt = new JToggleButton(action);
      bt.setOpaque(false);
      bt.setContentAreaFilled(false);
      bt.setBorderPainted(false);
      bt.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              hideThreadrunning = false;
              TrayIconPopup.this.dispose();
            }
          });
      bt.setIcon(NewTheme.I().getIcon(action.getIconKey(), ICON_SIZE));
      bt.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
      bt.setFocusPainted(false);
      bt.setHorizontalAlignment(JButton.LEFT);
      bt.setIconTextGap(5);
      bt.addMouseListener(new HoverEffect(bt));
      return bt;
    }
  }
Esempio n. 3
0
  private void setBreak(boolean isBreak) {
    this.isBreak = isBreak;

    chkTrapRequest.setSelected(isBreak);
    chkTrapResponse.setSelected(isBreak);

    if (isBreak) {
      btnBreak.setIcon(new ImageIcon(getClass().getResource("/resource/icons/delete.png")));
      btnBreak.setToolTipText(Constant.messages.getString("brk.toolbar.button.unset"));
    } else {
      btnBreak.setIcon(new ImageIcon(getClass().getResource("/resource/icons/add.png")));
      btnBreak.setToolTipText(Constant.messages.getString("brk.toolbar.button.set"));
    }
  }
  private void initSouth() {
    listButton = new JToggleButton();
    listButton.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/org/gephi/desktop/ranking/resources/list.png"))); // NOI18N
    NbBundle.getMessage(RankingTopComponent.class, "RankingTopComponent.listButton.text");
    listButton.setEnabled(false);
    listButton.setFocusable(false);
    southToolbar.add(listButton);
    /*barChartButton = new JToggleButton();
    barChartButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/ranking/resources/barchart.png"))); // NOI18N
    NbBundle.getMessage(RankingTopComponent.class, "RankingTopComponent.barchartButton.text");
    barChartButton.setEnabled(false);
    barChartButton.setFocusable(false);
    southToolbar.add(barChartButton);*/

    // BarChartPanel & ListPanel
    listResultPanel.setVisible(false);

    listButton.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            model.setListVisible(listButton.isSelected());
          }
        });

    /*barChartButton.addActionListener(new ActionListener() {

    public void actionPerformed(ActionEvent e) {
    model.setBarChartVisible(barChartButton.isSelected());
    }
    });*/
  }
Esempio n. 5
0
 public static void scaleIcon(JToggleButton button) {
   if (isScaleImages() && button != null) {
     if (button.getIcon() != null && button.getIcon() instanceof ImageIcon) {
       button.setIcon(getScaledIcon((ImageIcon) button.getIcon()));
     }
     if (button.getSelectedIcon() != null && button.getSelectedIcon() instanceof ImageIcon) {
       button.setSelectedIcon(getScaledIcon((ImageIcon) button.getSelectedIcon()));
     }
     if (button.getRolloverIcon() != null && button.getRolloverIcon() instanceof ImageIcon) {
       button.setRolloverIcon(getScaledIcon((ImageIcon) button.getRolloverIcon()));
     }
     if (button.getRolloverSelectedIcon() != null
         && button.getRolloverSelectedIcon() instanceof ImageIcon) {
       button.setRolloverSelectedIcon(getScaledIcon((ImageIcon) button.getRolloverSelectedIcon()));
     }
     if (button.getDisabledIcon() != null && button.getDisabledIcon() instanceof ImageIcon) {
       button.setDisabledIcon(getScaledIcon((ImageIcon) button.getDisabledIcon()));
     }
     if (button.getDisabledSelectedIcon() != null
         && button.getDisabledSelectedIcon() instanceof ImageIcon) {
       button.setDisabledSelectedIcon(getScaledIcon((ImageIcon) button.getDisabledSelectedIcon()));
     }
     if (button.getPressedIcon() != null && button.getPressedIcon() instanceof ImageIcon) {
       button.setPressedIcon(getScaledIcon((ImageIcon) button.getPressedIcon()));
     }
   }
 }
 public JToggleButton addToggleButton(String key) {
   JToggleButton item = new JToggleButton();
   item.setToolTipText(Messages.getString(key));
   item.setIcon(LGM.getIconForKey(key));
   item.setActionCommand(key);
   item.addActionListener(this);
   return item;
 }
 @Override
 public void setIcon(Icon icon) {
   assert null != icon;
   Icon arrow = updateIcons(icon, ICON_NORMAL);
   arrowIcons.remove(ICON_ROLLOVER_LINE);
   arrowIcons.remove(ICON_ROLLOVER_SELECTED_LINE);
   arrowIcons.remove(ICON_ROLLOVER);
   arrowIcons.remove(ICON_ROLLOVER_SELECTED);
   super.setIcon(hasPopupMenu() ? arrow : icon);
 }
Esempio n. 8
0
  @Override
  public List<AbstractButton> getButtons() {
    List<AbstractButton> buttons = new ArrayList<AbstractButton>();
    // JToggleButton and JButton are both javax.swing.AbstractButton

    // Toggle button
    JToggleButton buttonPoint = new JToggleButton();
    buttonPoint.setMargin(new Insets(0, 0, 0, 0));
    buttonPoint.setMinimumSize(new Dimension(16, 16));
    buttonPoint.setToolTipText("Mark reference point");
    try {
      buttonPoint.setIcon(new ImageIcon(StamperPS.class.getResource("icons/markPoint.png")));
    } catch (Exception e) {
      e.printStackTrace();
    }
    buttonPoint.addItemListener(
        new ItemListener() {

          @Override
          public void itemStateChanged(ItemEvent itemEvent) {
            int state = itemEvent.getStateChange();
            if (state == ItemEvent.SELECTED) {
              toggleMarkReferencePoint(true);
            } else {
              toggleMarkReferencePoint(false);
            }
          }
        });
    buttonPoint.setToolTipText("Mark reference point");
    buttonPoint.setMargin(new Insets(0, 0, 0, 0));
    buttonPoint.setMinimumSize(new Dimension(16, 16));
    buttons.add(buttonPoint);
    // Clear Points button
    JButton buttonClearPoints = new JButton();
    buttonClearPoints.setMargin(new Insets(0, 0, 0, 0));
    buttonClearPoints.setMinimumSize(new Dimension(16, 16));
    buttonClearPoints.setToolTipText("Clear marked points");
    try {
      buttonClearPoints.setIcon(
          new ImageIcon(StamperPS.class.getResource("icons/markPointClear.png")));
    } catch (Exception e) {
      e.printStackTrace();
    }
    buttonClearPoints.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            clearMarkedPoints();
          }
        });
    buttons.add(buttonClearPoints);
    return buttons;
  }
  public SelectedComponentController(
      SelectedComponentModel scModel, ParameterModel pModel, IconPainter icon) {

    this.icon = icon;
    icon.setColor(Color.BLACK);
    icon.setLength(scModel.getICONLENGTH());
    super.setIcon(icon);

    addItemListener(this);

    this.scModel = scModel;
    this.pModel = pModel;

    scModel.addChangeListener(this);
    setSelected(scModel.getSelected() == icon);
  }
Esempio n. 10
0
 /**
  * This method initializes jToggleButton
  *
  * @return javax.swing.JToggleButton
  */
 private JToggleButton getJToggleButton() {
   if (jToggleButton == null) {
     jToggleButton = new JToggleButton();
     jToggleButton.setToolTipText("switch mode");
     jToggleButton.setIcon(ICON_SWITCH_MODE);
     jToggleButton.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             getJTextPane().setEditable(!getJTextPane().isEditable());
             if (getJTextPane().isEditable()) {
               getJTextPane().requestFocusInWindow();
             }
           }
         });
   }
   return jToggleButton;
 }
Esempio n. 11
0
 private JToggleButton buildFilterButton(
     final TaskManagerListModel listModel,
     String name,
     ImageIcon icon,
     ImageIcon selectedIcon,
     final Filter filter) {
   final JToggleButton filterUsersButon = new JToggleButton();
   filterUsersButon.setName(name);
   filterUsersButon.setIcon(icon);
   filterUsersButon.setSelectedIcon(selectedIcon);
   filterUsersButon.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           if (filterUsersButon.isSelected()) {
             listModel.addFilter(filter);
           } else {
             listModel.removeFilter(filter);
           }
         }
       });
   return filterUsersButon;
 }
Esempio n. 12
0
 private JToggleButton createButton(
     final String icon, final String offIcon, final OptionPanel panel, String tooltip) {
   final JToggleButton button = new JToggleButton();
   button.setToolTipText(tooltip);
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           if (button.isSelected()) {
             panel.activate();
             ((CardLayout) optionPanel.getLayout()).show(optionPanel, icon);
           }
         }
       });
   try {
     button.setIcon(new ImageIcon(ImageUtil.getImage(offIcon)));
     button.setSelectedIcon(new ImageIcon(ImageUtil.getImage(icon)));
   } catch (IOException ioe) {
     ioe.printStackTrace();
   }
   optionPanel.add(panel, icon);
   buttonGroup.add(button);
   return button;
 }
Esempio n. 13
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

    btgMode = new javax.swing.ButtonGroup();
    lblLastModification = new javax.swing.JLabel();
    panSearch = new javax.swing.JPanel();
    txtSearch = new javax.swing.JTextField();
    lblSuche = new javax.swing.JLabel();
    btnSearch = new javax.swing.JButton();
    panKZValues = new javax.swing.JPanel();
    lblKassenzeichen = new javax.swing.JLabel();
    lblErfassungsdatum = new javax.swing.JLabel();
    lblBemerkung = new javax.swing.JLabel();
    lblSperre = new javax.swing.JLabel();
    txtErfassungsdatum = new javax.swing.JTextField();
    chkSperre = new javax.swing.JCheckBox();
    scpBemerkung = new javax.swing.JScrollPane();
    txtBemerkung = new javax.swing.JTextArea();
    txtKassenzeichen = new javax.swing.JTextField();
    txtSperreBemerkung = new javax.swing.JTextField();
    jPanel2 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    togRegenMode = new javax.swing.JToggleButton();
    togWDSRMode = new javax.swing.JToggleButton();
    togInfoMode = new javax.swing.JToggleButton();
    sepTitle1 = new javax.swing.JSeparator();
    sepTitle2 = new javax.swing.JSeparator();

    lblLastModification.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/images/titlebars/goto.png"))); // NOI18N

    org.jdesktop.beansbinding.Binding binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.letzte_aenderung_von}"),
            lblLastModification,
            org.jdesktop.beansbinding.BeanProperty.create("toolTipText"));
    bindingGroup.addBinding(binding);

    setLayout(new java.awt.GridBagLayout());

    panSearch.setLayout(new java.awt.GridBagLayout());

    txtSearch.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            txtSearchActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3);
    panSearch.add(txtSearch, gridBagConstraints);

    lblSuche.setText("Kassenzeichen");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10);
    panSearch.add(lblSuche, gridBagConstraints);

    btnSearch.setMnemonic('s');
    btnSearch.setText("suchen");
    btnSearch.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            btnSearchActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3);
    panSearch.add(btnSearch, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(7, 7, 7, 7);
    add(panSearch, gridBagConstraints);

    panKZValues.setLayout(new java.awt.GridBagLayout());

    lblKassenzeichen.setText("Kassenzeichen");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panKZValues.add(lblKassenzeichen, gridBagConstraints);

    lblErfassungsdatum.setText("Datum der Erfassung");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panKZValues.add(lblErfassungsdatum, gridBagConstraints);

    lblBemerkung.setText("Bemerkung");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    panKZValues.add(lblBemerkung, gridBagConstraints);

    lblSperre.setText("Veranlagung gesperrt");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panKZValues.add(lblSperre, gridBagConstraints);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.datum_erfassung}"),
            txtErfassungsdatum,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__DATUM_ERFASSUNG);
    binding.setConverter(new SqlDateToStringConverter());
    bindingGroup.addBinding(binding);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    panKZValues.add(txtErfassungsdatum, gridBagConstraints);

    chkSperre.setForeground(java.awt.Color.red);
    chkSperre.setEnabled(false);
    chkSperre.setFocusPainted(false);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.sperre}"),
            chkSperre,
            org.jdesktop.beansbinding.BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);

    chkSperre.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            chkSperreActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    panKZValues.add(chkSperre, gridBagConstraints);

    scpBemerkung.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scpBemerkung.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    scpBemerkung.setMinimumSize(new java.awt.Dimension(6, 36));

    txtBemerkung.setColumns(3);
    txtBemerkung.setLineWrap(true);
    txtBemerkung.setRows(3);
    txtBemerkung.setMinimumSize(new java.awt.Dimension(0, 36));

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.bemerkung}"),
            txtBemerkung,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__BEMERKUNG);
    bindingGroup.addBinding(binding);

    scpBemerkung.setViewportView(txtBemerkung);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 6, 3, 0);
    panKZValues.add(scpBemerkung, gridBagConstraints);

    txtKassenzeichen.setEditable(false);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.kassenzeichennummer8}"),
            txtKassenzeichen,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__KASSENZEICHENNUMMER);
    bindingGroup.addBinding(binding);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 3, 0);
    panKZValues.add(txtKassenzeichen, gridBagConstraints);

    txtSperreBemerkung.setBackground(getBackground());
    txtSperreBemerkung.setEditable(false);
    txtSperreBemerkung.setForeground(java.awt.Color.red);
    txtSperreBemerkung.setBorder(null);

    binding =
        org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            this,
            org.jdesktop.beansbinding.ELProperty.create("${cidsBean.bemerkung_sperre}"),
            txtSperreBemerkung,
            org.jdesktop.beansbinding.BeanProperty.create("text"),
            KassenzeichenPropertyConstants.PROP__BEMERKUNG_SPERRE);
    bindingGroup.addBinding(binding);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
    panKZValues.add(txtSperreBemerkung, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(7, 7, 7, 7);
    add(panKZValues, gridBagConstraints);

    jPanel2.setLayout(new java.awt.GridBagLayout());

    jLabel2.setText("Modus");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    jPanel2.add(jLabel2, gridBagConstraints);

    btgMode.add(togRegenMode);
    togRegenMode.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/regen_gr.png"))); // NOI18N
    togRegenMode.setToolTipText("Versiegelte Flächen");
    togRegenMode.setFocusable(false);
    togRegenMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    togRegenMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    togRegenMode.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            togRegenModeActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    jPanel2.add(togRegenMode, gridBagConstraints);

    btgMode.add(togWDSRMode);
    togWDSRMode.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/esw_gr.png"))); // NOI18N
    togWDSRMode.setToolTipText("ESW");
    togWDSRMode.setFocusable(false);
    togWDSRMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    togWDSRMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    togWDSRMode.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            togWDSRModeActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    jPanel2.add(togWDSRMode, gridBagConstraints);

    btgMode.add(togInfoMode);
    togInfoMode.setIcon(
        new javax.swing.ImageIcon(
            getClass().getResource("/de/cismet/verdis/res/info_gr.png"))); // NOI18N
    togInfoMode.setSelected(true);
    togInfoMode.setToolTipText("Info");
    togInfoMode.setFocusable(false);
    togInfoMode.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    togInfoMode.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    togInfoMode.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            togInfoModeActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    jPanel2.add(togInfoMode, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 7, 3, 7);
    add(jPanel2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    gridBagConstraints.weightx = 1.0;
    add(sepTitle1, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    gridBagConstraints.weightx = 1.0;
    add(sepTitle2, gridBagConstraints);

    bindingGroup.bind();
  } // </editor-fold>//GEN-END:initComponents
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    panEdit = new javax.swing.JPanel();
    spnPointValue = new javax.swing.JSpinner();
    jLabel5 = new javax.swing.JLabel();
    labGwk = new javax.swing.JLabel();
    splitButton = new javax.swing.JButton();
    badGeomButton = new javax.swing.JToggleButton();
    jPanel2 = new javax.swing.JPanel();
    badGeomCorrectButton = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    lblPointValue = new javax.swing.JLabel();
    lblRoute = new javax.swing.JLabel();
    panAdd = new AddPanel();
    jLabel3 = new javax.swing.JLabel();
    panError = new javax.swing.JPanel();
    lblError = new javax.swing.JLabel();

    setEnabled(false);
    setOpaque(false);
    setLayout(new java.awt.CardLayout());

    panEdit.setOpaque(false);
    panEdit.setLayout(new java.awt.GridBagLayout());

    spnPointValue.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 0.0d, 1.0d));
    spnPointValue.setEditor(new javax.swing.JSpinner.NumberEditor(spnPointValue, "###"));
    spnPointValue.setMaximumSize(new java.awt.Dimension(100, 28));
    spnPointValue.setMinimumSize(new java.awt.Dimension(100, 28));
    spnPointValue.setPreferredSize(new java.awt.Dimension(100, 28));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(spnPointValue, gridBagConstraints);

    jLabel5.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/station.png"))); // NOI18N
    jLabel5.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.jLabel5.text")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    panEdit.add(jLabel5, gridBagConstraints);

    labGwk.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    labGwk.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.labGwk.text_1")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 6;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    panEdit.add(labGwk, gridBagConstraints);

    splitButton.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/sql-join-left.png"))); // NOI18N
    splitButton.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.splitButton.text")); // NOI18N
    splitButton.setToolTipText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.splitButton.toolTipText")); // NOI18N
    splitButton.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            splitButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(splitButton, gridBagConstraints);

    badGeomButton.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/exclamation.png"))); // NOI18N
    badGeomButton.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomButton.text")); // NOI18N
    badGeomButton.setToolTipText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomButton.toolTipText")); // NOI18N
    badGeomButton.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            badGeomButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(badGeomButton, gridBagConstraints);

    jPanel2.setMaximumSize(new java.awt.Dimension(32, 0));
    jPanel2.setMinimumSize(new java.awt.Dimension(32, 0));
    jPanel2.setOpaque(false);
    jPanel2.setPreferredSize(new java.awt.Dimension(32, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panEdit.add(jPanel2, gridBagConstraints);

    badGeomCorrectButton.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/node-delete.png"))); // NOI18N
    badGeomCorrectButton.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomCorrectButton.text")); // NOI18N
    badGeomCorrectButton.setToolTipText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomCorrectButton.toolTipText")); // NOI18N
    badGeomCorrectButton.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            badGeomCorrectButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(badGeomCorrectButton, gridBagConstraints);

    jPanel3.setMaximumSize(new java.awt.Dimension(32, 0));
    jPanel3.setMinimumSize(new java.awt.Dimension(32, 0));
    jPanel3.setOpaque(false);
    jPanel3.setPreferredSize(new java.awt.Dimension(32, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    panEdit.add(jPanel3, gridBagConstraints);

    lblPointValue.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    lblPointValue.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.lblPointValue.text_1")); // NOI18N
    lblPointValue.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lblPointValue.setMaximumSize(new java.awt.Dimension(100, 28));
    lblPointValue.setMinimumSize(new java.awt.Dimension(100, 28));
    lblPointValue.setPreferredSize(new java.awt.Dimension(100, 28));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(lblPointValue, gridBagConstraints);

    lblRoute.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblRoute.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.lblRoute.text_1")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 0);
    panEdit.add(lblRoute, gridBagConstraints);

    add(panEdit, "edit");

    panAdd.setOpaque(false);
    panAdd.setLayout(new java.awt.GridBagLayout());

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.jLabel3.text")); // NOI18N
    panAdd.add(jLabel3, new java.awt.GridBagConstraints());

    add(panAdd, "add");

    panError.setOpaque(false);
    panError.setLayout(new java.awt.GridBagLayout());

    lblError.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.lblError.text")); // NOI18N
    panError.add(lblError, new java.awt.GridBagConstraints());

    add(panError, "error");
  } // </editor-fold>//GEN-END:initComponents
Esempio n. 15
0
  public JTarget(ITarget target) {
    if (target instanceof MetaTarget) {
      this.directions = ((MetaTarget) target).getDirections();
    } else {
      this.directions = new ArrayList<RelativeCoordinate>();
      RelativeCoordinate direction = ((SingleTarget) target).getDirection();

      if (direction != null) {
        this.directions.add(direction);
      }
    }
    setLayout(new GridBagLayout());

    JPanel directionsPanel = new JPanel();
    directionsPanel.setLayout(new GridLayout(3, 3, 3, 3));
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.NORTH;
    add(directionsPanel, c);

    JButton neighborsButton = new JButton("neighbors");
    neighborsButton.addActionListener(new AllNeighborsButtonListener());
    c.gridy = 1;
    c.insets = new Insets(5, 0, 0, 0);
    add(neighborsButton, c);

    buttonsDirections = new IdentityHashMap<JToggleButton, RelativeCoordinate>();

    ImageIcon protoIconNorth = new ImageIcon(getClass().getResource("icons/target-north.png"));

    JToggleButton btn = new JToggleButton();
    btn.setIcon(ImageRotator.createRotatedImage(btn, protoIconNorth, 315));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.NORTH_WEST);

    btn = new JToggleButton();
    btn.setIcon(protoIconNorth);
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.NORTH);

    btn = new JToggleButton();
    btn.setIcon(ImageRotator.createRotatedImage(btn, protoIconNorth, 45));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.NORTH_EAST);

    btn = new JToggleButton();
    btn.setIcon(ImageRotator.createRotatedImage(btn, protoIconNorth, 270));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.WEST);

    btn = new JToggleButton();
    btn.setIcon(new ImageIcon(getClass().getResource("icons/target-self.png")));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.CENTER);

    btn = new JToggleButton();
    btn.setIcon(ImageRotator.createRotatedImage(btn, protoIconNorth, 90));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.EAST);

    btn = new JToggleButton();
    btn.setIcon(ImageRotator.createRotatedImage(btn, protoIconNorth, 225));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.SOUTH_WEST);

    btn = new JToggleButton();
    btn.setIcon(ImageRotator.createRotatedImage(btn, protoIconNorth, 180));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.SOUTH);

    btn = new JToggleButton();
    btn.setIcon(ImageRotator.createRotatedImage(btn, protoIconNorth, 135));
    directionsPanel.add(btn);
    buttonsDirections.put(btn, RelativeCoordinate.SOUTH_EAST);

    for (JToggleButton b : buttonsDirections.keySet()) {
      b.setPreferredSize(new Dimension(30, 30));
      b.setMaximumSize(b.getPreferredSize());
      b.setMinimumSize(b.getPreferredSize());
      b.addActionListener(new TargetActionListener());
      for (RelativeCoordinate rc : directions) {
        if (rc == this.buttonsDirections.get(b)) {
          b.setSelected(true);
          break;
        }
      }
    }
  }
Esempio n. 16
0
  public ToolBox(final MainFrame mf) {
    JPanel container = new JPanel();
    container.setBackground(new Color(0xF2F2F5));
    add(container);
    container.setLayout(new GridLayout(0, 3, 3, 3));
    setBackground(new Color(0xF2F2F5));

    ButtonGroup group = new ButtonGroup();
    for (int i = 0; i < 7; i++) {
      JToggleButton btn = new JToggleButton();
      buttons.add(btn);
      btn.setPreferredSize(new Dimension(35, 35));
      btn.setMinimumSize(new Dimension(35, 35));
      btn.setMaximumSize(new Dimension(35, 35));
      group.add(btn);
      container.add(btn);
    }

    final JToggleButton jButtonSelect = buttons.get(0);
    jButtonSelect.setIcon(new ImageIcon(getClass().getResource("icons/tool-select.png")));
    jButtonSelect.setEnabled(true);
    jButtonSelect.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            mf.setActiveTool(SelectCommand.class);
            mf.getShowcase().setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
          }
        });

    final JToggleButton jButtonMove = buttons.get(1);
    jButtonMove.setIcon(new ImageIcon(getClass().getResource("icons/tool-move.png")));
    jButtonMove.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            mf.setActiveTool(MoveCommand.class);
            mf.getShowcase().setCursor(new Cursor(Cursor.MOVE_CURSOR));
          }
        });

    final JToggleButton jButtonZoom = buttons.get(2);
    jButtonZoom.setIcon(new ImageIcon(getClass().getResource("icons/tool-zoom.png")));
    jButtonZoom.setEnabled(true);
    jButtonZoom.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            mf.setActiveTool(ZoomCommand.class);
            mf.getShowcase().setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
          }
        });

    final JToggleButton jButtonPaint = buttons.get(3);
    jButtonPaint.setIcon(new ImageIcon(getClass().getResource("icons/tool-paint.png")));
    jButtonPaint.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            mf.setActiveTool(PaintCommand.class);
            mf.getShowcase().setCursor(new Cursor(Cursor.HAND_CURSOR));
          }
        });
    jButtonPaint.doClick();

    final JToggleButton jButtonFill = buttons.get(4);
    jButtonFill.setIcon(new ImageIcon(getClass().getResource("icons/tool-fill.png")));
    jButtonFill.setEnabled(true);
    jButtonFill.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            mf.setActiveTool(FillSelectionCommand.class);
            mf.getShowcase().setCursor(new Cursor(Cursor.MOVE_CURSOR));
          }
        });

    final JToggleButton jButtonErase = buttons.get(5);
    jButtonErase.setIcon(new ImageIcon(getClass().getResource("icons/tool-erase.png")));
    jButtonErase.setEnabled(true);
    jButtonErase.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            mf.setActiveTool(EraseCommand.class);
            mf.getShowcase().setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
          }
        });

    final JToggleButton jButtonPick = buttons.get(6);
    jButtonPick.setIcon(new ImageIcon(getClass().getResource("icons/tool-pick.png")));
    jButtonPick.setEnabled(true);
    jButtonPick.addActionListener(
        new java.awt.event.ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            mf.setActiveTool(PickCommand.class);
            mf.getShowcase().setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
          }
        });
  }
  /** Set up the button bar */
  private void setupButtonBar() {
    bottombar = new JPanel();
    bottombar.setLayout(new BoxLayout(bottombar, BoxLayout.X_AXIS));

    editEntity = new JToggleButton();
    editEntity.setIcon(Builder.getIcon("lock.png", Builder.ICONS, 22));
    editEntity.setSelectedIcon(Builder.getIcon("unlock.png", Builder.ICONS, 22));
    editEntity.setBorderPainted(false);
    editEntity.setContentAreaFilled(false);
    editEntity.setFocusable(false);

    editEntity.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (!editEntity.isSelected() && hasChanged) {
              /*if(!warnLosingChanges()) {
              	editEntity.setSelected(true);
              	return;
              }
              else {
              	editEntity.setSelected(false);
              	hasChanged = false;
              }*/
              doSave();
            }
            enableEditing(editEntity.isSelected());
          }
        });

    bottombar.add(editEntity);

    editEntityText = new JLabel(I18n.getText("general.initializing").toLowerCase());
    editEntityText.setLabelFor(editEntity);
    bottombar.add(editEntityText);

    editEntitySave = new JButton(I18n.getText("general.saveChanges"));
    editEntityCancel = new JButton(I18n.getText("general.cancel"));

    // don't let an errant enter key fire these buttons!
    editEntitySave.setDefaultCapable(false);
    editEntityCancel.setDefaultCapable(false);

    editEntitySave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            doSave();
          }
        });

    editEntityCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            hasChanged = false;
            editEntity.setSelected(false);
            enableEditing(false);
          }
        });

    bottombar.add(Box.createHorizontalGlue());
    bottombar.add(editEntitySave);
    bottombar.add(Box.createHorizontalStrut(6));
    bottombar.add(editEntityCancel);
    bottombar.add(Box.createHorizontalStrut(6));
  }
  public JMovieControlAqua() {
    // Set the background color to the border color of the buttons.
    // This way the toolbar won't look too ugly when the buttons
    // are displayed before they have been loaded completely.
    // setBackground(new Color(118, 118, 118));
    setBackground(Color.WHITE);

    Dimension buttonSize = new Dimension(16, 16);
    GridBagLayout gridbag = new GridBagLayout();
    Insets margin = new Insets(0, 0, 0, 0);
    setLayout(gridbag);
    GridBagConstraints c;

    ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels");
    colorCyclingButton = new JToggleButton();
    colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText"));
    colorCyclingButton.addActionListener(this);
    colorCyclingButton.setPreferredSize(buttonSize);
    colorCyclingButton.setMinimumSize(buttonSize);
    colorCyclingButton.setVisible(false);
    colorCyclingButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(colorCyclingButton, c);
    add(colorCyclingButton);

    audioButton = new JToggleButton();
    audioButton.setToolTipText(labels.getString("audio.toolTipText"));
    audioButton.addActionListener(this);
    audioButton.setPreferredSize(buttonSize);
    audioButton.setMinimumSize(buttonSize);
    audioButton.setVisible(false);
    audioButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(audioButton, c);
    add(audioButton);

    startButton = new JToggleButton();
    startButton.setToolTipText(labels.getString("play.toolTipText"));
    startButton.addActionListener(this);
    startButton.setPreferredSize(buttonSize);
    startButton.setMinimumSize(buttonSize);
    startButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 1;
    // c.gridy = 0;
    gridbag.setConstraints(startButton, c);
    add(startButton);

    slider = new JMovieSliderAqua();
    c = new GridBagConstraints();
    // c.gridx = 2;
    // c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(slider, c);
    add(slider);

    rewindButton = new JButton();
    rewindButton.setToolTipText(labels.getString("previous.toolTipText"));
    rewindButton.setPreferredSize(buttonSize);
    rewindButton.setMinimumSize(buttonSize);
    rewindButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 3;
    // c.gridy = 0;

    gridbag.setConstraints(rewindButton, c);
    add(rewindButton);
    rewindButton.addActionListener(this);

    forwardButton = new JButton();
    forwardButton.setToolTipText(labels.getString("next.toolTipText"));
    buttonSize = new Dimension(17, 16);
    forwardButton.setPreferredSize(buttonSize);
    forwardButton.setMinimumSize(buttonSize);
    forwardButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 4;
    // c.gridy = 0;
    gridbag.setConstraints(forwardButton, c);
    add(forwardButton);
    forwardButton.addActionListener(this);

    // The spacer is used when the play controls are hidden
    spacer = new JPanel(new BorderLayout());
    spacer.setVisible(false);
    spacer.setPreferredSize(new Dimension(16, 16));
    spacer.setMinimumSize(new Dimension(16, 16));
    spacer.setOpaque(false);
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(spacer, c);
    add(spacer);

    Border border =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.border.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderP.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4))));

    Border westBorder =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWest.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWestP.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4))));

    startButton.setBorder(westBorder);
    colorCyclingButton.setBorder(westBorder);
    audioButton.setBorder(westBorder);
    rewindButton.setBorder(westBorder);
    forwardButton.setBorder(border);
    startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton));
    colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton));
    forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton));

    colorCyclingButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setDisabledIcon(
        new ImageIcon(
            Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png")));
    audioButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png")));
    audioButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png")));
    audioButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png")));
    startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png")));
    startButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png")));
    startButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png")));
    rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png")));
    rewindButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png")));
    forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png")));
    forwardButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png")));

    // Automatic scrolling
    scrollHandler = new ScrollHandler();
    scrollTimer = new Timer(60, scrollHandler);
    scrollTimer.setInitialDelay(300); // default InitialDelay?
    forwardButton.addMouseListener(scrollHandler);
    rewindButton.addMouseListener(scrollHandler);
  }
  public ListElementButtons(final LocalMovie movie, final MainPanel parentPanel) {
    this.movie = movie;
    this.parentPanel = parentPanel;

    playlistButton = new JButton(Localization.managePlaylistsButtonIcon);
    seenButton = new JToggleButton();
    wishButton = new JToggleButton();
    favoriteButton = new JToggleButton();

    playlistButton.setToolTipText(Localization.managePlaylistsButtonToolTipText);
    playlistButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            // Build the playlist Menu.
            playlistMenu = new JPopupMenu(Localization.managePlaylistsMenuTitle);
            FlowLayout flowLayout = new FlowLayout();
            flowLayout.setHgap(8);
            flowLayout.setVgap(8);
            JPanel labelPanel = new JPanel();
            labelPanel.setLayout(flowLayout);
            JLabel label = new JLabel(Localization.managePlaylistsMenuDescriptionText);
            labelPanel.add(label);
            labelPanel.setOpaque(false);
            playlistMenu.add(labelPanel);

            try {
              Dao<Playlist, Integer> listsDb = DatabaseManager.getInstance().getListDao();
              // fetch all lists
              for (final Playlist playlist : listsDb) {
                if (playlist.getId() < Playlist.fixedPlaylists.length + 1) continue;
                final JCheckBoxMenuItem listItem = new JCheckBoxMenuItem(playlist.getName(), null);

                // TODO much better way to find out if the movie is
                // in the
                // playlist.movie_list.contains(movie) do not work
                // as it should
                // maybe override the contains function in playlist
                for (LocalMovie compareMovie : playlist.getMovies()) {
                  if (compareMovie.compareTo(movie) == 0) {
                    listItem.setSelected(true);
                    break;
                  }
                }
                playlistMenu.add(listItem);
                // for each playlist entry, add a listener
                listItem.addActionListener(
                    new ActionListener() {

                      @Override
                      public void actionPerformed(ActionEvent e) {
                        try {
                          // add it to the list, put it last
                          if (listItem.isSelected()) {
                            playlist.add(movie);
                          } else {
                            playlist.remove(movie);
                          }

                        } catch (SQLException e1) {
                          e1.printStackTrace();
                        }
                      }
                    });
              }
            } catch (SQLException e2) {
              e2.printStackTrace();
            }

            // a nice line
            playlistMenu.addSeparator();
            JMenuItem AddToNewListItem =
                new JMenuItem(Localization.movieAddToNewPlaylistText, null);
            playlistMenu.add(AddToNewListItem);
            AddToNewListItem.addActionListener(
                new ActionListener() {

                  @Override
                  public void actionPerformed(ActionEvent e) {
                    parentPanel.showCreatePlaylist(movie);
                  }
                });

            playlistMenu.show(playlistButton, 0, 0 + 50);
          }
        });
    if (movie.isWish()) {
      wishButton.setIcon(Localization.movieStarButtonIcon);
      wishButton.setToolTipText(Localization.toolTipsWishDisable);
    } else {
      wishButton.setIcon(Localization.movieStarButtonIconDisabled);
      wishButton.setToolTipText(Localization.toolTipsWish);
    }

    if (movie.isFavorite()) {
      favoriteButton.setIcon(Localization.movieFavoriteButtonIcon);
      favoriteButton.setToolTipText(Localization.toolTipsFavoriteDisable);
    } else {
      favoriteButton.setIcon(Localization.movieFavoriteButtonIconDisabled);
      favoriteButton.setToolTipText(Localization.toolTipsFavorite);
    }

    if (movie.isSeen()) {
      seenButton.setIcon(Localization.movieSeenButtonIcon);
      seenButton.setToolTipText(Localization.toolTipsSeenDisable);
    } else {
      seenButton.setIcon(Localization.movieSeenButtonIconDisabled);
      seenButton.setToolTipText(Localization.toolTipsSeen);
    }

    wishButton.setSelected(movie.isWish());
    favoriteButton.setSelected(movie.isFavorite());
    seenButton.setSelected(movie.isSeen());
    seenButton.setHorizontalTextPosition(SwingConstants.RIGHT);
    wishButton.setHorizontalTextPosition(SwingConstants.RIGHT);
    favoriteButton.setHorizontalTextPosition(SwingConstants.RIGHT);

    wishButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              DatabaseManager.getInstance().getMovieDao().refresh(movie);
              movie.setWish(wishButton.isSelected());
              DatabaseManager.getInstance().getMovieDao().update(movie);
              if (wishButton.isSelected()) {
                Playlist.getWishlist().add(movie);
              } else {
                Playlist.getWishlist().remove(movie);
              }
            } catch (SQLException e1) {
              System.out.println("Failed to update movie with wish");
            }

            if (movie.isWish()) {
              wishButton.setIcon(Localization.movieStarButtonIcon);
              wishButton.setToolTipText(Localization.toolTipsWishDisable);
            } else {
              wishButton.setIcon(Localization.movieStarButtonIconDisabled);
              wishButton.setToolTipText(Localization.toolTipsWish);
            }
          }
        });

    favoriteButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {

            try {
              DatabaseManager.getInstance().getMovieDao().refresh(movie);
              movie.setFavorite(favoriteButton.isSelected());
              DatabaseManager.getInstance().getMovieDao().update(movie);

              if (favoriteButton.isSelected()) {
                Playlist.getFavoriteList().add(movie);
              } else {
                Playlist.getFavoriteList().remove(movie);
              }

            } catch (SQLException e1) {
              System.out.println("Failed to update movie with favorite");
            }
            if (movie.isFavorite()) {
              favoriteButton.setIcon(Localization.movieFavoriteButtonIcon);
              favoriteButton.setToolTipText(Localization.toolTipsFavoriteDisable);
            } else {
              favoriteButton.setIcon(Localization.movieFavoriteButtonIconDisabled);
              favoriteButton.setToolTipText(Localization.toolTipsFavorite);
            }
          }
        });

    seenButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              DatabaseManager.getInstance().getMovieDao().refresh(movie);
              movie.setSeen(seenButton.isSelected());
              if (movie.isSeen()) {
                seenButton.setIcon(Localization.movieSeenButtonIcon);
                seenButton.setToolTipText(Localization.toolTipsSeenDisable);
              } else {
                seenButton.setIcon(Localization.movieSeenButtonIconDisabled);
                seenButton.setToolTipText(Localization.toolTipsSeen);
              }

              DatabaseManager.getInstance().getMovieDao().update(movie);
            } catch (SQLException e1) {
              System.out.println("Failed to update movie with new rating");
            }
          }
        });
    this.setOpaque(false);
    this.setLayout(new GridLayout(1, 4));
    add(playlistButton);
    add(seenButton);
    add(favoriteButton);
    add(wishButton);
  }
  public ViewCargarVenderor(Window v) {
    super(v, "Seleccione bombero", Dialog.ModalityType.DOCUMENT_MODAL);
    setTitle("Seleccionar");
    Font myFont = new Font("OCR A Extended", Font.PLAIN, 25);
    grupoOpciones = new ButtonGroup(); // crea ButtonGroup//para el grupo de la forma de pago
    getContentPane().setBackground(PanelPadre.color1);

    getContentPane().setLayout(null);

    panel = new JPanel();
    panel.setBackground(PanelPadre.color1);
    panel.setBounds(221, 11, 357, 165);
    getContentPane().add(panel);
    panel.setLayout(null);

    JLabel lblPagaCon = new JLabel("Codigo:");
    lblPagaCon.setFont(new Font("Georgia", Font.BOLD, 13));
    lblPagaCon.setBounds(0, 11, 106, 14);
    panel.add(lblPagaCon);

    txtEfectivo = new JTextField();
    txtEfectivo.setBounds(116, 3, 223, 41);
    txtEfectivo.setFont(myFont);
    panel.add(txtEfectivo);
    txtEfectivo.setColumns(10);

    JLabel lblCambio = new JLabel("Nombre:");
    lblCambio.setFont(new Font("Georgia", Font.BOLD, 13));
    lblCambio.setBounds(0, 63, 106, 14);
    panel.add(lblCambio);

    txtCambio = new JTextField();
    txtCambio.setEditable(false);
    txtCambio.setFont(myFont);
    txtCambio.setBounds(116, 55, 223, 37);
    panel.add(txtCambio);
    txtCambio.setColumns(10);

    lblApellido = new JLabel("Apellido:");
    lblApellido.setFont(new Font("Georgia", Font.BOLD, 13));
    lblApellido.setBounds(0, 112, 90, 14);
    panel.add(lblApellido);

    txtApellido = new JTextField();
    txtApellido.setEditable(false);
    txtApellido.setBounds(116, 103, 223, 37);
    txtApellido.setFont(myFont);
    panel.add(txtApellido);
    txtApellido.setColumns(10);

    // imagen para el boton efectivo
    ImageIcon imgEfectivo =
        new ImageIcon(BotonCancelar.class.getResource("/view/recursos/USUARIOS.png"));

    Image image = imgEfectivo.getImage();
    // reduce by 50%
    image =
        image.getScaledInstance(
            image.getWidth(null) / 3, image.getHeight(null) / 3, Image.SCALE_SMOOTH);
    imgEfectivo.setImage(image);

    btnCobrar = new BotonCobrar();
    btnCobrar.setSize(128, 77);
    btnCobrar.setText("F2 Cobrar");
    // btnCobrar.setBounds(424, 209, 144, 38);
    btnCobrar.setLocation(424, 209);
    getContentPane().add(btnCobrar);

    btnCerrar = new BotonCancelar();
    // btnCerrar.setHorizontalAlignment(SwingConstants.LEFT);
    btnCerrar.setText("Esc Cerrar");
    // btnCerrar.setBounds(252, 209, 144, 38);
    btnCerrar.setLocation(252, 209);
    getContentPane().add(btnCerrar);

    panel_2 = new JPanel();
    panel_2.setBackground(new Color(60, 179, 113));
    panel_2.setBounds(0, 0, 219, 301);
    getContentPane().add(panel_2);
    panel_2.setLayout(null);

    tglbtnEfectivo = new JToggleButton("Vendedor");
    tglbtnEfectivo.setBounds(10, 27, 199, 111);
    panel_2.add(tglbtnEfectivo);

    tglbtnEfectivo.setHorizontalAlignment(SwingConstants.LEFT);
    tglbtnEfectivo.setIcon(imgEfectivo);
    grupoOpciones.add(tglbtnEfectivo);
    tglbtnEfectivo.setSelected(true);

    this.setSize(588, 330);
    this.setPreferredSize(new Dimension(588, 330));
    // setUndecorated(true);

    this.setResizable(false);
    // centrar la ventana en la pantalla
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(
        dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
    this.pack();
  }
Esempio n. 21
0
  private void initEditor() {
    ApplicationContext c = Application.getInstance(RoutingDemo.class).getContext();
    ActionMap appActionMap = c.getActionMap(RoutingDemo.getApplication());
    ActionMap editorActionMap = c.getActionMap(EditorController.getInstance());
    ActionMap simulationActionMap = c.getActionMap(SimulationController.getInstance());
    ResourceMap fileRm = c.getResourceMap(DocumentController.class);
    ActionMap fileActionMap = c.getActionMap(DocumentController.getInstance());

    btnNew = new JButton();
    btnNew.setAction(fileActionMap.get("newFileAction"));
    add(btnNew);

    btnLoad = new JButton();
    btnLoad.setAction(fileActionMap.get("loadFileAction"));
    add(btnLoad);

    btnReload = new JButton();
    btnReload.setAction(fileActionMap.get("reloadFileAction"));
    add(btnReload);

    btnSave = new JButton();
    btnSave.setAction(fileActionMap.get("saveFileAction"));
    add(btnSave);

    btnSaveAs = new JButton();
    btnSaveAs.setAction(fileActionMap.get("saveFileAsAction"));
    add(btnSaveAs);

    btnClose = new JButton();
    btnClose.setAction(fileActionMap.get("closeFileAction"));
    add(btnClose);

    btnExit = new JButton();
    btnExit.setAction(appActionMap.get("quit"));
    btnExit.setText("");
    btnExit.setIcon(fileRm.getImageIcon("quitAction.Action.icon"));
    add(btnExit);

    addSeparator();

    btngGroup = new ButtonGroup();

    btnSelection = new JToggleButton();
    btnSelection.setAction(editorActionMap.get("setSelectionEditorStateAction"));
    btnSelection.setText("");
    btnSelection.setIcon(fileRm.getImageIcon("selectionAction.Action.icon"));
    btnSelection.setSelected(true);
    btngGroup.add(btnSelection);
    add(btnSelection);

    btnAddNode = new JToggleButton();
    btnAddNode.setAction(editorActionMap.get("setAddNodeEditorStateAction"));
    btnAddNode.setText("");
    btnAddNode.setIcon(fileRm.getImageIcon("addPointAction.Action.icon"));
    btngGroup.add(btnAddNode);
    add(btnAddNode);

    btnAddEdge = new JToggleButton();
    btnAddEdge.setAction(editorActionMap.get("setAddEdgeEditorStateAction"));
    btnAddEdge.setText("");
    btngGroup.add(btnAddEdge);
    btnAddEdge.setIcon(fileRm.getImageIcon("addEdgeAction.Action.icon"));
    add(btnAddEdge);

    btnSetProperties = new JToggleButton();
    btnSetProperties.setAction(editorActionMap.get("setSetPropertiesEditorStateAction"));
    btnSetProperties.setText("");
    btngGroup.add(btnSetProperties);
    btnSetProperties.setIcon(fileRm.getImageIcon("setPropertiesAction.Action.icon"));
    add(btnSetProperties);

    btnSimulate = new JButton();
    btnSimulate.setAction(simulationActionMap.get("showSimulationDialogAction"));
    btnSimulate.setText("");
    btngGroup.add(btnSimulate);
    btnSimulate.setIcon(fileRm.getImageIcon("simulateAction.Action.icon"));
    add(btnSimulate);
  }
Esempio n. 22
0
  /**
   * Creates a new instance of <code>Channel</code> using the specified non-<code>null</code>
   * channel model.
   *
   * @param model The model to be used by this channel.
   * @throws IllegalArgumentException If the model is <code>null</code>.
   */
  public Channel(SamplerChannelModel model) {
    super(model);

    setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));

    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

    // setToolTipText(" Channel: " + String.valueOf(getChannelID()) + " ");

    Dimension d = btnInstr.getPreferredSize();
    btnInstr.setMaximumSize(new Dimension(Short.MAX_VALUE, d.height));
    p.add(btnInstr);
    p.add(Box.createRigidArea(new Dimension(6, 0)));

    lStreams.setHorizontalAlignment(JLabel.CENTER);
    lVoices.setHorizontalAlignment(JLabel.CENTER);

    JPanel statPane = new JPanel();
    statPane.setBorder(BorderFactory.createLoweredBevelBorder());
    statPane.setLayout(new BoxLayout(statPane, BoxLayout.X_AXIS));
    statPane.add(Box.createRigidArea(new Dimension(6, 0)));
    statPane.add(lStreams);
    statPane.add(new JLabel("/"));
    statPane.add(lVoices);
    statPane.add(Box.createRigidArea(new Dimension(6, 0)));

    p.add(statPane);

    p.add(Box.createRigidArea(new Dimension(6, 0)));

    btnMute.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    p.add(btnMute);
    p.add(Box.createRigidArea(new Dimension(6, 0)));

    btnSolo.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    p.add(btnSolo);
    p.add(Box.createRigidArea(new Dimension(6, 0)));

    JPanel volumePane = new JPanel();
    volumePane.setBorder(BorderFactory.createLoweredBevelBorder());
    volumePane.setLayout(new BoxLayout(volumePane, BoxLayout.X_AXIS));
    volumePane.add(Box.createRigidArea(new Dimension(6, 0)));

    d = slVolume.getPreferredSize();
    slVolume.setMaximumSize(new Dimension(d.width > 300 ? d.width : 300, d.height));
    volumePane.add(slVolume);

    lVolume.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 6));
    lVolume.setHorizontalAlignment(lVolume.RIGHT);

    // We use this to set the size of the lVolume that will be used in setVolume()
    // to prevent the frequent resizing of lVolume
    lVolume.setText("100%");

    volumePane.add(lVolume);

    p.add(volumePane);
    p.add(Box.createRigidArea(new Dimension(6, 0)));

    btnProperties.setContentAreaFilled(false);
    btnProperties.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    btnProperties.setIcon(iconShowProperties);
    btnProperties.setSelectedIcon(iconHideProperties);
    p.add(btnProperties);

    mainPane.add(p);

    propertiesPane = new ChannelProperties(model);
    propertiesPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3));
    propertiesPane.setVisible(false);
    mainPane.add(propertiesPane);
    add(mainPane);

    d = getPreferredSize();
    setMaximumSize(new Dimension(getMaximumSize().width, d.height));

    getModel().addSamplerChannelListener(getHandler());

    actInstr =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            if (actInstr.isEnabled()) loadInstrument();
          }
        };

    btnInstr.addActionListener(actInstr);

    btnMute.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeMute();
          }
        });

    btnSolo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeSolo();
          }
        });

    slVolume.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            setVolume();
          }
        });

    btnProperties.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            showProperties(btnProperties.isSelected());

            String s;
            if (btnProperties.isSelected()) {
              s = i18n.getButtonLabel("Channel.ttHideProps");
            } else {
              s = i18n.getButtonLabel("Channel.ttShowProps");
            }

            btnProperties.setToolTipText(s);
          }
        });

    btnProperties.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    String s;
    if (btnProperties.isSelected()) s = i18n.getButtonLabel("Channel.ttHideProps");
    else s = i18n.getButtonLabel("Channel.ttShowProps");

    btnProperties.setToolTipText(s);

    addPropertyChangeListener(getHandler());

    updateChannelInfo();
  }