How to create the flamingo ribbon menu?
I'm using flamingo ribbon, but when i tried to put the menu, it didn't appear.
I used this code:
RibbonApplicationMenuEntryPrimary menu1 = new RibbonApplicationMenuEntryPrimary(getResizableIconFromResource("/prog/Imagenes/Algo.png"), "Prueba 1", new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Menu secundario");
}
}, JCommandButton.CommandButtonKind.POPUP_ONLY);
menu1.setActionKeyTip("P");
menu1.setPopupKeyTip("W");
RibbonApplicationMenuEntrySecondary menu2 = new RibbonApplicationMenuEntrySecondary(getResizableIconFromResource("/prog/imagenes/rs1.png"), "Prueba 2",null, JCommandButton.CommandButtonKind.POPUP_ONLY);
menu2.setDescriptionText("seleccione algo");
menu2.set开发者_如何转开发ActionKeyTip("P");
RibbonApplicationMenuEntrySecondary menu3 = new RibbonApplicationMenuEntrySecondary(getResizableIconFromResource("/prog/imagenes/dp1.png"), "Prueba 3",null, JCommandButton.CommandButtonKind.ACTION_ONLY);
menu3.setDescriptionText("algo");
menu3.setActionKeyTip("Q");
RibbonApplicationMenu menuPrinicpal = new RibbonApplicationMenu();
RibbonApplicationMenuEntryPrimary salir = new RibbonApplicationMenuEntryPrimary(null, "Salir", new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
}, CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
salir.setActionKeyTip("S");
salir.setPopupKeyTip("X");
menuPrinicpal.addMenuEntry(salir);
cintaOmicronJRibbon.updateUI();
menu1.addSecondaryMenuGroup("Compuesto", menu2,menu3);
menuPrinicpal.addMenuEntry(menu1);
menuPrinicpal.addMenuSeparator();
cintaOmicronJRibbon.setApplicationMenu(menuPrinicpal);
cintaOmicronJRibbon.updateUI();
Please help me thanks.
Finally I found the solution, the code showed is wrong, I added a Jribbon as a property in my JRibbonFrame, but by default when a class inherits from a JRibbonFrame conatains the JRibbon element.
The code needs this.getRibbon() instead of cintaOmicronJRibbon.
精彩评论