Ignore:
Timestamp:
Oct 7, 2007, 9:44:45 PM (17 years ago)
Author:
quentin
Message:

Added control and alt checkboxes, for ease of typing modifier sequences

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/vnc/vnc_javasrc/ButtonPanel.java

    r66 r128  
    2828import java.io.*;
    2929
    30 class ButtonPanel extends Panel implements ActionListener {
     30class ButtonPanel extends Panel implements ActionListener, ItemListener {
    3131
    3232  VncViewer viewer;
     
    3737  Button ctrlAltDelButton;
    3838  Button refreshButton;
     39  Checkbox altCheckbox;
     40  Checkbox ctrlCheckbox;
    3941
    4042  ButtonPanel(VncViewer v) {
     
    6668    add(refreshButton);
    6769    refreshButton.addActionListener(this);
     70   
     71    altCheckbox = new Checkbox("Alt");
     72    altCheckbox.setEnabled(false);
     73    add(altCheckbox);
     74    altCheckbox.addItemListener(this);
     75    ctrlCheckbox = new Checkbox("Control");
     76    ctrlCheckbox.setEnabled(false);
     77    add(ctrlCheckbox);
     78    ctrlCheckbox.addItemListener(this);
    6879  }
    6980
     
    104115  public void enableRemoteAccessControls(boolean enable) {
    105116    ctrlAltDelButton.setEnabled(enable);
     117    ctrlCheckbox.setEnabled(enable);
     118    altCheckbox.setEnabled(enable);
    106119  }
    107120
     
    151164    }
    152165  }
     166    public void itemStateChanged(ItemEvent evt) {
     167        viewer.moveFocusToDesktop();
     168        int state = evt.getStateChange();
     169        int extraModifiers = 0;
     170        if (altCheckbox.getState()) { extraModifiers |= InputEvent.ALT_MASK; }
     171        if (ctrlCheckbox.getState()) { extraModifiers |= InputEvent.CTRL_MASK; }
     172        viewer.vc.extraModifiers = extraModifiers;
     173    }
    153174}
    154175
Note: See TracChangeset for help on using the changeset viewer.