What is the Popup class used for

I always thought that a Popup should have some basic functionality, such as the pupup should close when:
a) the escape key is pressed
b) the popup loses focus
The popup class provides none of the above functionality and in     fact seems to require some obscure code to
even get the keyboard focus to work properly.
Using a JWindow seems to provide the same functionality as a Popup.
JPopupMenu seems to support both of the above requirements.
Run the following program:
a) click on each of the buttons
b) click on an empty part of the frame
It appears to me that whenever you need a "popup" you should use a JPopupMenu.
Is the Popup class good for anything? Does it provide any functionality that I am not aware of?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class PopupTest extends JFrame
     String[] numbers = { "one", "two", "three", "four", "five" };
     public PopupTest()
          getContentPane().setLayout( new FlowLayout() );
          JButton popup = new JButton("Popup as Popup");
          popup.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent e)
                    popupPopup(e);
          getContentPane().add(popup);
          JButton window = new JButton("Window as Popup");
          window.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent e)
                    windowPopup(e);
          getContentPane().add(window);
          JButton menu = new JButton("PopupMenu as Popup");
          menu.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent e)
                    menuPopup(e);
          getContentPane().add(menu);
     private void popupPopup(ActionEvent e)
          JList list = new JList(numbers);
          list.setSelectedIndex(0);
          PopupFactory factory = PopupFactory.getSharedInstance();
          Popup popup = factory.getPopup(this, list, getLocation().x, getLocation().y);
          popup.show();
          Window window = SwingUtilities.windowForComponent(list);
          if (window != null)
               window.setFocusableWindowState(true);
          KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent(list);
     private void windowPopup(ActionEvent e)
          JList list = new JList(numbers);
          list.setSelectedIndex(0);
          JWindow window = new JWindow(this);
          window.getContentPane().add(list);
          window.pack();
          window.setVisible(true);
          window.setLocation(getLocation().x + 200, getLocation().y);
     private void menuPopup(ActionEvent e)
          JList list = new JList(numbers);
          list.setSelectedIndex(0);
          Component c = (Component)e.getSource();
          JPopupMenu menu = new JPopupMenu();
          menu.add(list);
          menu.show(c, 0, 0);
          list.requestFocusInWindow();
     public static void main(String[] args)
          PopupTest frame = new PopupTest();
          frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
          frame.setSize(500, 200);
          frame.setLocationRelativeTo( null );
          frame.show();
}

you'd use Popup like JPopupMenu does, via a PopupFactoryYes you can get the Popu from the PopupFactory, but I think you are missing the point of my question. Popup has two methods, hide/show. It provides no other funtionality. I must write code to handle the escapce key and close the popup when it loses focus.
When I use a JPopupMenu and add a component to the menu, it appears to add some listeners to the component to handle the escape key and loss of focus.
I think it's safe to say that you're right when you say that it's preferable to use
JPopupMenu (my experience as well).That was my conclusion, but I was just wondering it I was missing anything.
It turns out that there are used in tooltips which, by essence, don't need any
input from the user (whether keyboard or mouse) I guess thats what I was missing, only use a Popup in tooltip type situations.

