From 704b984b0fcc00d2c00d963ce6c6e87f4f183766 Mon Sep 17 00:00:00 2001 From: weisj Date: Sat, 21 Sep 2019 22:59:14 +0200 Subject: [PATCH] Removed Preview features. --- .../com/weis/darklaf/ui/text/DarkCaret.java | 28 +++++++++++-------- .../weis/darklaf/ui/text/DarkTextFieldUI.java | 8 ++++-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/weis/darklaf/ui/text/DarkCaret.java b/src/main/java/com/weis/darklaf/ui/text/DarkCaret.java index 2cc43d40..5f012b7b 100644 --- a/src/main/java/com/weis/darklaf/ui/text/DarkCaret.java +++ b/src/main/java/com/weis/darklaf/ui/text/DarkCaret.java @@ -119,15 +119,15 @@ public class DarkCaret extends DefaultCaret implements UIResource { if (clickCount > 2) { clickCount %= 2; // Alternate selecting word/line. switch (clickCount) { - case 0 -> { + case 0: selectWord(e); selectedWordEvent = null; - } - case 1 -> { + break; + case 1: selectLine.actionPerformed(new ActionEvent(textArea, ActionEvent.ACTION_PERFORMED, null, e.getWhen(), e.getModifiersEx())); - } + break; } } } else if (SwingUtilities.isMiddleMouseButton(e) && @@ -209,28 +209,32 @@ public class DarkCaret extends DefaultCaret implements UIResource { Color textAreaBg = textArea.getBackground(); switch (style) { - case BLOCK_STYLE -> { + case BLOCK_STYLE: if (textAreaBg == null) { textAreaBg = Color.white; } g.setXORMode(textAreaBg); g.fillRect(r.x, r.y, r.width, r.height); - } - case BLOCK_BORDER_STYLE -> g.drawRect(r.x, r.y, r.width - 1, r.height); - case UNDERLINE_STYLE -> { + break; + case BLOCK_BORDER_STYLE: + g.drawRect(r.x, r.y, r.width - 1, r.height); + break; + case UNDERLINE_STYLE: if (textAreaBg == null) { textAreaBg = Color.white; } g.setXORMode(textAreaBg); int y = r.y + r.height; g.drawLine(r.x, y, r.x + r.width - 1, y); - } - case THICK_VERTICAL_LINE_STYLE -> { + break; + case THICK_VERTICAL_LINE_STYLE: g.drawLine(r.x, r.y, r.x, r.y + r.height); r.x++; g.drawLine(r.x, r.y, r.x, r.y + r.height); - } - case VERTICAL_LINE_STYLE -> g.drawLine(r.x, r.y, r.x, r.y + r.height); + break; + case VERTICAL_LINE_STYLE: + g.drawLine(r.x, r.y, r.x, r.y + r.height); + break; } } catch (BadLocationException ble) { ble.printStackTrace(); diff --git a/src/main/java/com/weis/darklaf/ui/text/DarkTextFieldUI.java b/src/main/java/com/weis/darklaf/ui/text/DarkTextFieldUI.java index 3e740b7b..2ad98b00 100644 --- a/src/main/java/com/weis/darklaf/ui/text/DarkTextFieldUI.java +++ b/src/main/java/com/weis/darklaf/ui/text/DarkTextFieldUI.java @@ -43,9 +43,11 @@ public class DarkTextFieldUI extends DarkTextFieldUIBridge implements PropertyCh } }; private final MouseListener mouseListener = (MouseClickListener) e -> { - switch (getActionUnder(e.getPoint())) { - case CLEAR -> getComponent().setText(""); - case SEARCH_POPUP -> showSearchPopup(); + ClickAction actionUnder = getActionUnder(e.getPoint()); + if (actionUnder == ClickAction.CLEAR) { + getComponent().setText(""); + } else if (actionUnder == ClickAction.SEARCH_POPUP) { + showSearchPopup(); } }; private final MouseMotionListener mouseMotionListener = (MouseMovementListener) e -> updateCursor(e.getPoint());