|
|
@ -1,20 +1,14 @@ |
|
|
|
package com.fr.design.gui.itextarea; |
|
|
|
package com.fr.design.gui.itextarea; |
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
|
|
|
import java.awt.Shape; |
|
|
|
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
import java.awt.geom.RoundRectangle2D; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
|
|
|
import javax.swing.plaf.basic.BasicTextAreaUI; |
|
|
|
|
|
|
|
import javax.swing.text.JTextComponent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
import javax.swing.plaf.basic.BasicTextAreaUI; |
|
|
|
|
|
|
|
import java.awt.*; |
|
|
|
|
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
|
|
|
|
|
|
|
public class UITextAreaUI extends BasicTextAreaUI { |
|
|
|
public class UITextAreaUI extends BasicTextAreaUI { |
|
|
|
protected boolean isRollOver; |
|
|
|
protected boolean isRollOver; |
|
|
|
private JComponent textField; |
|
|
|
private JComponent textField; |
|
|
@ -37,19 +31,12 @@ public class UITextAreaUI extends BasicTextAreaUI { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void paintBorder(Graphics2D g2d, int width, int height, boolean isRound, int rectDirection) { |
|
|
|
protected void paintBackground(Graphics g) { |
|
|
|
if (isRollOver && textField.isEnabled()) { |
|
|
|
JTextComponent editor = getComponent(); |
|
|
|
g2d.setColor(UIConstants.TEXT_FILED_BORDER_SELECTED); |
|
|
|
int width = editor.getWidth(); |
|
|
|
g2d.drawRect(0, 0, width - 1, height - 1); |
|
|
|
int height = editor.getHeight(); |
|
|
|
|
|
|
|
Graphics2D g2d = (Graphics2D)g; |
|
|
|
|
|
|
|
g2d.clearRect(0, 0, width, height); |
|
|
|
|
|
|
|
if(isRollOver && textField.isEnabled() && ((UITextArea)textField).isEditable()) { |
|
|
|
|
|
|
|
Shape shape = new RoundRectangle2D.Double(1, 1, width - 3, height - 3, UIConstants.ARC, UIConstants.ARC); |
|
|
|
|
|
|
|
GUIPaintUtils.paintBorderShadow(g2d, 3, shape, UIConstants.HOVER_BLUE, Color.WHITE); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
g2d.setColor(UIConstants.LINE_COLOR); |
|
|
|
GUIPaintUtils.drawBorder(g2d, 0, 0, width, height, isRound, rectDirection); |
|
|
|
g2d.drawRoundRect(1, 1, width - 2, height - 2, UIConstants.ARC, UIConstants.ARC); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|