mirror of https://github.com/sipwise/jitsi.git
parent
d13102fbea
commit
ddfe0404ed
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.AbstractBorder;
|
||||
import javax.swing.plaf.basic.BasicComboBoxEditor;
|
||||
import javax.swing.plaf.metal.MetalComboBoxEditor;
|
||||
import javax.swing.plaf.metal.MetalLookAndFeel;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.utils.AntialiasingManager;
|
||||
|
||||
/**
|
||||
* The default editor for SIPCommunicator editable combo boxes.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class SIPCommComboBoxEditor extends MetalComboBoxEditor {
|
||||
|
||||
public SIPCommComboBoxEditor() {
|
||||
super();
|
||||
|
||||
editor.setBorder(new EditorBorder());
|
||||
}
|
||||
|
||||
protected static Insets editorBorderInsets = new Insets(2, 2, 2, 0);
|
||||
private static final Insets SAFE_EDITOR_BORDER_INSETS = new Insets(2, 2, 2, 0);
|
||||
|
||||
class EditorBorder extends AbstractBorder {
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g2d);
|
||||
|
||||
g2d.translate(x, y);
|
||||
|
||||
g2d.setColor(SIPCommLookAndFeel.getControlDarkShadow());
|
||||
|
||||
GeneralPath path = new GeneralPath();
|
||||
int round = 2;
|
||||
|
||||
path.moveTo(w, h-1);
|
||||
path.lineTo(round, h-1);
|
||||
path.curveTo(round, h-1, 0, h-1, 0, h-round-1);
|
||||
path.lineTo(0, round);
|
||||
path.curveTo(0, round, 0, 0, round, 0);
|
||||
path.lineTo(w, 0);
|
||||
|
||||
g2d.draw(path);
|
||||
|
||||
g2d.translate(-x, -y);
|
||||
}
|
||||
|
||||
public Insets getBorderInsets( Component c ) {
|
||||
if (System.getSecurityManager() != null) {
|
||||
return SAFE_EDITOR_BORDER_INSETS;
|
||||
} else {
|
||||
return editorBorderInsets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A subclass of SIPCommComboBoxEditor that implements UIResource.
|
||||
* SIPCommComboBoxEditor doesn't implement UIResource
|
||||
* directly so that applications can safely override the
|
||||
* cellRenderer property with BasicListCellRenderer subclasses.
|
||||
*/
|
||||
public static class UIResource extends SIPCommComboBoxEditor
|
||||
implements javax.swing.plaf.UIResource {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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 javax.swing.JComponent;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicPasswordFieldUI;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.utils.AntialiasingManager;
|
||||
/**
|
||||
* The SIPCommPasswordFieldUI implementation.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class SIPCommPasswordFieldUI extends BasicPasswordFieldUI {
|
||||
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new SIPCommPasswordFieldUI();
|
||||
}
|
||||
|
||||
protected void paintSafely(Graphics g) {
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
super.paintSafely(g);
|
||||
}
|
||||
|
||||
protected void paintBackground(Graphics g) {
|
||||
JTextComponent c = this.getComponent();
|
||||
g.setColor(c.getBackground());
|
||||
g.fillRoundRect(1, 1, c.getWidth()-2, c.getHeight()-2, 5, 5);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue