Changeset 240 for trunk/loci/visbio/view


Ignore:
Timestamp:
03/19/05 15:43:55 (15 years ago)
Author:
curtis
Message:

Gray out Remove, Up and Down buttons when not applicable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/view/CaptureWindow.java

    r193 r240  
    5454  protected DefaultListModel posListModel; 
    5555 
     56  /** Button for removing selected position. */ 
     57  protected JButton remove; 
     58 
     59  /** Button for moving selected position upward. */ 
     60  protected JButton moveUp; 
     61 
     62  /** Button for moving selected position downward. */ 
     63  protected JButton moveDown; 
     64 
    5665  /** Slider for adjusting movie speed. */ 
    5766  protected JSlider speed; 
     
    9099 
    91100    // remove button 
    92     JButton remove = new JButton("Remove"); 
     101    remove = new JButton("Remove"); 
    93102    remove.setActionCommand("Remove"); 
    94103    remove.addActionListener(this); 
    95104    if (!LAFUtil.isMacLookAndFeel()) remove.setMnemonic('r'); 
    96105    remove.setToolTipText("Removes the selected position from the list"); 
     106    remove.setEnabled(false); 
    97107 
    98108    // up button 
    99     JButton up = new JButton("Up"); 
    100     up.setActionCommand("Up"); 
    101     up.addActionListener(this); 
    102     if (!LAFUtil.isMacLookAndFeel()) up.setMnemonic('u'); 
    103     up.setToolTipText("Moves the selected position up in the list"); 
     109    moveUp = new JButton("Up"); 
     110    moveUp.setActionCommand("Up"); 
     111    moveUp.addActionListener(this); 
     112    if (!LAFUtil.isMacLookAndFeel()) moveUp.setMnemonic('u'); 
     113    moveUp.setToolTipText("Moves the selected position up in the list"); 
     114    moveUp.setEnabled(false); 
    104115 
    105116    // down button 
    106     JButton down = new JButton("Down"); 
    107     down.setActionCommand("Down"); 
    108     down.addActionListener(this); 
    109     if (!LAFUtil.isMacLookAndFeel()) down.setMnemonic('d'); 
    110     down.setToolTipText("Moves the selected position down in the list"); 
     117    moveDown = new JButton("Down"); 
     118    moveDown.setActionCommand("Down"); 
     119    moveDown.addActionListener(this); 
     120    if (!LAFUtil.isMacLookAndFeel()) moveDown.setMnemonic('d'); 
     121    moveDown.setToolTipText("Moves the selected position down in the list"); 
     122    moveDown.setEnabled(false); 
    111123 
    112124    // snapshot button 
     
    179191    bsb.addGridded(remove); 
    180192    bsb.addUnrelatedGap(); 
    181     bsb.addGridded(up); 
     193    bsb.addGridded(moveUp); 
    182194    bsb.addRelatedGap(); 
    183     bsb.addGridded(down); 
     195    bsb.addGridded(moveDown); 
    184196    JPanel buttons = bsb.getPanel(); 
    185197 
     
    400412  public void valueChanged(ListSelectionEvent e) { 
    401413    int ndx = posList.getSelectedIndex(); 
     414    remove.setEnabled(ndx >= 0); 
     415    moveUp.setEnabled(ndx > 0); 
     416    moveDown.setEnabled(ndx < posListModel.getSize() - 1); 
    402417    if (ndx < 0) return; 
    403418    DisplayPosition pos = (DisplayPosition) posListModel.getElementAt(ndx); 
Note: See TracChangeset for help on using the changeset viewer.