Quantcast

Popup menu in netbeans module

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Popup menu in netbeans module

Jirka_Kutil
Hello,

Please, can someone help me with popup menu in Netbenas module? I try create it. I searched some tutorial of creating popup menu in module, but I did not search. Do you know about something, some url, etc.?

I want to create popup menu i my module for example in topComponent, but i do know how, I tried for example

public class MyPopupOnLabel extends JLabel implements Presenter.popup

a use  public JMenuItem getPopupPresenter() {

JMenu jm = new JMenu("dd");

jm.add(new JmenuItem("ss"));



return jm;

}



and this MyPopupOnLabel give to JPanel in TopComponent.



but no result :(

Should I make some changes in layer.xml?

please, help me

thank Jirka




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Popup menu in netbeans module

Tonny Kohar-2
Hi,

On Wed, Oct 28, 2009 at 9:33 PM, Jirka_Kutil <[hidden email]> wrote:

> Hello,
>
> Please, can someone help me with popup menu in Netbenas module? I try create it. I searched some tutorial of creating popup menu in module, but I did not search. Do you know about something, some url, etc.?
>
> I want to create popup menu i my module for example in topComponent, but i do know how, I tried for example
>
> public class MyPopupOnLabel extends JLabel implements Presenter.popup
>
> a use  public JMenuItem getPopupPresenter() {
>
> JMenu jm = new JMenu("dd");
>
> jm.add(new JmenuItem("ss"));
>
>
>
> return jm;
>
> }
>
>
>
> and this MyPopupOnLabel give to JPanel in TopComponent.
>
>
>
> but no result :(
>
> Should I make some changes in layer.xml?
>

Depending on the need, you can easily create Popup menu using standard
Swing JPopupMenu. Then after creating popup menu, you need to display
it (eg: On Window/Unix/Linux is usually using right click)

Cheers
Tonny Kohar
--
Sketsa SVG Editor
imagine, design, create ...
http://www.kiyut.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Popup menu in netbeans module

Jirka_Kutil
In reply to this post by Jirka_Kutil
Hello, I tried it, but it is not working :( Can you give me example of code?

Thank you, Jirka




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Popup menu in netbeans module

Fabrizio Giudici
Jirka_Kutil wrote:
> Hello, I tried it, but it is not working :( Can you give me example of code?
>  
        btOptions.addActionListener(new ActionListener()
          {
            @Override
            public void actionPerformed (final ActionEvent event)
              {
                currentOptionsMenu.show(btOptions, 0,
-currentOptionsMenu.getHeight());
              }
          });

currentOptionsMenu is a JPopupMenu. It can be much improved (e.g. when
the menu is popped at menu corners), but the core is that.

--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/people
[hidden email]

Loading...