-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85c18c8
commit 0977e03
Showing
8 changed files
with
367 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [vincenzopalazzo] | ||
|
||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
liberapay: vincenzopalazzo | ||
custom: https://vincenzopalazzo.github.io/material-ui-swing-donations/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Java CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Build with Gradle | ||
run: ./gradlew build |
72 changes: 0 additions & 72 deletions
72
src/main/java/io/vincenzopalazzo/placeholder/CustomTextField.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/io/vincenzopalazzo/placeholder/ui/InternalPasswordFieldUI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package io.vincenzopalazzo.placeholder.ui; | ||
|
||
import io.vincenzopalazzo.placeholder.JTextFieldPlaceholder; | ||
|
||
import javax.swing.*; | ||
import javax.swing.plaf.basic.BasicPasswordFieldUI; | ||
import java.awt.event.FocusEvent; | ||
import java.awt.event.FocusListener; | ||
|
||
public class InternalPasswordFieldUI extends BasicPasswordFieldUI { | ||
|
||
|
||
protected FocusListener focusListener = new LineFocusListener(); | ||
protected JTextFieldPlaceholder textFieldPlaceholder; | ||
|
||
public InternalPasswordFieldUI(JTextFieldPlaceholder textFieldPlaceholder) { | ||
this.textFieldPlaceholder = textFieldPlaceholder; | ||
} | ||
|
||
@Override | ||
public void installUI(JComponent c) { | ||
super.installUI(c); | ||
|
||
JTextField textField = (JTextField) c; | ||
c.setBackground(UIManager.getColor("TextFieldPlaceholder.background")); | ||
c.setForeground(UIManager.getColor("TextFieldPlaceholder.foreground")); | ||
textField.setCaretColor(UIManager.getColor("TextFieldPlaceholder.caret")); | ||
} | ||
|
||
@Override | ||
protected void installDefaults() { | ||
super.installDefaults(); | ||
} | ||
|
||
@Override | ||
protected void installListeners() { | ||
super.installListeners(); | ||
this.getComponent().addFocusListener(focusListener); | ||
} | ||
|
||
@Override | ||
protected void uninstallListeners() { | ||
super.uninstallListeners(); | ||
this.getComponent().removeFocusListener(focusListener); | ||
} | ||
|
||
public class LineFocusListener implements FocusListener { | ||
|
||
@Override | ||
public void focusGained(FocusEvent e) { | ||
textFieldPlaceholder.doFocus(); | ||
} | ||
|
||
@Override | ||
public void focusLost(FocusEvent e) { | ||
textFieldPlaceholder.focusLose(); | ||
} | ||
} | ||
} |
Oops, something went wrong.