Skip to content
Snippets Groups Projects
Commit 617a58c7 authored by Anian Bühler's avatar Anian Bühler
Browse files

added/fixed "isBad"-functionality to RBHiglightHandler

parent d4facd63
No related branches found
No related tags found
1 merge request!1Dev preferences
......@@ -21,6 +21,7 @@ import javax.swing.SwingUtilities;
import edu.mit.blocks.workspace.RBParent;
import edu.mit.blocks.codeblocks.Block;
import edu.mit.blocks.codeblockutil.GraphicsManager;
/**
......@@ -41,10 +42,12 @@ public class RBHighlightHandler extends JComponent implements ComponentListener,
private Area blockArea = null;
private RenderableBlock rb;
private BufferedImage hImage;
private Block block = null;
public RBHighlightHandler(RenderableBlock rb) {
super();
this.rb = rb;
this.block = rb.getBlock();
setSize(HIGHLIGHT_STROKE_WIDTH / 2, 1);
this.setOpaque(false);
hColor = null;
......@@ -122,17 +125,19 @@ public class RBHighlightHandler extends JComponent implements ComponentListener,
}
// cache the focus so it'll know when it needs to redraw later.
hasFocus = rb.getBlock().hasFocus();
//hasFocus = rb.getBlock().hasFocus();
hasFocus = block.hasFocus();
boolean isBad = block.isBad();
Color color = null;
if (hColor != null) {
color = hColor;
} else if (rb.getBlock().hasFocus()) {
} else if (hasFocus) {
color = new Color(200, 200, 255); //Color.BLUE);
} else if (isBad) {
color = new Color(255, 100, 100); //Color.RED);
} else if (isSearchResult) {
color = new Color(255, 255, 120); //Color.YELLOW);
} else if (rb.getBlock().isBad()) {
color = new Color(255, 100, 100); //Color.RED);
} else {
GraphicsManager.recycleGCCompatibleImage(hImage);
hImage = null;
......
......
......@@ -273,7 +273,6 @@ public class RenderableBlock extends JComponent implements SearchableElement,
} else {
blockArea = new Area();
}
highlighter = new RBHighlightHandler(this);
String blockDescription = getBlock().getBlockDescription();
......
......
......@@ -26,7 +26,7 @@ import edu.mit.blocks.codeblockutil.Canvas;
class FactoryCanvas extends JPanel implements Canvas, SearchableContainer, RBParent, ComponentListener {
private static final long serialVersionUID = 328149080291L;
private static final int BORDER_WIDTH = 10;
private static final int BORDER_WIDTH = 8;
/** The highlight of this canvas */
private Color highlight = null;
/** The color of this canvas */
......@@ -66,7 +66,7 @@ class FactoryCanvas extends JPanel implements Canvas, SearchableContainer, RBPar
public void updateContainsSearchResults(boolean containsSearchResults) {
Color previousHighlight = this.highlight;
if (containsSearchResults) {
this.setHighlight(Color.yellow);
this.setHighlight(Color.black);
} else {
this.setHighlight(null);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment