Browse Source

Removed Preview features.

pull/1/head
weisj 5 years ago
parent
commit
704b984b0f
  1. 28
      src/main/java/com/weis/darklaf/ui/text/DarkCaret.java
  2. 8
      src/main/java/com/weis/darklaf/ui/text/DarkTextFieldUI.java

28
src/main/java/com/weis/darklaf/ui/text/DarkCaret.java

@ -119,15 +119,15 @@ public class DarkCaret extends DefaultCaret implements UIResource {
if (clickCount > 2) { if (clickCount > 2) {
clickCount %= 2; // Alternate selecting word/line. clickCount %= 2; // Alternate selecting word/line.
switch (clickCount) { switch (clickCount) {
case 0 -> { case 0:
selectWord(e); selectWord(e);
selectedWordEvent = null; selectedWordEvent = null;
} break;
case 1 -> { case 1:
selectLine.actionPerformed(new ActionEvent(textArea, selectLine.actionPerformed(new ActionEvent(textArea,
ActionEvent.ACTION_PERFORMED, ActionEvent.ACTION_PERFORMED,
null, e.getWhen(), e.getModifiersEx())); null, e.getWhen(), e.getModifiersEx()));
} break;
} }
} }
} else if (SwingUtilities.isMiddleMouseButton(e) && } else if (SwingUtilities.isMiddleMouseButton(e) &&
@ -209,28 +209,32 @@ public class DarkCaret extends DefaultCaret implements UIResource {
Color textAreaBg = textArea.getBackground(); Color textAreaBg = textArea.getBackground();
switch (style) { switch (style) {
case BLOCK_STYLE -> { case BLOCK_STYLE:
if (textAreaBg == null) { if (textAreaBg == null) {
textAreaBg = Color.white; textAreaBg = Color.white;
} }
g.setXORMode(textAreaBg); g.setXORMode(textAreaBg);
g.fillRect(r.x, r.y, r.width, r.height); g.fillRect(r.x, r.y, r.width, r.height);
} break;
case BLOCK_BORDER_STYLE -> g.drawRect(r.x, r.y, r.width - 1, r.height); case BLOCK_BORDER_STYLE:
case UNDERLINE_STYLE -> { g.drawRect(r.x, r.y, r.width - 1, r.height);
break;
case UNDERLINE_STYLE:
if (textAreaBg == null) { if (textAreaBg == null) {
textAreaBg = Color.white; textAreaBg = Color.white;
} }
g.setXORMode(textAreaBg); g.setXORMode(textAreaBg);
int y = r.y + r.height; int y = r.y + r.height;
g.drawLine(r.x, y, r.x + r.width - 1, y); g.drawLine(r.x, y, r.x + r.width - 1, y);
} break;
case THICK_VERTICAL_LINE_STYLE -> { case THICK_VERTICAL_LINE_STYLE:
g.drawLine(r.x, r.y, r.x, r.y + r.height); g.drawLine(r.x, r.y, r.x, r.y + r.height);
r.x++; r.x++;
g.drawLine(r.x, r.y, r.x, r.y + r.height); 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); case VERTICAL_LINE_STYLE:
g.drawLine(r.x, r.y, r.x, r.y + r.height);
break;
} }
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
ble.printStackTrace(); ble.printStackTrace();

8
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 -> { private final MouseListener mouseListener = (MouseClickListener) e -> {
switch (getActionUnder(e.getPoint())) { ClickAction actionUnder = getActionUnder(e.getPoint());
case CLEAR -> getComponent().setText(""); if (actionUnder == ClickAction.CLEAR) {
case SEARCH_POPUP -> showSearchPopup(); getComponent().setText("");
} else if (actionUnder == ClickAction.SEARCH_POPUP) {
showSearchPopup();
} }
}; };
private final MouseMotionListener mouseMotionListener = (MouseMovementListener) e -> updateCursor(e.getPoint()); private final MouseMotionListener mouseMotionListener = (MouseMovementListener) e -> updateCursor(e.getPoint());

Loading…
Cancel
Save