Hallo an Alle,
ich habe zz. das Problem das ein JMenuItem (mit Icon) die Komplette JMenuBar blockiert.
Bild: im Anhang
Mein Code:
Wie bekomm ich es hin das das Item nicht die ganze MenuBar blockiert?
ich habe zz. das Problem das ein JMenuItem (mit Icon) die Komplette JMenuBar blockiert.
Bild: im Anhang
Mein Code:
Java:
JMenuBar mb = new JMenuBar();
JMenu license = new JMenu("Lizenz");
JMenuItem licenseItm = new JMenuItem();
if (activated) {
frame.setTitle("MySQL trial");
licenseItm.setText("Buy now");
licenseItm.setEnabled(true);
licenseItm.addActionListener(new LicenseItmAction());
license.add(licenseItm);
license.addSeparator();
} else {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
frame.setTitle("MySQL pro");
licenseItm.setEnabled(false);
}
JMenuItem infoItm = new JMenuItem("Infos");
infoItm.addActionListener(new InfoItmAction());
license.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
license.add(infoItm);
mb.add(Box.createHorizontalGlue());
mb.add(license);
JMenuItem exit = new JMenuItem();
exit.setIcon(new ImageIcon(Main.class.getResource("assets//img//exit.png")));
exit.addActionListener(new ExitAction());
exit.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
mb.add(exit);
Wie bekomm ich es hin das das Item nicht die ganze MenuBar blockiert?