-1

I am making a window which contains, 1 JFrame and inside the JFrame contains a JMenuBar -> 3 JMenu -> Several JMenuItem in each JMenu ... inside the JFrame I also have several buttons and a JLabel.

Well the problem that happens to me is that I put the JMenu on the moment to go clicking.

This would be the code I have in JMenu (in the other Jmenu only varies only the pdf that opens)

    try {
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:/Users/Abad Hermida/Documents/NetBeansProjects/MRP/Manual/Manual.pdf");
} catch (IOException e) {
    JOptionPane.showMessageDialog(rootPane, "Error al Abrir el Archivo", "ERROR", JOptionPane.ERROR_MESSAGE);
}

The code works ... this code I have in the buttons (in the other buttons only varies only what opens)

open.setVisible(true);
open.setTitle("Administrator");
this.setVisible(false);

This is the class of SOURCE

public Users() {
initComponents();
setTitle("Users");
setIconImage(new        ImageIcon(getClass().getResource("../icons/32x32/users.png")).getImage());
}

Images for greater understanding

On the left side you see how the window should be seen, and to the right side as seen after navigating the JMenu and in the second image just highlight the COMPONENT NAVIGATOR OF THE WINDOW IN QUESTION.

In this image of the left side it is shown as it should be seen, and the right side as it is decomposed:

https://i.stack.imgur.com/1izem.png

In the second image just highlight the NAVIGATOR OF COMPONENTS OF THE WINDOW IN QUESTION:

https://i.stack.imgur.com/g7bEr.jpg

camickr
  • 321,443
  • 19
  • 166
  • 288
Jorge1023
  • 21
  • 4
  • Best to try to isolate the problem by creating a minimal example program that reproduces it, a [mcve], a program small enough to post here with your question as code-formatted text, yet complete enough to be compilable, runnable, and again, able to reproduce the problem. – Hovercraft Full Of Eels Mar 18 '17 at 12:13
  • instead of using a jMenubar your menu can be in a panel fixed to the top of the jframe there should be no problem – Thecarisma Mar 18 '17 at 20:19

1 Answers1

0

This would be the code I have in JMenu (in the other Jmenu only varies only the pdf that opens)

If you are trying to display a PDF file then you should be using the Desktop class. This is a platform independent solution.

Read the section from the Swing tutorial on How to Integrating With the Desktop Class for more information and working examples.

camickr
  • 321,443
  • 19
  • 166
  • 288