|
|
@ -1,8 +1,13 @@ |
|
|
|
package com.fr.design.gui.ipasswordfield; |
|
|
|
package com.fr.design.gui.ipasswordfield; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.text.Document; |
|
|
|
import javax.swing.text.Document; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Created with IntelliJ IDEA. |
|
|
|
* Created with IntelliJ IDEA. |
|
|
@ -12,24 +17,56 @@ import javax.swing.text.Document; |
|
|
|
* To change this template use File | Settings | File Templates. |
|
|
|
* To change this template use File | Settings | File Templates. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class UIPassWordField extends JPasswordField { |
|
|
|
public class UIPassWordField extends JPasswordField { |
|
|
|
|
|
|
|
private boolean isRollOver; |
|
|
|
|
|
|
|
|
|
|
|
public UIPassWordField() { |
|
|
|
public UIPassWordField() { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
|
|
|
|
addRollOverListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UIPassWordField(String text) { |
|
|
|
public UIPassWordField(String text) { |
|
|
|
super(text); |
|
|
|
super(text); |
|
|
|
|
|
|
|
addRollOverListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UIPassWordField(int columns) { |
|
|
|
public UIPassWordField(int columns) { |
|
|
|
super(columns); |
|
|
|
super(columns); |
|
|
|
|
|
|
|
addRollOverListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UIPassWordField(String text, int columns) { |
|
|
|
public UIPassWordField(String text, int columns) { |
|
|
|
super(text, columns); |
|
|
|
super(text, columns); |
|
|
|
|
|
|
|
addRollOverListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UIPassWordField(Document doc, String txt, int columns) { |
|
|
|
public UIPassWordField(Document doc, String txt, int columns) { |
|
|
|
super(doc, txt, columns); |
|
|
|
super(doc, txt, columns); |
|
|
|
|
|
|
|
addRollOverListener(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void addRollOverListener() { |
|
|
|
|
|
|
|
this.addMouseListener(new MouseAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseEntered(MouseEvent e) { |
|
|
|
|
|
|
|
isRollOver = true; |
|
|
|
|
|
|
|
UIPassWordField.this.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void mouseExited(MouseEvent e) { |
|
|
|
|
|
|
|
isRollOver = false; |
|
|
|
|
|
|
|
UIPassWordField.this.repaint(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected void paintBorder(Graphics g) { |
|
|
|
|
|
|
|
if (isRollOver && this.isEnabled()) { |
|
|
|
|
|
|
|
g.setColor(UIConstants.TEXT_FILED_BORDER_SELECTED); |
|
|
|
|
|
|
|
g.drawRect(0, 0, getWidth() - 1, getHeight() - 1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
super.paintBorder(g); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |