Popup not in specified Component, but in main JFrame

Hi,
how do I make a popup appear inside the Component "owner" that is
given as parameter to the show method?
I have a JFrame containing a JPanel component in a GridBagLayout.
The JPanel has a MouseListener, causing "MousePressed" to show a
popup with a small textfield at the mouse position inside JPanel.
The popup is called as follows:
show(e.getComponent(), JTextField, e.getX(), e.getY());
I also tried giving explicit parameters: show(JPanel, JTextField, 10, 10);
However, the popup is not positioned inside the JPanel, but in the JFrame that
contains the JPanel.
Thanks for any help!
Regards,
Elke

Sorry, my fault: I confused the constructor with the method.
Below is a test code I made.
Thanks again,
Elke
import java.awt.*;
import java.awt.event.MouseEvent;
import javax.swing.*;
public class PopupTest extends JFrame {
private JPanel jContentPane = null;
private JTabbedPane jTabbedPane = null;
private JPanel jpTab1 = null;
private JPanel jPanel = null;
private Popup mousePopup = null;
public static void main(String[] args) {
PopupTest myPopup = new PopupTest();
myPopup.show();
public PopupTest() {
super();
this.setContentPane(getJContentPane());
this.setSize(300,300);
private JPanel getJContentPane() {
if(jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getJTabbedPane(), BorderLayout.CENTER);
return jContentPane;
private JTabbedPane getJTabbedPane() {
if (jTabbedPane == null) {
jTabbedPane = new JTabbedPane();
jTabbedPane.addTab("Tab1", null, getJpTab1(), null);
return jTabbedPane;
private JPanel getJpTab1() {
if (jpTab1 == null) {
jpTab1 = new JPanel();
jpTab1.setLayout(new GridBagLayout());
jpTab1.setName("Tab1");
GridBagConstraints grid1 = new GridBagConstraints();
grid1.gridx = 0;
grid1.gridy = 0;
jpTab1.add(getJPanel(), grid1);
return jpTab1;
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel() {
public void paintComponent(Graphics g) {
super.paintComponent(g);
for(int h = 0;h<100;h++)
for(int w = 0;w<100;w++)
g.setColor(Color.blue);
g.drawRect(w, h, 1, 1);
jPanel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) {
int x = e.getX();
int y = e.getY();
JLabel mouseData = new JLabel("["+x+","+y+"]");
// create popup at mouse position inside the JPanel:
mousePopup = PopupFactory.getSharedInstance().getPopup(e.getComponent(), mouseData, x, y);
// problem: popup not at mouse position inside JPanel, but at position x,y in the JFrame.
// Also tried the following, but that didn't work either:
//mousePopup = PopupFactory.getSharedInstance().getPopup(jPanel, mouseData, x, y);
// Why is the "owner" parameter in the popup constructor ignored?
mousePopup.show();
jPanel.setPreferredSize(new Dimension(100,100));
return jPanel;
}

Similar Messages

  • HT1349 I can not run the scanner in my main user, but only the second user and the same thing with updating apps! Why is this happening???

    I can not run the scanner in my main user, but only the second user and the same thing with updating apps! Why is this happening???

    Welcome to the Apple Community.
    Enter the details of her second account at system preferences> mail, contacts & calendars.

  • I have updated Firefox to 8.0.1 but the main screen still says " You're not on the latest version of Firefox. Upgrade today to get the best of the Web!" What is the problem?

    I downloaded Firefox Setup 8.0.1.exe from the website to my desktop and opened it as an administrator. The available choice (once opened) was to upgrade. When the process was complete my version of Firefox was identified as 8.0.1 but the main screen still said - "You're not on the latest version of Firefox. Upgrade today to get the best of the Web!"

    This - http://www.google.com/firefox - is the old Firefox Start Page used by the Firefox 3.6 and earlier versions of Firefox, I don't think it is being maintained.
    Starting with the Firefox 4 version, Firefox is using a "local" Start Page with the address of '''about:home'''. It looks similar to the old Start Page, but it isn't exactly the same.

  • Main Item not Weight/Vol relevant but adds to the total weight of the order

    Hi,
    I have a situation where the Main item (item category) is marked not weight/Volume relevant but the Sub item is weight/Volume relevant. But when I create a sales order the net weight of sales order includes the weight of the Main item as well.
    Any settings for this?
    regards
    Heshamity

    Hi Heshamity,
    I tested in our system, if the item category is marked as not relevant for weight and volume, it will not be calculated on the net weight of the sales order. In addition, the weight is also 0 at item level.
    Could the issue be reproduced in your system?
    Do you get weight being determined at item level?
    If yes, you could enter debugging mode and set watchpoint at VBAP-BRGEW to trace why it gets filled.
    In SAPFV45P     FORM     VBAP_GEWICHT_VOLUMEN_ERMITTELN
    there exists statment to check the VOV7 setting before moving the weight to XVBAP-BRGEW like
    IF tvap-gwrel = charx.
       CALL FUNCTION 'SD_WEIGHT_VOLUME_DETERMINE'
    Hope it helps.
    Thanks and best regards,
    Smile

  • I have mainstage 3 installed and works 1oo% when connected to the battery, but when connecting to the mains for charging the program crashes. sounds do not obey. is one, even very bad horrible latency. and I need to work on music not only in time but the

    i have mainstage 3 installed and works 1oo% when connected to the battery, but when connecting to the mains for charging the program crashes. sounds do not obey. is one, even very bad horrible latency.
    and I need to work on music not only in time but the battery after that.
    I ask for help please

    Thanks for the swift reply, I have been looking online and a loose plug seems to be somewhat of an issue with many, I hope mine is actually a problem and not what others are experiencing. It's taken me this long to even reach out for the simple fact I HATE being a complainer but this is just horrible.
    Do you have an iPad 3 as well? And is yours not experiencing any issues close to mine?
    Thanks again!

  • HT201342 3 of my email address show up as iCloud but my main address is not there

    3 od my email accounts show up as have @icloud but my main address is not there

    If you go back and look at some of the movie purchases you have made, I mean by going to the movies page where you go to purchase, the ones not in the cloud will say that they are not available in the cloud when purchasing.
    Not all movie studios are on board with iClous yet.

  • ADF Faces to Trinidad migrated app popup not working

    I have 10g version application (ADF bc and jsf) migrated to 11g using automated migration of jdeveloper and this application has lot of popups . for some reason pop ups are not working in the converted app
    if i open a popup programmatically it works okay , but it is not working when used from faces-config.xml ; with dialog:edit etc and usewindow = true - opens in same window
    for this blog post [http://blogs.oracle.com/Didier/2008/12/dialog_not_opening_in_a_popup_1.html] by Didlier , the configuration should be moved to adfc-config.xml file , but looks like that is only required when using rich controls ( mainly task flows) . for now my applicaiton only has trinidad components.
    If i create adfc-config.xml manually and copy all the navigation flows , will it work. i guess i need to specify that somewhere for the application to start using this file
    I thought i will download the converted srdemo but the link to converted srdemo from here [http://www.oracle.com/technetwork/developer-tools/jdev/migration-082101.html]
    is not working
    if anybody have suggestions please advise , thanks for your time
    Regards

    There seems to be a broader problem here in that the client-side validation is not respecting sub-form boundaries. Any post on the page causes all the validations to run, not just the ones in the subform that contains the control the invoked the post.
    Also, with the field marked as immediate, will I have problems with a "Cancel" button marked as immediate? Will the validation on the immediate field take place prior to the navigation invoked by the Cancel button?
    Thanks.

  • In Unix, main JFrame focus not regained after modal dialog exit.

    Hi all,
    I'm new to this forum so hopefully this is the right place to put this question.
    I have a relatively simple GUI application written in Java 6u20 that involves a main gui window (extends JFrame). Most of the file menu operations result in a modal dialog (either JFileChooser or JOptionPane) being presented to the user.
    The problem is that when running on Unix (HPUX), the process of changing focus to one of these modal dialogs occasionally results in a quick flash of the background terminal window (not necessarily that used to launch the Java), and the process of closing the modal dialogs (by any means, i.e. any dialog button or hitting esc) doesn't always return focus to the main extended JFrame object, sometimes it goes to the terminal window and sometimes just flashes the terminal window before returning to the main JFrame window.
    I think the problem is with the Unix window manager deciding that the main focus should be a terminal window, not my Java application, since the problem occurs in both directions (i.e. focus from main JFrame to modal dialog or vice versa).
    In most cases of JOptionPane, I DO specify that the main extended JFrame object is the parent.
    I've tried multiple things since the problem first occured, including multiple calls to a method which calls the following:
    .toFront();
    .requestFocus();
    .setAlwaysOnTop(true);
    .setVisible(true);
    ..on the main JFrame window (referred to as a public static object)...
    just before and after dialog display, and following selection of any button from the dialogs. This reduced the frequency of the problem, but it always tends to flash the terminal window if not return focus to it completely, and when it occurs (or starts to occur then gets worse) is apparently random! (which makes me think it's an OS issue)
    Any help appreciated thanks,
    Simon
    Self-contained compilable example below which has the same behaviour, but note that the problem DOESN'T occur running on Windows (XP) and that my actual program doesn't use auto-generated code generated by a guibuilder:
    * To change this template, choose Tools | Templates 
    * and open the template in the editor. 
    package example;  
    import javax.swing.JOptionPane;  
    * @author swg 
    public class Main {  
         * @param args the command line arguments 
        public static void main(String[] args) {  
            java.awt.EventQueue.invokeLater(new Runnable() {  
                public void run() {  
                    new NewJFrame().setVisible(true);  
    class NewJFrame extends javax.swing.JFrame {  
        /** Creates new form NewJFrame */ 
        public NewJFrame() {  
            initComponents();  
        /** This method is called from within the constructor to 
         * initialize the form. 
         * WARNING: Do NOT modify this code. The content of this method is 
         * always regenerated by the Form Editor. 
        @SuppressWarnings("unchecked")  
        // <editor-fold defaultstate="collapsed" desc="Generated Code">  
        private void initComponents() {  
            jMenuBar1 = new javax.swing.JMenuBar();  
            jMenu1 = new javax.swing.JMenu();  
            jMenuItem1 = new javax.swing.JMenuItem();  
            jMenu2 = new javax.swing.JMenu();  
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);  
            jMenu1.setText("File");  
            jMenuItem1.setText("jMenuItem1");  
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {  
                public void actionPerformed(java.awt.event.ActionEvent evt) {  
                    jMenuItem1ActionPerformed(evt);  
            jMenu1.add(jMenuItem1);  
            jMenuBar1.add(jMenu1);  
            jMenu2.setText("Edit");  
            jMenuBar1.add(jMenu2);  
            setJMenuBar(jMenuBar1);  
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());  
            getContentPane().setLayout(layout);  
            layout.setHorizontalGroup(  
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                .addGap(0, 400, Short.MAX_VALUE)  
            layout.setVerticalGroup(  
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)  
                .addGap(0, 279, Short.MAX_VALUE)  
            pack();  
        }// </editor-fold>  
        private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {  
            int result = JOptionPane.showConfirmDialog(this, "hello");  
        // Variables declaration - do not modify  
        private javax.swing.JMenu jMenu1;  
        private javax.swing.JMenu jMenu2;  
        private javax.swing.JMenuBar jMenuBar1;  
        private javax.swing.JMenuItem jMenuItem1;  
        // End of variables declaration  
    }

    It won't comfort you much, but I had similar problems on Solaris 10, and at the time we traked them down to a known bug [6262392|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6262392]. The status of this latter is "Closed, will not fix", although it is not explained why...
    It's probably because the entry is itself related to another, more general, bug [6888200|http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=b6eea0fca217effffffffe82413c8a9fce16?bug_id=6888200], which is still open.
    So it is unclear whether this problem will be worked upon (I suspect that yes) and when (I suspect that... not too soon, as it's been dormant for several years!).
    None of our attempts (+toFront(...)+ etc...) solved the issue either, and they only moderately lowered the frequency of occurrence.
    I left the project since then, but I was said that the workaround mentioned in the first bug entry (see comments) doesn't work, whereas switching to Java Desktop instead of CDE reduced the frequency of the issues (without fixing them completely either) - I don't know whether it's an option on HPUX.
    Edited by: jduprez on Jul 9, 2010 11:29 AM

  • Popup Window in same component

    Hi All
    I have created a component that displays graph information.
    The users require a print verion of the view that shows the graph data.  I have created a new viewset and view in my component but i cannot display it in a popup.
    Here is the code.
    data: lr_popup type ref to IF_BSP_WD_POPUP.
      IF lr_popup IS NOT BOUND.
        lr_popup = me->comp_controller->window_manager->create_popup(
                              iv_interface_view_name = 'ZAGRI_MILK_REPS/MainWindow'
                              iv_usage_name          = 'printFriendlyPopup'
                              iv_title               = 'Popup' ).
        lr_popup->set_window_width( iv_width = 600 ).
      ENDIF.
      lr_popup->set_on_close_event( iv_view = me iv_event_name = 'EH_ONRETURN').
      lr_popup->open( 'OPEN_PRINT_POPUP' ).
    Has anyone done this
    any help would be great
    Thanks

    Got this sorted
    I had to create a new window, add the viewset to the window.
    I then added the new window to the component interface.
    I then created a new component usage that uses my new window and then the popup worked.

  • ADF Popup not showing at fragment load

    Hi,
    I am calling a bean method in getter of command link at the load by binding it to a command link defined in bean, so when this fragment is called from other fragment then
    in this method i m doing some checks ,and based on particular condition i have popup.show but it doesnt show the popup and code is not raising any exception.
        public RichCommandLink getC1() {
            populatedata();
            return c1;
      Now in populatedata ,I have popup shown for some conditions but when fragment is getting called for first time it doesnt show the popup ,but same populatedata is called from button on the fragment 
      so when i click on button ,this popup is shown properly.
    So as I understand first time getC1 gets fired when fragment was getting loaded ,so how to make sure popup is displayed during that ..
    public void populatedata()
    if ....
                        System.out.println("showing popup");                   
                       RichPopup.PopupHints p2 = new RichPopup.PopupHints();                   
                         p1.show(p2);
                        System.out.println("after showing popup");
    In logs i see both system out messages , can you guys suggest me how to get this popup displayed when fragment loading for first time and getter for c1 is getting fired.
    Jdeveloper version :11.1.2.3.0
    Regards,

    Hi,
    have you debugged the method call to prove that it is called at all? Instead of a component binding as a trigger, can you try a value property e.g. on a hidden output text component?
    Since you are on JDeveloper 11g R2, the use of JSF 2 system events also becomes possible. The system event would be added to a component on the fragment (e.g. the fragment root layout container) and then listen for the render pre-render phase.
    see: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/108-triggerpopupinregion-1994836.pdf
    Frank

  • "HH_GET_WIN_TYPE has not been specified" in Robohelp 9 HTML

    Hi there. I know this error has been around before, but I have not found any solution to fix my problem. I imported a Robohelp x5 project into Robo 9 HTML, and everything seemed to import fine. I compiled the project, and everything works except for when I try to go to a topic by clicking on its TOC link. I then get the "hh_get_win_type has not been specified" error, and if I click on the message, it'll eventually go away and then the topic will correctly open. (Any links in the main frame work properly with no error message.) Obviously I need to fix this before sending it out. The specific window it mentions is not used in the project settings any more, so I just can't delete it. Does anybody have a suggestion for this? Thanks, Mark.

    Something you mentioned in your original post is begging a question. You said you couldn't delete the window from the project despite it not being used anywhere. Is that because it won't let you, or some other reason. If it won't let you, there must still be a reference to it somewhere in your project. You could try deleting your projectnam.cpd file and reopening the project.
      The RoboColum(n)
      @robocolumn
      Colum McAndrew

  • Getting an error "file not supported/necessary componant not installed

    Any help on a error im getting, file not supported/necessary componant not installed

    Jesse,
    From what you have described for Test 1, 2, and 3, I get the impression that you are OK with a new project, but that your are having problems with these saved projects.
    At this point, I think it important for you to keep a log of the project details to avoid confusion.
    Test #3.
    I am going to start with that Test 3 that was a new project, but almost successful (made it to about the 93% mark before transcoding error set in). I suspect that different factors are involved here than what brought you to the forum. Focus Step 12 in Test #3 where you said that you edited the movie line. How did you edit..added transitions, effects, titles, other? What was the length of the Timeline content? What DVD menu template did you use (how many main menu pages and how many scene menu pages)? When you went to Share/Disc/Disc and the burn dialog there, what did it say in the Quality Area of the burn dialog for Space Required and Bitrate? Also, at this time what did your computer show for available RAM and free hard drive space? Where were your scratch files (Edit Menu/Preferences/Scratch Disks) directed and did that drive have enough free space to meet the task?
    Test #1.
    Your success with this new project was expected. It would be nice to know what kind of .avi that you used, but, whatever they were, they worked to give you your DVD-VIDEO. What was the length of the Timeline content. What DVD menu template did you use (how many main menu pages and how many scene menu pages)? And, I am correct in assuming that this was an independant project...different source media and edits than # 3?
    Test #2.
    Here I believe is the true issue that brought you here.
    When you say "Open existing project", it this the project from Test #1 which you closed and saved? Or, is it another existing project?
    If you are not doing so now, please do Test #2 using the saved project prel from Test #1.
    Now, I would like you to open Premiere Elements 4, in the Welcome Screen select the "Open Project" Folder, in the dialog that opens click on the Test #1.prel. The project should load, and you should find yourself in the program's Edit workspace. OK, so far? If so, what do you do next?
    I was slow in typing again, so I hope that I am not out of sync with other messages between you and Hunt.
    ATR

  • An RFC destination could not be specified for the logical system

    Hello Experts,
    I am trying post goods receipt in EWM system in a simple inbound delivery process. It is not getting posted back in ECC. I have my RFC connection setup properly(I assume since I was able to transfer inbound delivery to EWM in first place).It seems some setting related to Outbound queue in EWM is missing.Can anyone tell me in detail what settings are required?Is it something to do with WE20 transaction?I am not sure what settings should be done there.The error log is as below-
    An RFC destination could not be specified for the logical system
    SB3CLNT011
    Message No. B1550
    Diagnosis
    An RFC destination should be specified for the logical system SB3CLNT011.
    This could not be done in this case. SB3CLNT011 is not your local logical system
    and this system is not included in the relevant Customizing tables.
    Procedure
    Check:
    RFC
    destination
    Port
    definitions
    oubound partner profile of
    message type SYNCH for this logical system
    Regards,
    Khushboo

    Hi Oritra and Suraj,
    I have checked remote connection in SM59 for both the logical system.It works fine.I understand this is more of a technical issue,but I don't have A local basis team to help me so reaching out to experts here.Can you guide me what technical settings could be checked for EWM-->ECC connection?When I execute BD82 for SB3CLNT011 it shows me green status with message "No messages have been defined for the selection conditions in the model".
    Although when I do this for EWM logical system SB3CLNT012 it shows me this with all green status-
    System SB3CLNT011 as a partner type already exists
    System SB3CLNT012 as a partner type already exists
    Port A000000018 with RFC destination SB3CLNT011 already exists
    Outbound parameters for message type SHP_IBDLV_CHANGE SHP_IBDLV_CHANGE01 already
    Outbound parameters for message type SHP_IBDLV_SAVE_REPLICA SHP_IBDLV_SAVE_REPLI
    Outbound parameters for message type SYNCH SYNCHRON already exist
    Am I missing something in WE20?
    Regards,
    Khushboo

  • I open iWeb but the main window doesn't open/appear on screen. The little windows like the inspector and font windows appear. Can anyone help?

    I open iWeb but the main window doesn't open/appear on screen. The little windows like the inspector and font windows appear. Can anyone help?

    Try the following:
    1 - delete the iWeb preference file, com.apple.iWeb.plist, that resides in your
         User/Home/Library/ Preferences folder.
    2 - delete iWeb's cache file, Cache.db, that is located in your
    User/Home/Library/Caches/com.apple.iWeb folder (Snow Leopard and Earlier).
    3 - launch iWeb and try again.
    NOTE:  In Lion and Mountain Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
    OT

  • Primary index does not exist in database but shows in SE14?

    I added a couple of key fields to a Z table and activated it. Every thing went well - adjusted it with SE14 also.
    When I checked the Runtime object - it is OK.
    When I checked Database Object, it is showing that the Primary Index does not exist in Database but SE14 says that the Priamry Index exists in Database.
    Please advise how to correct this. I saw another psoting when I searched per this error message: "Indexes: Inconsistent with DDIC source" . It tells to create this index at Database but need to know the steps.
    pl advise.
    (reposting here)
    Edited by: Venkatabby on Mar 26, 2008 4:05 PM

    hi,
    To create a index for a table,
    go to se11->click on Indexes tab and create  a primary index.
    Indexes speed up data selection from the database. They consist of selected fields of a table, of which a copy is then made in sorted order. If you specify the index fields correctly in a condition in the WHERE or HAVING clause, the system only searches part of the index (index range scan).
    The system automatically creates the primary index. It consists of the primary key fields of the database table. This means that for each combination of fields in the index, there is a maximum of one line in the table. This kind of index is also known as UNIQUE.
    If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVINGclauses, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
    You create secondary indexes using the ABAP Dictionary. There you can create its columns and define it as UNIQUE.
    reward points if useful.
    regards
    sandhya

Maybe you are looking for

  • "Remotely Control LabVIEW Over the Web "in LabView 6.0

    Hello, is it possible that I realize "Remotely Control LabView Over the Web" in LabView6.0 ? Thanks a lot!

  • Airport extreme flashing amber but still have internet

    My airport extreme is flashing amber but I still have an internet connection. Should I be concerned?

  • Help on MDB

              No response from ejb group, try if i have any luck here. Thanks in advance for           any suggestion.           >Hi,           >           >I have a couple MDBs that need the producer pool and other resources           >that are         

  • Search for line of code in a program

    I have written a program and from within this program I need to check whether a line of code exists in another program. Anyone tried this before? I need a little help getting it done.

  • How do i find my earlier question about firefox?

    posed a question and can't find it back. The question was: installed ff 4, and everytime after opening the computer I get an update notification regarding ff 4. However - the update fails to connect with the mozilla server. Keeps on trying eternally.