}
public int getWidth() {
// get the width of our parent JFrame.
Container parent = getParent();
if (parent == null) { throw new IllegalComponentStateException(
"can't get menubar size before "
+ "it has been added to a frame"); }
int parentwidth = parent.getWidth() - 2;
int minwidth = minimumSize().width;