Commit ee9d56dc authored by petter's avatar petter
Browse files

Highlight when painting in fallthrough mode

git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@138 0463f305-d864-43cb-8a47-61cf597d4139
parent 8913f189
...@@ -59,9 +59,12 @@ public class PaintListener extends RFBKeyAndMouseListener implements KeyEventDis ...@@ -59,9 +59,12 @@ public class PaintListener extends RFBKeyAndMouseListener implements KeyEventDis
static int instancecount = 0; static int instancecount = 0;
GraphicsContext graphicsContext; GraphicsContext graphicsContext;
private PaintControls paintControls; private PaintControls paintControls;
private Player player;
public PaintListener(GraphicsContext graphicsContext) { public PaintListener(GraphicsContext graphicsContext, Player player) {
super(graphicsContext); super(graphicsContext);
this.player=player;
this.graphicsContext = graphicsContext; this.graphicsContext = graphicsContext;
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
...@@ -109,7 +112,8 @@ public class PaintListener extends RFBKeyAndMouseListener implements KeyEventDis ...@@ -109,7 +112,8 @@ public class PaintListener extends RFBKeyAndMouseListener implements KeyEventDis
public void setActivated(boolean activated) { public void setActivated(boolean activated) {
this.activated = activated; this.activated = activated;
player.indicateOverlay(activated);
// set cursor // set cursor
if (activated) { if (activated) {
......
...@@ -63,6 +63,7 @@ import javax.swing.JPopupMenu; ...@@ -63,6 +63,7 @@ import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem; import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import javax.swing.border.EmptyBorder;
import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameEvent;
...@@ -456,16 +457,23 @@ public class Player extends JInternalFrame { ...@@ -456,16 +457,23 @@ public class Player extends JInternalFrame {
System.out.println(protocol.getProtocolPreferences()); System.out.println(protocol.getProtocolPreferences());
// add user input // add user input
PaintListener listener = new PaintListener(protocol); PaintListener listener = new PaintListener(protocol,this);
protocol.addKeyListener(listener); protocol.addKeyListener(listener);
protocol.addMouseListener(listener); protocol.addMouseListener(listener);
protocol.addMouseMotionListener(listener); protocol.addMouseMotionListener(listener);
// MODMSG // MODMSG
protocol.setPaintListener(listener); protocol.setPaintListener(listener);
// add display // add display
JPanel pane = new JPanel(new BorderLayout()); JPanel pane = new JPanel(new BorderLayout());
pane.add(new JScrollPane(protocol), BorderLayout.CENTER);
backgroundindicator = new JPanel(new BorderLayout());
backgroundindicator.add(new JScrollPane(protocol),BorderLayout.CENTER);
backgroundindicator.setBorder(new EmptyBorder(10, 10, 10, 10) );
backgroundindicator.setBackground(Color.RED);
pane.add(backgroundindicator, BorderLayout.CENTER);
setTitle(protocol.getProtocolPreferences().name); setTitle(protocol.getProtocolPreferences().name);
setContentPane(pane); setContentPane(pane);
...@@ -525,6 +533,7 @@ public class Player extends JInternalFrame { ...@@ -525,6 +533,7 @@ public class Player extends JInternalFrame {
pane = new GradientPanel(); pane = new GradientPanel();
pane.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 0)); pane.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 0));
pane.add(recorder.getLoopbackControls()); pane.add(recorder.getLoopbackControls());
setContentPane(pane); setContentPane(pane);
pack(); pack();
} }
...@@ -679,6 +688,12 @@ public class Player extends JInternalFrame { ...@@ -679,6 +688,12 @@ public class Player extends JInternalFrame {
} }
Recorder recorder = null; Recorder recorder = null;
public void indicateOverlay(boolean overlay){
if (overlay) backgroundindicator.setBackground(Color.GRAY);
else backgroundindicator.setBackground(Color.red);
backgroundindicator.repaint();
}
private JPanel backgroundindicator;
public Recorder getRecorder() { public Recorder getRecorder() {
return recorder; return recorder;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment