privatestaticvoid validate(JPanel panel) {
BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) {
String name = (String) layout.getConstraints(component); if (name == null) thrownew Error("The component is not layed out: " + component);
JLabel label = (JLabel) component; if (!name.equals(label.getText())) thrownew Error("The component is layed out on " + name + ": " + component);
}
}
publicstaticfinalclass MyPanel extends JPanel { public MyPanel() { // the bug is reproducible for containers // that uses BorderLayout as default layout manager. super(new BorderLayout(3, 3));
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.