Commit ee9d56dc authored by petter's avatar petter

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
static int instancecount = 0;
GraphicsContext graphicsContext;
private PaintControls paintControls;
private Player player;
public PaintListener(GraphicsContext graphicsContext) {
public PaintListener(GraphicsContext graphicsContext, Player player) {
super(graphicsContext);
this.player=player;
this.graphicsContext = graphicsContext;
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
......@@ -109,7 +112,8 @@ public class PaintListener extends RFBKeyAndMouseListener implements KeyEventDis
public void setActivated(boolean activated) {
this.activated = activated;
player.indicateOverlay(activated);
// set cursor
if (activated) {
......
......@@ -63,6 +63,7 @@ import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.border.EmptyBorder;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
......@@ -456,16 +457,23 @@ public class Player extends JInternalFrame {
System.out.println(protocol.getProtocolPreferences());
// add user input
PaintListener listener = new PaintListener(protocol);
PaintListener listener = new PaintListener(protocol,this);
protocol.addKeyListener(listener);
protocol.addMouseListener(listener);
protocol.addMouseMotionListener(listener);
// MODMSG
protocol.setPaintListener(listener);
// add display
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);
setContentPane(pane);
......@@ -525,6 +533,7 @@ public class Player extends JInternalFrame {
pane = new GradientPanel();
pane.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 0));
pane.add(recorder.getLoopbackControls());
setContentPane(pane);
pack();
}
......@@ -679,6 +688,12 @@ public class Player extends JInternalFrame {
}
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() {
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