Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
90 lines (74 loc) · 1.88 KB

File metadata and controls

90 lines (74 loc) · 1.88 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package PamView;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.Icon;
import PamView.dialog.IconPanel;
public class BasicKeyItem implements PamKeyItem {
ArrayList<Icon> icons;
ArrayList<String> texts;
ArrayList<Component> components;
public BasicKeyItem() {
}
public BasicKeyItem(Icon icon, String text) {
addIcon(icon, text);
}
public void addIcon(Icon icon, String text) {
if (!setupArrays(true)) return;
icons.add(icon);
texts.add(text);
}
public BasicKeyItem(Component component, String text) {
addIcon(component, text);
}
public void addIcon(Component component, String text) {
if (!setupArrays(false)) return;
components.add(component);
texts.add(text);
}
private boolean setupArrays(boolean isIcons) {
if (texts == null) {
// nothing set up yet, so just get on with it.
texts = new ArrayList<String>();
if (isIcons) {
icons = new ArrayList<Icon>();
}
else {
components = new ArrayList<Component>();
}
return true;
}
else if (icons == null && isIcons) {
System.out.println("You cannot add icons to a BasicKeyITem configured for awt.Components");
return false;
}
else if (components == null && !isIcons) {
System.out.println("You cannot add components to a BasicKeyItem configured for Icons");
return false;
}
return true;
}
@Override
public Component getIcon(int keyType, int nComponent) {
if (texts == null) return null;
if (nComponent >= 0 && nComponent < texts.size()) {
if (icons != null) {
return new IconPanel(icons.get(nComponent));
}
else {
return components.get(nComponent);
}
}
return null;
}
@Override
public int getNumItems(int keyType) {
return texts.size();
}
@Override
public String getText(int keyType, int nComponent) {
if (nComponent >= 0 && nComponent < texts.size()) {
return texts.get(nComponent);
}
return null;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.