forked from winder/Universal-G-Code-Sender
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add placeholder to better indicate that you can type commands in the command box * Added error message when the GLPanel couldn't be loaded and added possibility to open log directory * Fixed problem when user chooses a new file that exists and decides not to overwrite the file. * Displays a warning message when the user must save gcode file befor it can be sent. * Added more descriptive tooltips * Updated library versions * Added action for creating shortcuts * Added windows icons * Fixed icon for MacOSX and in the settings panel * Delete key can now remove objects in the designer
- Loading branch information
Showing
40 changed files
with
755 additions
and
86 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
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
41 changes: 41 additions & 0 deletions
41
...lwinder/universalgcodesender/uielements/components/TextFieldPlaceholderFocusListener.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,41 @@ | ||
package com.willwinder.universalgcodesender.uielements.components; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.event.FocusEvent; | ||
import java.awt.event.FocusListener; | ||
|
||
/** | ||
* Register this as a listener to a text field and it will show a placeholder | ||
*/ | ||
public class TextFieldPlaceholderFocusListener implements FocusListener { | ||
|
||
private final JTextField textField; | ||
private final Color textColor; | ||
private final Color placeholderColor; | ||
private final String placeholderText; | ||
|
||
public TextFieldPlaceholderFocusListener(JTextField textArea, String placeholderText) { | ||
this.textField = textArea; | ||
textColor = textArea.getForeground(); | ||
placeholderColor = textArea.getDisabledTextColor(); | ||
this.placeholderText = placeholderText; | ||
focusLost(null); | ||
} | ||
|
||
@Override | ||
public void focusGained(FocusEvent e) { | ||
if (textField.getText().equals(placeholderText)) { | ||
textField.setText(""); | ||
textField.setForeground(textColor); | ||
} | ||
} | ||
|
||
@Override | ||
public void focusLost(FocusEvent e) { | ||
if (textField.getText().isEmpty()) { | ||
textField.setForeground(placeholderColor); | ||
textField.setText(placeholderText); | ||
} | ||
} | ||
} |
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
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
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
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
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
Binary file not shown.
Oops, something went wrong.