import javax.swing.*;
import java.awt.event.*;
public class PopUpMenu{
JPopupMenu Pmenu;
JMenuItem menuItem;
public static void main(String[] args) {
PopUpMenu p = new PopUpMenu();
}
public PopUpMenu(){
JFrame frame = new JFrame("Creating a Popup Menu");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Pmenu = new JPopupMenu();
menuItem = new JMenuItem("Cut");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Copy");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Paste");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Delete");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Undo");
Pmenu.add(menuItem);
menuItem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){}
});
frame.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me){
if(me.isPopupTrigger()){
Pmenu.show(me.getComponent(), me.getX(), me.getY());
}
}
public void mouseReleased(MouseEvent Me){
if(Me.isPopupTrigger()){
Pmenu.show(Me.getComponent(), Me.getX(), Me.getY());
}
}
});
frame.setSize(400,400);
frame.setVisible(true);
}
}
import java.awt.event.*;
public class PopUpMenu{
JPopupMenu Pmenu;
JMenuItem menuItem;
public static void main(String[] args) {
PopUpMenu p = new PopUpMenu();
}
public PopUpMenu(){
JFrame frame = new JFrame("Creating a Popup Menu");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Pmenu = new JPopupMenu();
menuItem = new JMenuItem("Cut");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Copy");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Paste");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Delete");
Pmenu.add(menuItem);
menuItem = new JMenuItem("Undo");
Pmenu.add(menuItem);
menuItem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){}
});
frame.addMouseListener(new MouseAdapter(){
public void mousePressed(MouseEvent me){
if(me.isPopupTrigger()){
Pmenu.show(me.getComponent(), me.getX(), me.getY());
}
}
public void mouseReleased(MouseEvent Me){
if(Me.isPopupTrigger()){
Pmenu.show(Me.getComponent(), Me.getX(), Me.getY());
}
}
});
frame.setSize(400,400);
frame.setVisible(true);
}
}
wonderful submit, very informative. I ponder why the opposite specialists
ReplyDeleteof this sector do not notice this. You must proceed your writing.
I'm confident, you've a huge readers' base already!
Here is my web page ... hardwood floor
If you would like to obtain much from this piece of
ReplyDeletewriting then you have to apply these methods to your won website.
installing hardwood floors
Here is my web-site; cleaning hardwood floors
Appreciating the persistence you put into your blog and in depth information you provide.
ReplyDeleteIt's good to come across a blog every once in a while that isn't the same old
rehashed material. Fantastic read! I've saved your site and I'm adding
your RSS feeds to my Google account.
my site: wood floors
It's an awesome post for all the web people; they will take benefit from it I am sure.
ReplyDeleteHere is my website hardwood floors
I've been surfing online greater than 3 hours lately, but I by no means found any interesting article like yours. It's beautiful price enough for me.
ReplyDeleteIn my view, if all webmasters and bloggers made just right content as you probably did,
the internet might be a lot more helpful than ever before.
my web page; cleaning melbourne
Wow, this post is fastidious, my sister is analyzing these things, so I
ReplyDeleteam going to convey her.
my blog post; provillusreviews-hq.blogspot.com
It's wonderful that you are getting thoughts from this article as well as from our argument made at this time.
ReplyDeleteMy blog ... veterinarycontinuingeducation.com
my web site - provillus information