blob: a06d66affb4f7f907fd17f6ddd1203e1f4ab783e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
* Jitsi, 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;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.plugin.desktoputil.plaf.*;
import net.java.sip.communicator.util.skin.*;
/**
* The <tt>SearchTextFieldUI</tt> is the one responsible for the search field
* look & feel. It draws a search icon inside the field and adjusts the bounds
* of the editor rectangle according to it.
*
* @author Yana Stamcheva
* @author Adam Netocny
*/
public class DialPadFieldUI
extends SIPCommTextFieldUI
implements Skinnable
{
/**
* Creates a <tt>SIPCommTextFieldUI</tt>.
*/
public DialPadFieldUI()
{
loadSkin();
}
/**
* Adds the custom mouse listeners defined in this class to the installed
* listeners.
*/
@Override
protected void installListeners()
{
super.installListeners();
}
/**
* Implements parent paintSafely method and enables antialiasing.
* @param g the <tt>Graphics</tt> object that notified us
*/
@Override
protected void paintSafely(Graphics g)
{
customPaintBackground(g);
super.paintSafely(g);
}
/**
* Paints the background of the associated component.
* @param g the <tt>Graphics</tt> object used for painting
*/
@Override
protected void customPaintBackground(Graphics g)
{
Graphics2D g2 = (Graphics2D) g.create();
try
{
AntialiasingManager.activateAntialiasing(g2);
super.customPaintBackground(g2);
}
finally
{
g2.dispose();
}
}
/**
* If we are in the case of disabled delete button, we simply call the
* parent implementation of this method, otherwise we recalculate the editor
* rectangle in order to leave place for the delete button.
* @return the visible editor rectangle
*/
@Override
protected Rectangle getVisibleEditorRect()
{
Rectangle rect = super.getVisibleEditorRect();
if ((rect.width > 0) && (rect.height > 0))
{
rect.x += 8;
rect.width -= 18;
return rect;
}
return null;
}
/**
* Creates a UI.
*
* @param c the text field
* @return the UI
*/
public static ComponentUI createUI(JComponent c)
{
return new DialPadFieldUI();
}
}
|