From 3faf00de0244eeafa900afe149dd3fa0b7868d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 21 Feb 2021 15:30:44 +0100 Subject: [PATCH] Changed: Mouseover / focused bytes in hexview displayed with border instead of background color change to improve readability --- CHANGELOG.md | 2 ++ .../decompiler/flash/gui/hexview/HexView.java | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64a3127e8..5176d125a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ All notable changes to this project will be documented in this file. ### Changed - #1565, #1407, #1350 On BinaryData SWF save, parent SWF is saved +- Mouseover / focused bytes in hexview displayed with border + instead of background color change to improve readability ## [13.0.3] - 2021-02-12 ### Added diff --git a/src/com/jpexs/decompiler/flash/gui/hexview/HexView.java b/src/com/jpexs/decompiler/flash/gui/hexview/HexView.java index b76779e65..fa97ddca8 100644 --- a/src/com/jpexs/decompiler/flash/gui/hexview/HexView.java +++ b/src/com/jpexs/decompiler/flash/gui/hexview/HexView.java @@ -65,6 +65,8 @@ public class HexView extends JTable { private int mouseOverIdx = -1; + private int focusedIdx = -1; + private int selectionStart = -1; private int selectionEnd = -1; @@ -102,17 +104,16 @@ public class HexView extends JTable { background = row % 2 == 0 ? bgColor : bgColorAlternate; } - if (idx != -1 && (idx == mouseOverIdx - || (idx >= selectionStart && idx <= selectionEnd))) { - foreground = new Color(255 - foreground.getRed(), 255 - foreground.getGreen(), 255 - foreground.getBlue()); - background = new Color(255 - background.getRed(), 255 - background.getGreen(), 255 - background.getBlue()); - } - l.setForeground(foreground); l.setBackground(background); - if (hasFocus) { + if (idx != -1 && (idx == mouseOverIdx + || (idx >= selectionStart && idx <= selectionEnd))) { l.setBorder(BorderFactory.createLineBorder(Color.black, 2)); + } else if (idx == focusedIdx) { + l.setBorder(BorderFactory.createLineBorder(Color.blue, 2)); + } else { + l.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); } return l; @@ -134,6 +135,7 @@ public class HexView extends JTable { int row = table.getSelectedRow(); int idx = getIdxByColAndRow(row, col); + focusedIdx = idx; if (listener != null) { listener.byteValueChanged(idx, idx == -1 ? 0 : getModel().getData()[idx]); } @@ -235,7 +237,7 @@ public class HexView extends JTable { for (int i = 0; i < bytesInRow; i++) { column = columnModel.getColumn(i + bytesInRow + 1 + 1); - column.setMaxWidth(10); + column.setMaxWidth(14); column.setCellRenderer(cellRenderer); }