1 package com.explosion.utilities.preferences.editandrender.table;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import java.awt.Component;
24
25 import javax.swing.JLabel;
26 import javax.swing.JTable;
27 import javax.swing.border.Border;
28 import javax.swing.table.TableCellRenderer;
29
30 import com.explosion.utilities.preferences.Preference;
31
32 public class PasswordPreferenceRenderer extends JLabel implements TableCellRenderer
33 {
34
35 Border unselectedBorder = null;
36
37 Border selectedBorder = null;
38
39 boolean isBordered = true;
40
41 public PasswordPreferenceRenderer()
42 {
43 super();
44 }
45
46 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
47 {
48 Object renderableValue = null;
49
50
51 if ( value instanceof Preference)
52 {
53 Preference pref = (Preference) value;
54 renderableValue = pref.getValue();
55 }
56 else
57 {
58 renderableValue = value;
59 }
60
61 if (renderableValue == null)
62 setText("");
63 else
64 {
65 setText(renderableValue.toString().replaceAll(".", "*"));
66 }
67
68 return this;
69 }
70 }