Debugger stub - TODO

This commit is contained in:
Jindra Petřík
2015-11-15 16:09:11 +01:00
parent 88ce1ed405
commit 668e1e2f14
11 changed files with 204 additions and 12 deletions
@@ -32,6 +32,8 @@ import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.HashMap;
import java.util.Map;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.plaf.TextUI;
@@ -65,6 +67,15 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
private LinkHandler linkHandler = this;
private Map<Integer, Color> lineColors = new HashMap<>();
public void setLineColor(int line, Color color) {
lineColors.remove(line);
if (color != null) {
lineColors.put(line, color);
}
}
public int getLine() {
return lastLine;
}
@@ -358,10 +369,11 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
public void paint(Graphics g) {
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
FontMetrics fontMetrics = g.getFontMetrics();
int lh = fontMetrics.getHeight();
int d = fontMetrics.getDescent();
if (lastLine > 0) {
FontMetrics fontMetrics = g.getFontMetrics();
int lh = fontMetrics.getHeight();
int d = fontMetrics.getDescent();
if (error) {
g.setColor(new Color(255, 200, 200));
} else {
@@ -369,6 +381,10 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan
}
g.fillRect(0, d + lh * lastLine - 1, getWidth(), lh);
}
for (int line : lineColors.keySet()) {
g.setColor(lineColors.get(line));
g.fillRect(0, d + lh * line - 1, getWidth(), lh);
}
super.paint(g);
}
}