NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Popup menu in netbeans module

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
Jirka_Kutil



Joined: 28 Oct 2009
Posts: 8

PostPosted: Wed Oct 28, 2009 2:33 pm    Post subject: Popup menu in netbeans module Reply with quote

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 Sad
Should I make some changes in layer.xml?
please, help me
thank Jirka
Back to top
Tonny Kohar
Posted via mailing list.





PostPosted: Thu Oct 29, 2009 3:58 am    Post subject: Popup menu in netbeans module Reply with quote

Hi,

On Wed, Oct 28, 2009 at 9:33 PM, Jirka_Kutil <address-removed> wrote:
Quote:
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
Back to top
Jirka_Kutil



Joined: 28 Oct 2009
Posts: 8

PostPosted: Thu Oct 29, 2009 11:09 am    Post subject: Thank Reply with quote

Hello, I tried it, but it is not working Sad Can you give me example of code?
Thank you, Jirka
Back to top
Fabrizio Giudici
Posted via mailing list.





PostPosted: Thu Oct 29, 2009 2:55 pm    Post subject: Popup menu in netbeans module Reply with quote

Jirka_Kutil wrote:
Quote:
Hello, I tried it, but it is not working Sad 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
address-removed
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo