Cointainer-Rendering Problem, but with the addition...
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
I solved the problem, but instead the easier way in combination with
"insert()", I've used "find()".
Depending on my selectedItem from the Combobox, I call up the function as
following:
.
.
.
.
String xml_file = null;
String command = new String();
command =((JComboBox) e.getSource()).getSelectedItem().toString();
if (command.equals("Schule"))
{
xml_file = "schule.xml";
// System.out.println(xml_file);
showLabel(xml_file, Color.BLUE);
}
.
.
.
[snip]
public void showLabel(String _lab, Color _color)
{
String lab = _lab;
Color color = _color;
try{
swix = new SwingEngine(this);
swix.render( "xml/"+ lab ).setVisible(false);
//Anzahl der Labels
//System.out.println(swix.getIdMap().size()-1);
//Container ungueltig setzen
center_panel.invalidate();
//Entfernen aller Componenten
center_panel.removeAll();
//Hinzufuegen der neuen Componenten zum center_panel
for(int i=1; i<=swix.getIdMap().size()-1; i++)
{
center_panel.add(swix.find("lab"+i));
swix.find("lab"+i).addMouseListener(mausi);
}
center_panel.setBackground(color);
//Container gueltig setzen
center_panel.validate();
//Componenten neu zeichnen
center_panel.repaint();
}
catch(Exception y)
{
System.out.println("Fehler" +y.getMessage());
}
}