Mercurial > hg > Members > riono > TreeVNC_ja_comment
comparison src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 40:3c072f2f39bb
add Screen change function.
author | one |
---|---|
date | Mon, 22 Oct 2012 17:40:32 +0900 |
parents | c2f0b6907448 |
children | fe38611c4b2b |
comparison
equal
deleted
inserted
replaced
39:6a34a5220a01 | 40:3c072f2f39bb |
---|---|
422 public void actionPerformed(ActionEvent e) { | 422 public void actionPerformed(ActionEvent e) { |
423 sendCtrlAltDel(context); | 423 sendCtrlAltDel(context); |
424 setSurfaceToHandleKbdFocus(); | 424 setSurfaceToHandleKbdFocus(); |
425 } | 425 } |
426 }); | 426 }); |
427 | 427 |
428 JButton winButton = new JButton(Utils.getButtonIcon("win")); | 428 JButton winButton = new JButton(Utils.getButtonIcon("win")); |
429 winButton.setToolTipText("Send 'Win' key as 'Ctrl-Esc'"); | 429 winButton.setToolTipText("Send 'Win' key as 'Ctrl-Esc'"); |
430 winButton.setMargin(BUTTONS_MARGIN); | 430 winButton.setMargin(BUTTONS_MARGIN); |
431 buttonBar.add(winButton); | 431 buttonBar.add(winButton); |
432 kbdButtons.add(winButton); | 432 kbdButtons.add(winButton); |
436 sendWinKey(context); | 436 sendWinKey(context); |
437 setSurfaceToHandleKbdFocus(); | 437 setSurfaceToHandleKbdFocus(); |
438 } | 438 } |
439 }); | 439 }); |
440 | 440 |
441 JButton testButton = new JButton(Utils.getButtonIcon("test")); | |
442 testButton.setToolTipText("test"); | |
443 testButton.setMargin(BUTTONS_MARGIN); | |
444 buttonBar.add(testButton); | |
445 kbdButtons.add(testButton); | |
446 testButton.addActionListener(new ActionListener() { | |
447 @Override | |
448 public void actionPerformed(ActionEvent e) { | |
449 testKey(context); | |
450 setSurfaceToHandleKbdFocus(); | |
451 } | |
452 }); | |
453 | |
454 | |
455 | |
456 | |
441 JToggleButton ctrlButton = new JToggleButton(Utils.getButtonIcon("ctrl")); | 457 JToggleButton ctrlButton = new JToggleButton(Utils.getButtonIcon("ctrl")); |
442 ctrlButton.setToolTipText("Ctrl Lock"); | 458 ctrlButton.setToolTipText("Ctrl Lock"); |
443 ctrlButton.setMargin(BUTTONS_MARGIN); | 459 ctrlButton.setMargin(BUTTONS_MARGIN); |
444 buttonBar.add(ctrlButton); | 460 buttonBar.add(ctrlButton); |
445 kbdButtons.add(ctrlButton); | 461 kbdButtons.add(ctrlButton); |
585 context.sendMessage(new KeyEventMessage(Keymap.K_CTRL_LEFT, true)); | 601 context.sendMessage(new KeyEventMessage(Keymap.K_CTRL_LEFT, true)); |
586 context.sendMessage(new KeyEventMessage(Keymap.K_ESCAPE, true)); | 602 context.sendMessage(new KeyEventMessage(Keymap.K_ESCAPE, true)); |
587 context.sendMessage(new KeyEventMessage(Keymap.K_ESCAPE, false)); | 603 context.sendMessage(new KeyEventMessage(Keymap.K_ESCAPE, false)); |
588 context.sendMessage(new KeyEventMessage(Keymap.K_CTRL_LEFT, false)); | 604 context.sendMessage(new KeyEventMessage(Keymap.K_CTRL_LEFT, false)); |
589 } | 605 } |
606 | |
607 private void testKey(ProtocolContext context) { | |
608 System.out.println("test"); | |
609 } | |
590 | 610 |
591 @Override | 611 @Override |
592 public void windowOpened(WindowEvent e) { /* nop */ } | 612 public void windowOpened(WindowEvent e) { /* nop */ } |
593 @Override | 613 @Override |
594 public void windowClosed(WindowEvent e) { /* nop */ } | 614 public void windowClosed(WindowEvent e) { /* nop */ } |
636 Viewer viewer = new Viewer(parser); | 656 Viewer viewer = new Viewer(parser); |
637 SwingUtilities.invokeLater(viewer); | 657 SwingUtilities.invokeLater(viewer); |
638 } | 658 } |
639 | 659 |
640 public void setSocket(Socket soc) { | 660 public void setSocket(Socket soc) { |
641 workingSocket = soc; | 661 workingSocket = soc; |
642 } | 662 } |
663 /* | |
664 public void setSocket(String[] socAddr) { | |
665 connectionParams.hostName = socAddr[0]; | |
666 connectionParams.portNumber = Integer.parseInt(socAddr[1]); | |
667 System.out.println(connectionParams.hostName+" "+connectionParams.portNumber); | |
668 } | |
669 */ | |
643 | 670 |
644 public void close() { | 671 public void close() { |
645 try { | 672 try { |
646 workingProtocol.getWriter().close(); | 673 workingProtocol.getWriter().close(); |
647 workingProtocol.getReader().close(); | 674 workingProtocol.getReader().close(); |
652 e.printStackTrace(); | 679 e.printStackTrace(); |
653 } | 680 } |
654 } | 681 } |
655 | 682 |
656 public int getPort() { | 683 public int getPort() { |
657 return connectionParams.portNumber; | 684 return connectionParams.portNumber; |
658 } | 685 } |
659 | 686 |
660 } | 687 } |