Similar Messages

  • What  are the initial classes used  for  create DBAdapter  in  JDeveloper

    I am trying to create a DBAdapter by JAVA program using JDeveloper API , So want to know initial classes name used to set the Adapter name and Service name in JDeveloper .

    HI iansan5653
    I am not sure if you are trying to make a widget/extension? for the browser or just customize the appearance of the user. I believe you have to create an appearance and then allow the user to download the appearance to change the styles.
    I think you may want this webkit -moz-appearance[[https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance]]
    I did some research on this and the MozillaZine is a great reference for all of the Preferences to add stuff to the panels.
    Some more information
    * [[http://kb.mozillazine.org/Category:Preferences|MozillaZine Category:Preferences]]
    * This Menu editor may help [[https://addons.mozilla.org/en-US/firefox/addon/menu-editor/?src=search]]
    * UserChrome.css info [[http://kb.mozillazine.org/index.php?title=UserChrome.css&printable=yes]]
    * Visual Customizations [[http://kb.mozillazine.org/Category:Visual_customizations_%28Firefox%29]]
    *topics [[http://forums.mozillazine.org/viewtopic.php?t=1006795]]
    I have also seen extensions made by adding style to these items in the about:config. You could live update the items and see if the css makes changes live in the browser and see how the file renders. [[http://kb.mozillazine.org/About:config_entries#UI.]]
    But for better help on this I would recommend asking the mdn
    [[https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Mozilla_Extensions]]
    If you can define your set up, the Mozilla Developer Network may be the place for you. Hope this helps.

  • What is the standard class used to create SALES ORDER in SAP CRM?

    Hello Experts,
    Can anyone suggest me what is the standard class used for creating sales order.
    I have created sales order using the BAPI 'BAPI_SLSTRANSACT_CREATEMULTI' in my report program.
    Now, I have to create sales order using standard classes and methods(my assignment).
    Please suggest the suitable class.
    Regards
    DNR Varma

    Hi Varma,
    You can create crm documents like sales order using BOL interfaces.
    You can check one example at the following thread:
    Create OrderThro BOL
    Check if it helps you a little more.
    Kind regards,
    Garcia

  • What is the ac cord used for ? do i need to use it?

    what is the ac cord used for ? do i need to use it?

    It is used to extend the range of the AC adpter. The 2 prong plug pulls out and is replaced by the cord.

  • What are the naming conventions used for aggregates created from Query?

    What are the naming conventions used for aggregates created from Query?

    Hi Reddy,
    As you know aggregates are baby cubes right.
    Aggregate names by default system has given as 6 digit number like 100831 but write the description by yourself.
    Here you have to remember fact table is created with the name
    like for ex: /BIC/F100831.
    while creating aggregates you can observe all options carefully till complete the creation process then after I am sure about
    your can get idea .
    If problem still persists with you let me know the same until
    get out of that.
    else assign points if this is sufficient.
    Thanks,
    Ramki

  • What is the font Apple uses for the time and date on the lock screen in iOS 7?

    I can't find the answer on Google. What is the font Apple uses for the time and date on the lock screen in iOS 7?

    This font. It's weird, it looks different when viewing the screenshot on my iMac, than it does on my iPod touch. Probably because of the retina screen of the iPod.

  • What is the following icon used for?

    It is a rectangle with a small black triangle at the lower right.  It has another rectangle in the center of the outer one that has what looks like a gradient in it.  Lighter to the left and darker to the right.  I am taking a test and they want to know the following:
    creating an inverted image, reversing the existing color palette
    creating a cloud pattern using two colors
    creating a color gradient using two or more colors
    What is the answer?  I have never seen this before and I do not have CS5.
    Thanks, the sooner the better...

    I'm thinking they just stylized it, because no, it doesn't exactly match the gradient icon in the Tools panel in the current release of Photoshop.
    Here's the same tool in Photoshop 6.0 (6 major versions older).  That's closer, but still not a perfect match.
    For completeness, here's what it looks like in PS CS6:
    -Noel

  • What is the right "class driver" for my EPSON printer Aculaser CX 21N ?

    Please let me know the correspondence between the EPSON class drivers proposed in the "Bonjour Print Services" tool (a lot of the EPSON class drivers seems to be identical) and the EPSON "Bonjour Printer Name" AL-CX21-3FD57B (IP) and (PostScript) (my printer).
    Notes :
    Before with Windows 7 that works properly => now - after my migration to "Windows 8 professional" - that don't works anymore !
    "Apple Care" tell me first to completely uninstall and reinstall all the following programs: iTunes, QuickTime, Apple Software Update, Apple Mobile Device support, Bonjour and Apple Application Support => that's what I also do in full accordance with the Apple article HT1923 dated 2013, 21 February !
    I tried to active my Printer through the disk received with my printer => no chance the systems tell me that I have no enough access right to do that !
    I also found in the "Information - Network" of my above mentionned printer the following data under "Entity Type":
    LaserWriter
    EPSONPCL5C
    EPSONPCLXL
    EPSONPAGES3

    I also have an Epson printer. You indicated that you already downloaded an updated driver from Epson's website. Did you also downloaded the one(s) that came w/the Epson CD? However, you did not mention that you repaired permissions & restarted after the installation.
    If the above was not done, then I suggest that you do so. Hopefully, this should solve your problem.
    I just checked the Epson folder in my HD & your model printer is NOT listed among them.

  • What is the ReplacesDialogIDTime column used for in the CDR database?

    I have been writing some reports using SQL aganist the Lync CDR database - looking mainly at the SessionDetails and VoipDetails tables.
    I have come across some instances where the duration of the call (session start - session end) is not acurrate, but I can see other records in the sessiondetails table with the replacesdialogidTime is the same as the SessionIDTime in the original record. 
    Does anyone know why Lync does this and why ?
     

    There is no HashCode class in Coherence (at least I cannot find one in the 3.5.2 jar).
    I can only assume you actually mean the hashCode method, which is part of standard Java and is declared on the Object class that every class inherits from. It is actually quite important to understand how to implement it properly if you are going to override this method in your classes (which you probably should in domain objects). Try reading this which I pulled at random from Google: http://www.ibm.com/developerworks/java/library/j-jtp05273.html
    JK.

  • What is the "Content" DVD used for in CS5 Master Collection?

    Hey Everybody,
    Sorry--I know there must be some cue I am over looking somewhere, but what is the Contents DVD fo in the 4 disk CS5 Master Collection Installation Pack?  I have installed everything on a new MacBook Pro.  First 3 DVDs are very logical (in terms of what they contain and how to install them), but the 4th one just has a bunch or read-me files in various languages.  Is there something on this disk I need to install?
    Many thanks in advance!

    Just some templates and other assorted stuff. Nothing you have to have.
    Bob

  • What are the UserChrome classes/ids for the panel widget?

    I am customizing my Firefox and it looks great, but I can't figure out how to customize the panel widget, like the one used in the downloads panel. I want to edit the widget browser-wide so that it can be compatible with addons that use that. I can't find an addon for this or the classes/ids that would work in the UserChrome.css file. I tried the DOM Inspector, but I couldn't figure out how to make that work.
    I'm using Aurora 27.0a2 on Windows XP.

    HI iansan5653
    I am not sure if you are trying to make a widget/extension? for the browser or just customize the appearance of the user. I believe you have to create an appearance and then allow the user to download the appearance to change the styles.
    I think you may want this webkit -moz-appearance[[https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance]]
    I did some research on this and the MozillaZine is a great reference for all of the Preferences to add stuff to the panels.
    Some more information
    * [[http://kb.mozillazine.org/Category:Preferences|MozillaZine Category:Preferences]]
    * This Menu editor may help [[https://addons.mozilla.org/en-US/firefox/addon/menu-editor/?src=search]]
    * UserChrome.css info [[http://kb.mozillazine.org/index.php?title=UserChrome.css&printable=yes]]
    * Visual Customizations [[http://kb.mozillazine.org/Category:Visual_customizations_%28Firefox%29]]
    *topics [[http://forums.mozillazine.org/viewtopic.php?t=1006795]]
    I have also seen extensions made by adding style to these items in the about:config. You could live update the items and see if the css makes changes live in the browser and see how the file renders. [[http://kb.mozillazine.org/About:config_entries#UI.]]
    But for better help on this I would recommend asking the mdn
    [[https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Mozilla_Extensions]]
    If you can define your set up, the Mozilla Developer Network may be the place for you. Hope this helps.

  • What's the best setup / use for Thunderbolt + SSD iMac ?

    Hi!
    I'm testing one of the new 27" iMacs (i7, 16gb ram, SSD, 2tb internal HD, external Promise Thunderbolt disk)
    I have until Monday to decide to keep it or return it and I'm doing this test to see if it would make a good second computer for our editing (primary is 8 core MacPro).
    I can either afford this 27" iMac with a Promise Thunderbolt disk OR anoher MacPro with 4 internal disks.
    Can someone please share with me how I would get max performance out of the iMac-setup?
    Here's what I THINK prior to adding the Thunderbolt disk:
    Internal SSD => Lion + apps
    Internal HD => imported videofiles, scratchdisk, cache etc. and export disk
    But then......... how should the situation change when adding the Thunderbolt drive ?
    Is the Thunderbolt so fast, that all video data should be placed there or would I benefit from placing SOME part on the internal HD, and OTHER parts on the external Thunderbolt ?
    Or even more complex ........ should I use all three disks (also the SSD) for different parts of the video / process and if so, what's your thoughts?
    Or......... would you go for yet another 8 core Macpro without SSD and Thunderbolt??
    Thank you for the inputs on this

    klp29 wrote:
    Or even more complex ........ should I use all three disks (also the SSD) for different parts of the video / process and if so, what's your thoughts?
    Or......... would you go for yet another 8 core Macpro without SSD and Thunderbolt??
    Are you only using one Thunderbolt disk?  If so, IMHO, you're wasting the beauty of TBolt.  To make much better use of it will cost a pretty penny, but you end up with a 4, 6, or 8-disk external RAID enclosure.  In that, you stuff a bunch of drives and create however many RAID volumes you want.  Preferably a couple of separate RAID0 volumes for the speed (raw data on one of them, scratch space on another, backing the raw data up elsewhere).
    However, one TBolt disk is really a waste.
    Were I buying a Mac right now, I'd get the following:
    6-core 3.3GHz Mac Pro
    aftermarket SSD (to hell with Apple's pricing)
    aftermarket RAM (see above paranthetic)
    2 10k WD SATA drives for an internal software-only RAID0 array for scratch
    aftermarket ESATA PCIe card
    ESATA enclosures with drives
    That last bullet is "up to you" bit.  You can do 2 external enclosures with RAID0, RAID1, whatever works for storage and speed.  And it can be built piece-meal as you need to expand.
    Why did I pick the 6-core vs. one of the 2 x 4-core machines?  Horsepower, pure and simple.  Those 3.3GHz 6-core chips are quick little bastards (compared to the rest of the Mac Pro line) and you really want raw number crunching power vs. a bzillion cores.  Put the apps and OS on the SSD.  Scratch space on the internal 10K drives.  Then figure out how to split the storage up with your external enclosures.
    When you're ready, grab a Quadro 4K card and enhance your video editing speed substantially.
    jas

  • What is FM VC_I_GET_CONFIGURATION actually used for?

    Hello ABAP Gurus
    I just want know what actually the FM VC_I_GET_CONFIGURATION used for.
    What are the input parameters for this function and also what kind of information can I get by calling this FM.
    Any feedback on this will be greatly appreciated.
    Thanks
    Ram

    Hi Ram,
    <b>
    VC_I_GET_CONFIGURATION</b> is used to find charateristic value and characteristic description for the given class type and batch number (CHARG) of a material.
    call function 'VC_I_GET_CONFIGURATION'
      exporting
        INSTANCE                    = <b>vbap-cuobj</b>
        LANGUAGE                    = SY-LANGU
      TABLES
        CONFIGURATION               = i_config
      EXCEPTIONS
        INSTANCE_NOT_FOUND          = 1
        INTERNAL_ERROR              = 2
        NO_CLASS_ALLOCATION         = 3
        INSTANCE_NOT_VALID          = 4
        OTHERS                      = 5.
    Reward if useful.
    Thanks
    Aneesh.

  • What are the business scenarios used in plastic industry

    Hi Experts,
    Could you guys please tell me what are the business scenarios (in sap sd) i should use while implementing in plastic industry (as if someone already worked on implementation project at plastic industry).....
    As per my knowledge i would use:
    MTS
    Batch management
    Third party etc....
    but in addition to these (if anyone already worked on the implementation project in plastic industry...then what are the business scenario used for......please suggest.....)
    If have any idea please suggest........ would be a great help.......
    Thank you in advance...........

    it depends which part of the value chain you are working at e.g. your company is B2B, supplying ingredients to Plastic industry manufacturer or you sell to wholesellers.
    Below are the processes you - may - do in Plastic industry -
    - Inter-company stock transfer
    - Subcontracting
    - Contracts
    - QM inspection during delivery process
    If you require business scenario descriptions (in brief) for the above processes, then please convey.
    Edited by: Typewriter on Jul 11, 2011 11:30 AM

  • What are the classes used for bropdownListBox in BSP and purpose and how

    what are the classes used for bropdownListBox in BSP and purpose and how
    thank you,
    Regards.
    Jagrut BharatKumar Shukla

    Benje001,
    Right-click on the CWAI control on your form. Choose Properties. The first tab is the Channels tab. After you choose your device from the drop down box on the right, you can type in the Channels box which channel you want to use.
    If you want to see a CWAI control that is already configured, all of the shipping examples will have this already done.
    Also, if you have questions about any item on the CWAI (or any other NI ActiveX control) you can click the ? icon in the right corner of the properties page and then click on the item in the dialog that you need help with. This "What's this" help will describe that particular control on the dialog.
    Hope that helps!
    Regards,
    Shannon R.
    Applications Engineer
    National Instruments

Maybe you are looking for

  • Cancelled print but will not cancel and comes back on to print same job

    cancelled print but will not cancel and comes back on to print same job on on hp deskjet all in one

  • How to get second session in second browser

    I have got an B2B application that has 3 types of users - [System]Admin , Vendor & Clients. In one of the use cases an 'Admin' user can launch a new window [browser] on behalf of client or a vendor and do whatever he wants . All the while, his ie. ad

  • Making changes to view of comp A must reflect in comp B too

    Hi All,            I have a requirement where the overview page is CPG_MAIN/OPOverview and it has two assignment blocks 1)CPGOE_ABLOCKS/OVELProducts  -  Products assignment block 2)CRMCMP_CND/CONDRECLIST      -   Discount assignment block         If

  • Breakpoints in Ecc 6.0

    Hi all, I am using ecc 6.0 & i am trying to place a breakpoint on a smartform driver program but it is not allowing me to do that. The error which i am getting is 'You cannot set more than 30 breakpoints' .. I have checked the program is active & not

  • Update Consumption Value in EDM Profile From Meter Readings in DM

    Dear, Can it be possible that consumptions values from meter readings (for non interval readings / Non AMR meters) in DM imported / transfered to profiles in EDM. Sohail Ashraf