mirror of https://github.com/sipwise/jitsi.git
parent
7fe77dfa12
commit
ddf67e80dd
@ -1,6 +1,58 @@
|
||||
package net.java.sip.communicator.impl.gui.lookandfeel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
|
||||
import javax.swing.border.AbstractBorder;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.BorderUIResource;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicBorders;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
|
||||
public class SIPCommBorders {
|
||||
|
||||
private static Border textFieldBorder;
|
||||
|
||||
/**
|
||||
* Returns a border instance for a JTextField.
|
||||
*/
|
||||
public static Border getTextFieldBorder() {
|
||||
if (textFieldBorder == null
|
||||
|| !(textFieldBorder instanceof SIPCommBorders.TextFieldBorder)) {
|
||||
textFieldBorder = new SIPCommBorders.TextFieldBorder();
|
||||
}
|
||||
return textFieldBorder;
|
||||
}
|
||||
|
||||
public static class TextFieldBorder extends AbstractBorder implements UIResource{
|
||||
|
||||
private static final Insets insets = new Insets(2, 2, 2, 2);
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int w, int h) {
|
||||
g.setColor(Color.GRAY);
|
||||
if (c.isEnabled()) {
|
||||
g.drawRoundRect(x, y, w, h, 5, 5);
|
||||
} else {
|
||||
g.drawRoundRect(x, y, w, h, 5, 5);
|
||||
}
|
||||
}
|
||||
|
||||
public Insets getBorderInsets(Component c) {
|
||||
return insets;
|
||||
}
|
||||
|
||||
public Insets getBorderInsets(Component c, Insets newInsets) {
|
||||
newInsets.top = insets.top;
|
||||
newInsets.left = insets.left;
|
||||
newInsets.bottom = insets.bottom;
|
||||
newInsets.right = insets.right;
|
||||
|
||||
return newInsets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.impl.gui.lookandfeel;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.metal.MetalTextFieldUI;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.utils.AntialiasingManager;
|
||||
|
||||
/**
|
||||
* SIPCommTextFieldUI implementation.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class SIPCommTextFieldUI extends MetalTextFieldUI {
|
||||
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new SIPCommTextFieldUI();
|
||||
}
|
||||
|
||||
protected void paintSafely(Graphics g) {
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
super.paintSafely(g);
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.gui.main.customcontrols;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import javax.swing.JPasswordField;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.utils.AntialiasingManager;
|
||||
import net.java.sip.communicator.impl.gui.utils.Constants;
|
||||
|
||||
public class SIPCommPasswordField extends JPasswordField {
|
||||
|
||||
public SIPCommPasswordField(){
|
||||
super();
|
||||
}
|
||||
|
||||
public SIPCommPasswordField(int columns){
|
||||
super(columns);
|
||||
}
|
||||
|
||||
protected void paintBorder(Graphics g){
|
||||
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
|
||||
g2.setColor(Constants.TOOLBAR_SEPARATOR_COLOR);
|
||||
|
||||
g2.setStroke(new BasicStroke(3.0f));
|
||||
|
||||
g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 7, 7);
|
||||
}
|
||||
|
||||
protected void paintComponent(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paintComponent(g);
|
||||
}
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.gui.main.customcontrols;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.utils.AntialiasingManager;
|
||||
import net.java.sip.communicator.impl.gui.utils.Constants;
|
||||
|
||||
public class SIPCommTextField extends JTextField {
|
||||
|
||||
public SIPCommTextField(){
|
||||
|
||||
super();
|
||||
}
|
||||
|
||||
public SIPCommTextField(int columns){
|
||||
|
||||
super(columns);
|
||||
}
|
||||
|
||||
protected void paintBorder(Graphics g){
|
||||
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
|
||||
g2.setColor(Constants.TOOLBAR_SEPARATOR_COLOR);
|
||||
|
||||
g2.setStroke(new BasicStroke(3.0f));
|
||||
|
||||
g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 7, 7);
|
||||
}
|
||||
|
||||
protected void paintComponent(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paintComponent(g);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue