Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Popup menu problem

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    1
    My Mood
    Mad
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Popup menu problem

    I am creating this Word Processor...for my college project...an i hav this bugging problem,
    i have this text area which has a popup menu,this popup menu has a listener(below)..now comming to
    the point when i right click the TextArea a gray colored popup come up(all the menu items hidden with gray color)
    only when mouse over the popup menu....all the menu itms becomes visible....what is the problem...




    class PopupListener extends MouseAdapter {
    JPopupMenu popup;
    PopupListener(JPopupMenu popupMenu) {
    popup = popupMenu;
    }

    public void mousePressed(MouseEvent e) {
    maybeShowPopup(e);
    }

    public void mouseReleased(MouseEvent e) {
    maybeShowPopup(e);
    }

    public void maybeShowPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
    popup.show(e.getComponent(),e.getX(), e.getY());
    }
    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,574
    Thanks
    49
    Thanked 2,233 Times in 2,205 Posts

    Default Re: Popup menu problem

    Can you make a small complete program that compiles, executes and shows the problem?

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Menu Problem
    By StuckInJava in forum Loops & Control Statements
    Replies: 4
    Last Post: March 23rd, 2012, 06:43 PM
  2. Replies: 1
    Last Post: March 18th, 2012, 12:16 PM
  3. problem with help menu.
    By Toggo in forum What's Wrong With My Code?
    Replies: 11
    Last Post: December 12th, 2010, 04:13 PM
  4. popup menu
    By antonio69 in forum AWT / Java Swing
    Replies: 1
    Last Post: May 20th, 2010, 04:24 AM
  5. Replies: 1
    Last Post: October 23rd, 2009, 03:17 PM

Tags for this Thread