Re: UI Komponenten mit zusätzlicher Status Infromation
- From: Frank Meyer <f.meyer@xxxxxxxxxxxx>
- Date: Thu, 30 Aug 2007 15:18:36 +0200
Wolfgang Rostek schrieb:
Ich hätte aber lieber folgendes
public class JCheckBoxInheritable extends mypackage.JCheckBox
Ginge dann z.B. so:
public interface Inheritable {
boolean isInherited();
void setInherited(boolean b);
}
public class InheritableManager {
private static WeakReferenceMap map = new WeakReferenceMap();
private InheritableManager() {
}
public static void register(Inheritable i) {
map.put(i, new InheritableConstraints());
}
public static void unregister(Inheritable i) {
map.remove(i);
}
private InheritableConstraints getConstraints(Inheritable i) {
return (InheritableConstraints)map.get(i);
}
public boolean isInherited(Inheritable i) {
InheritableConstraints c = getConstraints(i);
return c.inherited;
}
public void setInherited(Inheritable i, boolean b) {
InheritableConstraints c = getConstraints(i);
c.inherited = b;
if (c instanceof JComponent) {
JComponent j = (JComponent)c;
j.setBorder(b ? ... : ...);
}
}
private static class InheritableConstraints {
...
}
}
public class JCheckBoxInheritable extends mypackage.JCheckBox implements Inheritable {
public JCheckBoxInheritable() {
InheritableManager.register(this);
}
public boolean isInherited() {
return InheritableManager.isInherited(this);
}
public void setInherited(boolean b) {
InheritableManager.setInherited(this, b);
... (PropertyChangeEvent etc.)
}
}
.
- Follow-Ups:
- Re: UI Komponenten mit zusätzlicher Status Infromation
- From: Wolfgang Rostek
- Re: UI Komponenten mit zusätzlicher Status Infromation
- References:
- UI Komponenten mit zusätzlicher Status Infromation
- From: Wolfgang Rostek
- Re: UI Komponenten mit zusätzlicher Status Infromation
- From: Frank Meyer
- Re: UI Komponenten mit zusätzlicher Status Infromation
- From: Wolfgang Rostek
- UI Komponenten mit zusätzlicher Status Infromation
- Prev by Date: Re: UTF-8 Erkennung
- Next by Date: Re: Java vs. Pascal
- Previous by thread: Re: UI Komponenten mit zusätzlicher Status Infromation
- Next by thread: Re: UI Komponenten mit zusätzlicher Status Infromation
- Index(es):