I have a window created with a JMenuBar placed at the top. Until then I had 2 JMenuItems that worked as a button and opened another frame. Until then everything works correctly. Today, I have the need to put another item to that menu, and following the logic of the previous two I implemented it. After a couple of hours looking at why it can be (it will be the biggest bullshit in the world) I have not managed to find out why this third item of the menu does not come to me.
JMenuBar menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
JMenuItem mntmNewMenuItem = new JMenuItem("A\u00F1adir planificado");
mntmNewMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
AñadirView v=new AñadirView();
v.setVisible(true);
}
});
JMenuItem mntmActualizar = new JMenuItem("Actualizar");
mntmActualizar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
ArrayList<Camion>cm=(ArrayList<Camion>) camiones.getPlanif();
list.removeAll();
for(int i=0;i<cm.size();i++) {
list.add(cm.get(i).toString());
}
}
});
menuBar.add(mntmActualizar);
menuBar.add(mntmNewMenuItem);
JMenuItem mntmVerPlanifSemanal = new JMenuItem("Ver planif semanal");
menuBar.add(mntmVerPlanifSemanal);
As you can see the last item is still not implemented, it is the one that does not work. I leave a capture here of my (primitive) interface so you can see it easily.