Java menu problem

Hi,
I have a java menu that pops up to the side on mouse over, however when the browser window is fully expanded on screen the submenu positions its self over the top of the main menu, not on the side.
How can this be corrected?
Image example: http://i67.photobucket.com/albums/h283/jborrach/menu.jpg

I did solved the problem with help of my colleague....
Thanks to who all replied to this thread .It took some delay to post my solution.May be some other developer can find this thread helpful in future i hope...
Here is the solution code....
package jlistproject;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main {
    private static JPopupMenu popUp;
    public static void main(String[] args)
       JFrame frame = new JFrame("This is the Frame Window");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.setLayout(new GridLayout());
       frame.setSize(500,500);
       String subject[] = {"Item1", "Item2", "Item3", "Item4","Item5","Item6"};
       final JList list = new JList(subject);
       popUp = new JPopupMenu();
       popUp.add("click 1");
       popUp.add("click 2");
       popUp.add("click 3");
       list.addMouseListener(new MouseAdapter() {
                   public void mouseClicked(MouseEvent e)
              if (e.getButton() == e.BUTTON3)
                 JList  c =  (JList) e.getComponent();
                 int x = e.getX();
                 int y = e.getY();
                if(!list.isSelectionEmpty()&& list.locationToIndex(e.getPoint()) == list.getSelectedIndex())
                     int count = c.getModel().getSize();
                     int cal = count * 18;
                     if(y <= cal)
                         popUp.show(list, x, y);                        
       frame.add(new JScrollPane(list));
       frame.setVisible(true);
}Regards.
IdealKoder

Similar Messages

  • Java Menu Troubles...

    Hello,
    When I click the main menu graphics on the web site I've been working on, the reloading of the java menu is causing a very noticeable flash to occur between pages.
    The web site is hosted at:
    http://liverdance.sheepless.net/work/index.shtml
    Any suggestions are how to eliminate the flash between pages???
    Is there a way to modify the java script so as to eliminate this problem while still prompting the new page (corresponding to the main menu graphic) to load?
    SIL

    Hi,
    try to use doble-buffering: create an offline-image in memory, call getGraphics on this image, make your output operations on this graphic context and draw the offline image to the graphic context received as parameter of the paint-method.
    void paint(Graphics g){
       Image bufferImage = createImage(width, height);
       Graphics buffer = bufferImage.getGraphics();
       //perform your drawing operations here
       g.drawImage(bufferImage, 0, 0, null);
    }Regards,
    Dimitri

  • How do I display or hide a Java menu based on current url in a php page

    How do I display or hide a Javascript menu based on the current url in a php page?
    I want to specify when a java menu appears on a page based on the current url - does anyone have a script for the vars and conditional statements to make this happen - it would be something like this in natural language:
    <javascript>
    if currenturl = http://jemmakidd.com/categories.php
    then displaymenu
    else if currenturl = http://jemmakidd.com/categories.php?cat=14 (or 15,16 etc)
    then DONOTdisplaymenu
    What is needed is that, if you look at this page there is a java menu under the first category:
    http://jemmakidd.com/categories.php
    I WANT the menu to appear on that page so that is working, however if I look at one of the store categories, like on this page, I do NOT want the menu to appear - it may be that this can be done without using a java current url type function - thats why I'm asking...
    http://jemmakidd.com/categories.php?cat=14
    So to summarise:
    http://jemmakidd.com/categories.php (If this url is used DO display menu - if any other url DONT display menu)
    Thanks again...any ideas?
    Edited by: littlealex2009 on Jul 15, 2009 12:51 AM

    This is a Java forum, not a Javascript forum. Google the differences.
    kind regards,
    Jos

  • Menu problem with IE

    menu problems with IE connected with spry - see site:
    1.
    http://www.whatwomenwant-tv.com/index.html
    (horizontal menu bar - will not display fully, probably to do with
    flash)
    2.
    http://www.whatwomenwant-tv.com/about.html
    (horizontal menu bar swerves to the left)
    3.
    http://www.whatwomenwant-tv.com/streetinterviewswomen.html
    (vertical menu bars in questions are all over the page)
    thanks 4 help.

    I tried in Firefox 3 and IE7 and they both seemed fairly slow
    for any action to take place. But IE7 did seem pretty slugish.
    It seems that you're already determined what the issue is,
    you have waaaaaay too many menu items. Seems to me that that number
    of items don't belong in a menu. There are even menus that are too
    long to appear entirely on the page, so they can't be easily
    accessed without accidentally hiding the menus again, which I did
    several times. IN particular:
    Cartuchos > Technologica
    If you cannot change to a different format to show all of the
    items, then perhaps you can split up the menu so that you don't
    have too many at one time. I checked the code of your page and it
    seems that you've got a lot of other scripting going on there
    besides Spry, so is the issue with Spry or with everything else
    you're trying to do with that menu. If you can try to recreate the
    page with only the menu items on it (and not pulled in dynamically
    on the fly), and then add back to your page a bit a time, you might
    be able to find out what is really causing the delays.

  • Context menu problem in ADF 11g

    Hi All,
    A context menu problem puzzle me. Following is the source,
    =======================================
    <af:tree id="tree" value="#{treeTest.collectionModel}" var="node"
    contentDelivery="immediate"
    disclosedRowKeys="#{treeTest.treeDisclosedRowKeys}"
    rowDisclosureListener="#{treeTest.rowDisclosureListener}"
    rowSelection="single">
    <f:facet name="nodeStamp">
    <af:group id="g1">
    <af:image source="/image/#{node.treeLevel}.jpg" id="i1"
    inlineStyle="width:16px; height:16px; vertical-align:middle;"/>
    <af:outputText id="ddl" value="#{node.name}">
    <af:showPopupBehavior popupId="myPopup" triggerType="contextMenu"/>
    </af:outputText>
    </af:group>
    </f:facet>
    <f:facet name="contextMenu">
    <af:popup id="myPopup" popupFetchListener="#{treeTest.popupListener}"
    contentDelivery="lazyUncached">
    <af:switcher id="s1" facetName="#{treeTest.level}">
    <f:facet name="1">
    <af:menu text="menu 1" id="m1">
    <af:forEach items="#{treeTest.menuItems['0']}" var="menuItemss">
    <af:commandMenuItem text="#{menuItemss.name}"
    actionListener="#{bindings.onNodeClicked.execute}"
    disabled="#{!bindings.onNodeClicked.enabled}">
    </af:commandMenuItem>
    </af:forEach>
    </af:menu>
    </f:facet>
    <f:facet name="2">
    <af:menu text="menu 2" id="menu1">
    <af:forEach items="#{treeTest.menuItems['1']}" var="menuItemss">
    <af:commandMenuItem text="#{menuItemss.name}"
    actionListener="#{bindings.onNodeClicked.execute}"
    disabled="#{!bindings.onNodeClicked.enabled}">
    </af:commandMenuItem>
    </af:forEach>
    </af:menu>
    </f:facet>
    </af:switcher>
    </af:popup>
    </f:facet>
    </af:tree>
    ========================================================
    I want to get the commandMenuItem tag's information, i use following code in onNodeClicked method try to get it,
    FacesContext facesContext =FacesContext.getCurrentInstance();
    ELContext elContext = facesContext.getELContext();
    ExpressionFactory expressionFactory =facesContext.getApplication().getExpressionFactory();
    ValueExpression exp =expressionFactory.createValueExpression(elContext,"#{menuItemss.name}", Object.class);
    but the exp is null.
    Please help me to solve this problem.
    Thank you very much.
    Edited by: Yitao Li on Dec 4, 2009 1:06 PM

    You might need a #
    ValueExpression exp =expressionFactory.createValueExpression(elContext,"#{menuItemss.name}", Object.class);

  • Java Session problem while sending mail(using javamail) using Pl/SQL

    Hello ...
    i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
    pls any help.

    props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
    Please format your code when you post the next time, there is a nice 'code' button above the post area.
    Mike

  • Sudden menu problem in CS4:  Running OS10 Mavericks. Anyone got a clue?

    Cannot keep history and layers windows open simultaneously. Others likewise. By sudden I mean, one day it's fine, the next there's a menu problem. Assistance appreciated.

    If you have placed your layout the way you want it, use the Save Workspace, give it a name, and only check Palette location in the Save dialog.
    Then switch to another Workspace and back to your saved workspace to see if that fixes the problem.
    Last resort is to reset Prefs. Hold down ctrl-alt-shift, start Photoshop and agree to the reset.
    Gene

  • Spry menu problem - CS6 Dreamweaver

    I wonder if anyone can help me with my spry menu problem which I have with a fixed 960px wide horizonal menu bar that has 8 items in it. The sub-menus don't seem to display properly when you click on them in that some of the submenus only show up at the end of the menu bar itself in Explorer browsers 8/9. Does anyone know of any code I can apply to fix this problem? I am new to spry menu features and so any help would be very much appreciated.

    Also validate the rest of the code in your pages to see if you have any critical errors that need fixing.  For example, a missing doc type declaration might explain Spry failures.
    CSS - http://jigsaw.w3.org/css-validator/
    HTML - http://validator.w3.org/
    As an FYI, Adobe abandonded the Spry Framework late last year, after CS6 was released because Spry drop-menus don't hold up well on touch screen devices.   If you can't get satisfaction with Spry, try jQuery Superfish.  It's a better menu system.
    http://users.tpg.com.au/j_birch/plugins/superfish/
    Nancy O.

  • Java Programming Problem

    Hi all,
    I was looking for this java programming problem which had to do with a large building and there was some gallons of water involved in it too somehow and we had to figure out the height of the buiding using java. This problem is also in one of the java books and I really need to find out all details about this problem and the solution. NEED HELP!!
    Thanks
    mac

    Yes, it will. The water will drain from the bottom of
    the tank until the pressure from the water inside the
    tank equals the pressure from the pipe. In other
    words, without a pump, the water will drain out until
    there is the same amount of water in the tank as in
    the pipe The water pressure depends on the depth of the water, not the volume. So once the depth of the water inside the pipe reaches the same depth as the water inside the tank it will stop flowing. This will never be above the height of the tank.
    I found this applet which demonstrates our problem. If you run it you can drag the guy up to the top, when water in his hose reaches the level of the water in the tank it will stop flowing out.

  • Java Uninstall Problem

    Java Uninstall Problem
    This all came about because of a failed uninstall, using Your Uninstaller.
    The {Java runtime which is all I want) is not listed now & I tried all the other fix bad uninstall type features, all to no avail.} )
    When I DL & run the latest package (jxpiinstall-6u11-fcs-bin-b90-windows-i586-25_nov_2008.exe}
    & run it I get:
    1st message:
         "This software has already been installed on your computer.
         Would you like to install it?"
    If I say no, it exits.
    If I say yes, I get this second message:
         :This action is only valid for products that are currently installed."
    So Now I have no Java & have no idea what to do.
    Any help would be greatly appreciated.
    Thanks, Neuromancer23

    Sorry...after posting it i realized there was a more appropriate forum, of which it took quiet awhile to find.)
    Now that I know where to find the forum list I will never double-post again.
    I'll close the question if I can

  • Sun Java security problems

    Please any one tel me about Sun Java security problems
    with Desktop application

    Hi.
    If you're using SSGD 4.41, please download the Admin guide from here:
    http://docs.sun.com/app/docs/doc/820-4907
    There, at page #41 you'll find useful info concerning "Client Connections and Security Warnings".
    Hope this helps,
    Rob

  • OS X Lion - JAVA SCRIPT PROBLEM

    I recently updated from Snow Leopard to OS X Lion. Now I seem to have a JAVA Script problem. Where do I start fixing this issue. I have checked updates etc etc but it seems to be updated. However, when I login to my web site backend, I have a problem. Any advice please?

    Would you please write some more details? explain the problem and what web site backend you use. Thanks.

  • Horizontal java menu systems

    Does anyone have a pure java menu system for my servlet ?
    I can't have any dhtml/javascript yet I need some dynamic stuff like when u click on an item and if it has subitems it will merely drop down a list with these items.
    If u could help me or even direct/guide me in the correct direction I would be extremely happy !

    try out these examples they may help you in some way.
    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html

  • Spry Horizontal Menu Problem

    I switched to version 2 of the Spry Menubar due to sub-menu problems associated with iPads. Now I am having problems with sub-menus within IE8.  It is not possible to *quickly* scroll down the menu without the sub-menu disappearing.  Here is an example:
    http://gerberanalytics.com/tennis/tennis_header_test.php
    It works ok with CS6 in the design view, but not on the local test server or on the production server.  Any ideas?
    Thanks in advance for your help.

    Gramps,
    I appreciate you providing this.  I took a closer look at the errors and I made a few changes but this validator service continued to kick out errors.  In fact if you put Adobe's own web site into this application (http://www.adobe.com), it comes up with 44 errors.  As I mentioned before, the Adobe Widget Browser application for Spry Menubar 2 is essentially creating my code so I doubted that this was an actual problem.
    While I have been interacting with you, I have also been awaiting an update from Adobe's senior technology staff for a solution.  I heard from them today.  Here is what Adobe said:  Spry Menubar 2 has problems with IE 8 and IE 9 (which I already knew).  The first person with whom I spoke at Adobe suggested that my customers running the IE 8 and IE 9 browsers should switch to a different browser, such as Chrome.  I explained that asking users to switch was not a solution -- that's about 35% of my users.  I then asked to speak with a manager / supervisor. 
    My conversation with the supervisor went a bit better.  He told me that those running IE 8 and IE 9 on a Windows XP machine are ok.  Vista is a problem.  Windows 7 is also iffy.  My machine is a Vista and my wife's machine is a Windows 7.  It does not work on either machine for us.
    I told him that Spry Menubar 2 should be withdrawn from their site or there should be a warning to insure that people are aware of the problems.  He didn't say that they would do that.  He suggested that I should check back with him in a couple of weeks.  I did not get a warm and fuzzy feeling that this was a priority item for them.
    At this point, I'm bailing on Spry Menubar 2.  I may return to Spry Menubar 1.6 which requires a "double tap" on the nav buttons to work on an iPad.  I may also check out jQuery.
    Thanks for the suggestions but it looks like Adobe has some serious issues.  If your customers are using iPads (and they are), Spry Menubar 2 is not a solution to fix the problems encountered in Spry 1.4 and Spry 1.6.
    Scott

  • Java Menu setout problems.

    Dear Everyone,
    I am currently experiencing some problems with organising a User Interface that uses menu items. This code creates a File menu and a New menu that sit side by side (with New to the right of File). I am trying to design a menu that has only File visible, with New showing below File only when File is pressed. Can anybody please suggest modifications that will make this possible. Thanks.
    Regards
    D
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class GUI extends JFrame
    GUI()
    Toolkit tk = Toolkit.getDefaultToolkit(); //intialize the toolkit.
    Dimension sSize = tk.getScreenSize(); //determine screen size.
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    JMenuBar menuBar = new JMenuBar(); //Creates Menubar object called menuBar.
    setJMenuBar(menuBar);
    JMenu FMenu = new JMenu("File"); //File Menu object instantiated.
    FMenu.setMnemonic(KeyEvent.VK_F); //Key that activates File menu...F.
    menuBar.add(FMenu); //File Menu added to menuBar object.
    JMenuItem NewItem = new JMenuItem("New"); //Creates New sub-menu object.
    NewItem.setMnemonic(KeyEvent.VK_N); //Key that activates New sub-
    //menu....N.
    menuBar.add(NewItem);
    setLocation(sSize.width/4,sSize.height/4);
    setSize(sSize.width/2,sSize.height/4);
    setTitle("Java QuickLaunch Toolbar");
    setVisible(true);
    }

    Change
    menuBar.add(NewItem);to:
    FMenu.add(NewItem);You need to add to the menu, not to the menubar, that's why it wasn't appearing in the correct place.

Maybe you are looking for