How to make JPopupMenu pop out upwards?

The title is just my problem.I add a JToolBar at BorderLayout.South of a JPanel. A popup menu will shown when I click on one button of my JToolBar. But the low part of JPopupMenu was covered by the taskbar of Windows2000. I want to make my JPopupMenu pop out upwards. How can I?

Assuming that the popup is triggered by the mouse click and it's screen coordinates (x, y). Since the toolbar is in the southern border, and the popup appears to the right and below from that position "(x, y)". Calculate the width and length of the popup, (say it's 60 pixels wide by 90 pixels long) subrtact the witdth value ,(60) and the length value, (90) from x and y respectively. So as to go something like this:
private void maybeShowPopup(MouseEvent e) {
     if (e.isPopupTrigger()) {
          int x = e.getX() - 60;
              int y = e.getY() - 90;
                   popup.show(e.getComponent(), x, y);
}Or something to that effect. You simply alter the coordinates(x, y) to reposition the popup starting point. I did not test the above code as this is purely a fictional example. Hope this helps. Also if you need help measuring screen pixels here is a cool little program called Calipers that will help. http://www.iconico.com/caliper/

Similar Messages

  • How to make a pop up within if else

    I'm now making an user interface which will be used to control a remote robot. I want to make it so that when a button is pressed, a window will pop-up and tells the user what the robot is doing. At the moment, I can only make it to show the message in the cmd box. Code is as follow:
    class ActionHandler implements java.awt.event.ActionListener
              public void actionPerformed(java.awt.event.ActionEvent event)
                   Object object = event.getSource();
                   if (object == forwardButton) {
                        System.out.println("Robot moving fordward");
                   else if (object == backwardButton) {
                        System.out.println("Robot moving backward");
                   else if (object == rotateLeftButton){
                        System.out.println("Robot rotating to its left");
                   else if (object == rotateRightButton){
                        System.out.println("Robot rotating to its right");
    The only way to make pop-up which I know is this one:
    import javax.swing.*;
    public class DisplayTextInWindow {
         public static void main(String[] args) {
              // create a String variable
              String messageText = "Hello world";
              // display it in the console window
              System.out.println(messageText);
              // now display it in its own window
              JOptionPane.showMessageDialog( null, messageText );
    Which I can put into the code for interface because I can't start another class within an if statement (as far as I know anyway...)
    Can anyone please teach me how to make a pop-up within an if else statement?

    Which I can put into the code for interface because I can't start another class within an if statement (as far as I know anyway...)yes you can.
    if (robotRotating)
        newClass class = new newClass();
        class.methods;
    Can anyone please teach me how to make a pop-up within an if else statement?sure
    if (robotRotating)
       //i think this part is already answered in the previous post
       javax.swing.JOptionPane.showMessageDialog(null, "your message here", "your title here", JOptionPane.OK_OPTION);
    }

  • How to make a snapshot out of a movie file?

    How to make a snapshot out of a movie file and integrate this snapshot into the movie? Thanks, Wolfgang

    Either you use the Hold function from the Retiming popup or you export an image and reimport it.

  • How to make a key out of this data?

    Since no one replied to my last post, I'll give it another try. From an RTSP server I get two values, a key called rsaaeskey (342 bytes, without the line breaks):
      yxKBocBgTii20n9nbKfYGyGhPqtosXuq8M99yU5/PzTVNmIUsUGlpD27u
      cqN8eNFvmaO7cFVXeaMGaCfI5V+YNrd77xGQ+CUE0XFraXUvp4cF4aX1L
      ZOGe38nwX3Ba+4bQFfjmYgz3ObRuOWlw9KCi4CMP5574F+CIvutVAwtAC
      PiDFF7nVcoaBTr2QbSUile0Zs3Hyxjn9PWVaey9Nu2DgJZ8rtw6F2SkQ7
      NDHBjjUKXNIeCAeBFuV4XNiazvi3gWa4VbgITtD9jcm+7nPMAK0oBL1S3
      K3Z6FK7XVnfehYYJjRw7THMZzSvq7FtLB9QgulqQTJ3awJdwS0ACb1FkAand an initialization vector called aesiv (22 bytes):
      zcZmAZtqh7uGcEwPXk0QeAThe data is obviously Base64 encoded. However, after decoding I don't know how to make a key out of it. Trying KeyFactory's generatePublic and generatePrivate methods result in an InvalidKeySpecException with any algorithm I've tried (RSA, DSA, DH).
    I think this is a multi-prime RAS secret key (someone said they're 342 bytes long), but how do I generate a Java Key out of it?

    The rsaaeskey, decoded to binary, is a binary array of 256 bytes. Using the DUMPASN1 tool we see that the bytes are not in ASN.1 BER or DER encoding.
    C> openssl enc -base64 -d -in rsaaeskey.base64 -out test.bin
    C> dumpasn1 rsaaeskey.bin
       0 CB   18: [PRIVATE 11]
                :   81 A1 C0 60 4E 28 B6 D2 7F 67 6C A7 D8 1B 21 A1
                :   3E ABIf it were encoded in ASN.1 BER or DER encoding it will start as a "SEQUENCE" or a "SET", not as an unrecognized data.
    You need to check the exact specification of the protocol. (Are you using TSP - RFC 3161, or RTSP - RFC 2326?)

  • How to make a pop up that pause the program (during pop up) and click button to continue OR stop the program

    Hi people,
    I am using LabVIEW to create a testing program to test a power system. The testing lasts for a loop of 90 minutes. 
    I would like to make a pop up when the testing is completed. When the pop up message appear, the whole program should be paused (NOT STOP) and when the two buttons (continue, stop) are pressed, the program should continue to run OR stop. [To start another loop of testing in order to make sure data collected is accurate and consistent.]
    How do I make this kind of pop up window? I have totally no idea how to work on this. I will be very appreciated if someone could give me some suggestions/help regarding this.
    Thank you.
    Regards,
    Vanessa

    VanessaWen wrote:
    Hi Blokk,
    In my actual program I have 3 while loops. In while loop A, it is used as counter, to transfer rows of data from an array (row by row) to loop B. For loop B, device drivers are used so that my program can be used to control the devices (it is for automated instrument testing). Loop C is then used for DAQ, data at different test points will be recorded at every second.
    I would prefer something simple in controlling all the while loops as my program is quite complex.
    Thank you so much.
    Vanessa
    I do not see why you need these 3 while loops. This task could be done with a single while loop, or max 2. Why you need loop A? You could generate data from this array inside loop B. You must use the DAQ and device control part in separate while loops? Maybe you could simplify you code to have one single while loop: at every iteration you could send a new control command to your device(s), and after this do a DAQ measurement.

  • How to make a stationery out of .doc or .docx file?

    Hi,
    I stumbled upon a website that has some nice stationery, in .doc format. and since there few free pre made stationery available for Mail.app, at least to my knowledge, because I think I almost downloaded every free stationery available out there that could be easily found via Google. I decided to download some of these .doc stationeries and try to put them in Mail.app, but first I had to convert them into .html format. so here is what I've already tried and did not work:
    first I tried opening them in TextEdit, which supports .doc out of the box, only to find out that the pictures in the documents are gone to thin air. I tried saving it and then opening it with something else like Open Office, but the pictures were permanently gone.
    then I tried opening the original documents directly in Open Office, you guessed right If you said they will look screwed, and they were, and tried to save them as html, they were screwed even more.
    so I did a bit of research and found out that I could use Google Docs in order to convert the documents, I uploaded them into my Google docs and then tried to open them with it, but found it that Google docs can't handle the pictures (specially background pictures) either. as a result I did more searching to find a document converter and here is what I found:
    I found a few online service to convert these documents:
    http://www.freefileconvert.com/ was pretty good to convert the files into an .odt format. at first I thought yes I got the solution, now I can simply convert it to html using Open Office, but unfortunately, when I saved the document in html format and checked it in Safari to see how does it look, as If I would have done the same in MS Office with the original format, it looked pretty much screwed .
    So I continued to look and I found a few other online services one of them asked me to pay a fee, I skipped to the other one which was http://docx-converter.com/. unfortunately the website wasn't functioning properly I think, at least for me (maybe someone out there has succeeded using it, I don't know.) and it didn't send me anything.
    Finally I found http://www.zamzar.com/ that could convert .doc or .docx documents into html, or at least that is what it claims to do so, I tried it, and after I received the file via email, I found out it only contains a bmp image of the document's background. So much for the online conversion services!
    But I decided I would give it a last shot using MS Office online, so I opened up my old Windows Live mail and went into my Skydrive, I uploaded the documents and tried saving it as html, but there were no save as html (after all an online copy of MS Office should have some limitations, otherwise few people will be willing to buy a Desktop version) but this didn't made me disappointed, since I already knew, that Neither Office Word can make a clear conversion, so I tried something different, while I was in Safari looking at the document in online MS office, I saved the page as Web Archives, then I opened the file with TextEdit, and after deleting useless links and pictures, I finally managed to get a clear document with everything that supposed to be in it. At this point I only need to know how to make use of this document to create a stationery with this raw file which is in Web Archive format. any ideas?
    null

    I'm a total idiot! How did I overlook http://www.zamzar.com/ functions? I think I might have mistakenly chosen convert to BMP instead of html. I tried it and the result was very good.
    OK I finally found a good solution for this problem, so everyone out there that has the same problem, here is what I did:
    1. OK if you have some .doc and .docx file formats and you want to convert them into something like .html or .odt, without having to reedit the code or getting a screwed document, use http://www.freefileconvert.com/ in order to convert them into .odt so they would look as they do in MS office just go to the website and upload your documents then choose .odt, then click convert, after a few moments you will get a link to download your .odt files. you can use and play around with your document in Open Office, I have tested it and it's really good.
    2. Or if you want to convert them into .html with a clean code, and all the elements in it, simply go to http://www.zamzar.com/ and then ulpoad your documents, choose .html and enter your email address, you will have your .html files zipped and sent right in your inbox, then you could use Kompozer like me, or any other html editor, to make a template out of it. I tried it and the result was nice, now I have a bunch of nice html files that I can use to make templates and email stationery.

  • Video Answer to "How to make 3D Video out of regular 2D Video"

    Didn't know how to do that and asked here this question 2 month ago - Is it possible to make 3D video out of regular 2D video file to watch further on my iPod. So I came across an answer to this on ...Youtube!
    Here are two video screencasts I found to progs that can do such thing, So I've tried and now enjoy my movies in 3D on iPod.
    If you're interested then deffo check them out:
    http://www.youtube.com/watch?v=lUYT-c5leSU
    http://www.youtube.com/watch?v=_TxRMGUwGS0

    follow advice given in this User Tip
                     How can I make a still frame from iMovie 11? (also works in iMovie 10)

  • How to make a gif out of a movie clip?

    So yeah... I'm an idiot when it comes to these things.
    How do I go about doing a gif of a small video?
    And... Could you do the explanation in a step by step guide please. Thanks

    Video to GIF | free Video to GIF Generator on Make A GIF
    Animated GIF Generator - Imgflip
    How to Make an Animated GIF from a Video in Photoshop CS5
    The Complete Guide to Making Animated GIFs - Lifehacker
    Giflike - Create a gif from YouTube, video or images
    GIF Maker From Videos. Create Awesome Gif Animations ...
    Bloggif : Convert video to animated GIF for free

  • How to make a "Program" out of my .java files?

    I have made a little application that stores a file to disk. Is there someway to make a file out of my .java files so it can be run without opening my editor and choosing run?

    sorry I didn't check that, I can now run the jar command.
    But even though I can create a .jar file I get an error. I have followed the guide that says I need to add the applications Entry point.
    I have two classes:
    saveDates.class //contains the main method
    UserInput.claa // Parsing of user input
    When I create the jar file I type:
    jar cfe saveDates.jar SaveDates SaveDates.class UserInput.class
    But when I try to run it like:
    java -jar saveDates.jar
    I get the error:
    C:\workspace\dato>java -jar saveDates.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: SaveDates$1
    at SaveDates.main(SaveDates.java:89)
    C:\workspace\dato>
    Do I need to change the main method someway?

  • How to make a fly-out menu item checked?

    Hi,
    is there a way to make a fly-out menu item (coming from an XML list) checked - like in this example:
    by the way, I know it's been submitted as a bug already, but fyi sub-menu items (2-1 in the following example) don't work as expected:
    var xmlMenu:XML =
        <Menu>
          <MenuItem Id="item_1" Label="Item 1"/>
          <MenuItem Label="Item 2">
            <MenuItem Label="Item 2-1"/>
          <MenuItem/>
          <MenuItem Label="---"/>
          <MenuItem Label="Item 3"/>
         </Menu>;
    Thanks in advance!
    Davide

    If Harbs says nope, it's nope
    At least now I know it. Thanks!
    Davide

  • How to create a pop out window?

    Can any buddy help me?
    I need a Pop Out window, that is 630Pixels X 430 Pixels...For a Flash Poll sistem
    I have search in google, for tutorials but it is just not working....
    What I being looking for, is to add like a link to a Text, and a pop out window appearing, to put a poll
    Any advice...thanks
    This is the code I being using
    </object>
    </noscript><script language="javascript" type="text/javascript">
    <!--
    function popitup(url) {
        newwindow=window.open(url,'name','height=430,width=630');
        if (window.focus) {newwindow.focus()}
        return false;
    and for the Text link
    <p><span class="style12"><a href="encuesta.html" onclick="return popitup('encuesta.html')"
        >CLICK AQUI ENCUESTA</a>

    But is the function "popitup()" actually defined somewhere? if there is no complementary script code in the head or an external JS file, naturally it won't work. And by all means, one can find a million alternate pop-up code generating tools...
    Mylenium

  • How to Stop iTune popping out from dock...annoying

    I don't want iTune auto lunching or popping out from the dock if the app opened and minimized...annoying. Me never liked iTune.

    Well, I figured the only way to resolve my issue was to just closed iTune window while I got the Internet radio playing...it won't pop out of Dock now.

  • How to make JPopupMenu not take focus/mouse cursor?

    Hello,
    I show() a JPopupMenu based on what the user types in a JTextField, however, when that happens the user typing on the keyboard will no longer write into the text field, unless with the mouse clicks again on the field, thus closing the popup menu.
    I want, like in Eclipse and NetBeans code completion feature, that the user may still type in the field even if the popup menu comes out, although typing might close the popup menu (and in the IDEs that actually generates a new popupmenu with different content).
    How can I achieve that? I thought it had to do with Focus, but it doesn't seem to.

    one way is to have the default invoker/null. However that makes the popup stick, unlike in the ides.

  • How to make a Lay-Out

    Hello!
    I am using pages for a few months now, but there is one thing I can't get. If you make a project many people with the newest word have a beautiful lay out. For example with colored lines on each page. I was wondering. How can I get something like that in pages? I have looked at the templates but they don't have them and if I open a template I only see the first 2 pages of the whole template.
    Best regards,
    Cathelijne

    MZ,
    There's no magic in those templates that you buy. You're just paying for the designer's time and talent to do what any similarly talented person could do with Pages, given the time.
    What most users would lack, in addition to the training and experience and "the eye" to produce such nice layouts, is the other graphic software that may have been used to facilitate the creation of the background images/graphics that may also be there. Pages has drawing tools, but they would be inadequate, I would guess, to satisfy a graphic designer doing production work. You might be surprised, though, at what can be achieved with the built-in tools if you have the patience.
    Jerry

  • How to make slide show out of photos

    I have about 60 .jpg's I like to make into a slide presentation. What I would like to be able to do is give a friend/relative a disk and all they would have to do it....well, nothing. I'd like it to open on my image number 1. I would like the image to stay on the screen until it's manually advanced by "clicking" on it or on and "advance" button. It seems like it should probably be easy, but I can't figure it out. I'm not adverse to using third party software. I want the images to be as clear as possible. Am using OS X Maverick with 32 GB of ram.
    Thanks in advance.

    There are many ways to produce slide shows using iPhoto (see this:  http://support.apple.com/kb/PH2423 ), iMovie or iDVD and some limit the number of photos you can use (iDVD has a 99 chapter (slide) limitation).
    If what you want is what I want, namely to be able to use high resolution photos (even 300 dpi tiff files), to pan and zoom individual photos, use a variety of transitions, to add and edit music or commentary, place text exactly where you want it, and to end up with a DVD that looks good on both your Mac and a TV - in other words end up with and end result that does not look like an old fashioned slide show from a projector - you may be interested in how I do it. You don't have to do it my way, but the following may be food for thought!
    Firstly you need proper software to assemble the photos, decide on the duration of each, the transitions you want to use, and how to pan and zoom individual photos where required, and add proper titles. For this I use Photo to Movie. You can read about what it can do on their website:
    http://www.lqgraphics.com/software/phototomovie.php
    (Other users here use the alternative FotoMagico:  http://www.boinx.com/fotomagico/homevspro/ which you may prefer - I have no experience with it.)
    Neither of these are freeware, but are worth the investment if you are going to do a lot of slide shows. Read about them in detail, then decide which one you feel is best suited to your needs.
    Once you have timed and arranged and manipulated the photos to your liking in Photo to Movie, it exports the file to iMovie  as a DV stream. You can add music in Photo to Movie, but I prefer doing this in iMovie where it is easier to edit. You can now further edit the slide show in iMovie just as you would a movie, including adding other video clips, then send it to iDVD 7, or Toast,  for burning.
    You will be pleasantly surprised at how professional the results can be!
    To simply create a slide show in iDVD 7 onwards from images in iPhoto or stored in other places on your hard disk or a connected server, look here:
    http://support.apple.com/kb/HT1089
    Preparing images for iDVD slideshows:
    http://support.apple.com/kb/PH5452

Maybe you are looking for

  • Cannot log into iCloud after upgrading to Yosemite

    I have 3 iCloud accounts on my mac for various family members but after the upgrade I cannot get the iCloud account to log in. It just keeps asking for the password. Any ideas? Dhiran

  • Can i use this cheap telly with apple tv?

    hi all - i was about to buy a soundbridge music streamer - mainly to play itunes through my hifi but for the extra £50 i am now thinking about an apple tv but i lack the approprite telly - i am about to buy one for the bedroom so would the one listed

  • Error-Message when i start LV

    Wenn ich ein VI vom Explorer her öffne (und LV geschlossen war), erhalte ich oft die Fehlermeldung "Die Datei xxx.vi (oder eine ihrer Komponenten) wurde nicht gefunden. Stellen Sie sicher, dass Pfad und Dateiangaben stimmen..." Labview wird trotzdem

  • OSB defaulting Content-Type to "multipart/related" in case of attachments

    I have scenario where I need to invoke a REST Webservice from OSB which accepts only media types which has "multipart/atom+xml". OSB is used for protocol transformation converting the SOAP request into the HTTP POST request with multipart. I have Pro

  • Configuring user specified alerts using solution manager

    We are having SolutionManager 4.0 with sp 12. We configurred alerts for different production systems which are in the landscape.Right Now We have special requirent for our R/3 Producton system. We need to setup alert for monitoring of avg response ti