publicclass LabelDotTest
{ privatefinalstatic String longText = "show a very long text to have it " + "automatically shortened"; privatefinalstatic String shortText = "show short text";
label = new JLabel(shortText);
frame.add(label, c);
frame.setVisible(true);
}
privatestaticvoid runTest(int iterations) throws Exception{
Robot robot = new Robot();
IntStream.range(0, iterations).forEach((i) -> {
SwingUtilities.invokeLater(() -> { if (label.getText().equals(shortText)) {
label.setText(longText);
} else {
label.setText(shortText);
} /* For a top level menu item, minimum size and the preferredsizeshouldbethesame,andshouldnotbe equalto1.Savetheexceptionstateandthrowlater oncetheiterationsarecompleted.
*/
isException = (menu.getMinimumSize().height == 1 &&
!menu.getMinimumSize().equals(menu.getPreferredSize())) ||
isException;
});
robot.waitForIdle();
});
}
publicstaticvoid main(String[] args) throws Exception { try {
SwingUtilities.invokeAndWait(() -> createUI());
runTest(50);
} finally { if (frame != null) {
SwingUtilities.invokeAndWait(() -> frame.dispose());
} if (isException) thrownew RuntimeException("Size of Menu bar is not correct.");
}
}
}
Messung V0.5 in Prozent
¤ 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.0.14Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
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.