forked from External/mage
added transfer data object to mouseExited. added desktoppane to ui components references.
This commit is contained in:
parent
65e5c59004
commit
0721c843d2
7 changed files with 41 additions and 4 deletions
|
|
@ -35,6 +35,27 @@ public class MageUI {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public Component getComponent(MageComponents name) throws InterruptedException {
|
||||
Object componentSync;
|
||||
synchronized (ui) {
|
||||
if (ui.containsKey(name)) {
|
||||
return ui.get(name);
|
||||
} else {
|
||||
componentSync = new Object();
|
||||
sync.put(name, componentSync);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (componentSync) {
|
||||
componentSync.wait();
|
||||
if (!ui.containsKey(name)) {
|
||||
throw new IllegalStateException("Component wasn't initialized. This should not happen.");
|
||||
}
|
||||
return ui.get(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addButton(MageComponents name, JButton button) {
|
||||
synchronized (ui) {
|
||||
|
|
@ -49,6 +70,17 @@ public class MageUI {
|
|||
}
|
||||
}
|
||||
|
||||
public void addComponent(MageComponents name, Component component) {
|
||||
synchronized (ui) {
|
||||
ui.put(name, component);
|
||||
if (sync.containsKey(name)) {
|
||||
synchronized (sync.get(name)) {
|
||||
sync.get(name).notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doClick(MageComponents name) throws InterruptedException {
|
||||
doClick(name, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue