Better Hex Editor in Dark Mode

This commit is contained in:
Nico Mexis 2021-07-21 23:20:42 +02:00
parent 06d07959bb
commit fa85fd7479
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78
2 changed files with 11 additions and 9 deletions

View file

@ -11,6 +11,7 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.*;
import javax.swing.*;
import the.bytecode.club.bytecodeviewer.Configuration;
/**
* @author laullon
@ -235,9 +236,9 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
@Override
public void paint(Graphics g) {
Dimension d = getMinimumSize();
g.setColor(Color.white);
g.setColor(Configuration.lafTheme.isDark() ? Color.darkGray : Color.white);
g.fillRect(0, 0, d.width, d.height);
g.setColor(Color.black);
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
g.setFont(font);
for (int n = 0; n < textLength; n++) {
@ -297,9 +298,9 @@ public class JHexEditor extends JPanel implements FocusListener, AdjustmentListe
public void paint(Graphics g)
{
Dimension d = getMinimumSize();
g.setColor(Color.white);
g.setColor(Configuration.lafTheme.isDark() ? Color.darkGray : Color.white);
g.fillRect(0, 0, d.width, d.height);
g.setColor(Color.black);
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
g.setFont(font);
int ini = getInicio();

View file

@ -9,6 +9,7 @@ import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComponent;
import the.bytecode.club.bytecodeviewer.Configuration;
/**
* @author laullon
@ -65,9 +66,9 @@ public class JHexEditorASCII extends JComponent implements MouseListener, KeyLis
debug("paint(" + g + ")");
debug("cursor=" + he.cursor + " buff.length=" + he.buff.length);
Dimension d = getMinimumSize();
g.setColor(Color.white);
g.setColor(Configuration.lafTheme.isDark() ? Color.darkGray : Color.white);
g.fillRect(0, 0, d.width, d.height);
g.setColor(Color.black);
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
g.setFont(he.font);
@ -87,11 +88,11 @@ public class JHexEditorASCII extends JComponent implements MouseListener, KeyLis
else
he.cuadro(g, x, y, 1);
if (hasFocus())
g.setColor(Color.white);
g.setColor(Configuration.lafTheme.isDark() ? Color.black : Color.white);
else
g.setColor(Color.black);
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
} else {
g.setColor(Color.black);
g.setColor(Configuration.lafTheme.isDark() ? Color.white : Color.black);
}
String s = String.valueOf((char) (he.buff[n] & 0xFF));//"" + new Character((char) he.buff[n]);