Popup containing a JPanel with a JComboBox

I like to get a Popup containing a JPanel with a JComboBox and some other stuff.
There are two difficulties:
- it is not possible to use a Combobox with a light weight popup. So I set combobox.LightWeightPopupEnabled(false). Otherwise the combobox popup won't be shown.
- If the user changes the popups size (see code: this.getSize() returns a different dimension because of a new Frame size). The combobox popups won't be shown proper after a while.
Does someone know, why it is not possible to use comboboxes with light weight popups?
Does somebody know, how to fix the size problem?
I am using JDK 1.4.1 for Windows Systems.
  private Popup getPopup(){
    if (popup != null) {
      hidePopup();
    Point p = this.getLocationOnScreen();
    Dimension inputSize = this.getSize();
    Dimension tableSize = tablePopup.getSize();
    if( ( p.y + tableSize.height ) < screenSize.height) {
      // will fit below input panel
      popup = factory.getPopup( this, tablePopup,
                                p.x, p.y + (int)inputSize.height );
    } else {
      // need to fit it above input panel
      popup = factory.getPopup( this, tablePopup,
                                p.x, p.y - (int)tableSize.height );
    return popup;

Ok, it works proper with Windows L&F. So I replaced
private PopupFactory factory =  PopupFactory.getSharedInstance();by
private WindowsPopupFactory factory = new WindowsPopupFactory();

Similar Messages

  • PropertyChangeListener for a JButton that contains a JPanel?

    I created a class that extends from the JButton class. The class contains a JPanel that adds two components to the panel, A JLabel that contains text and a JLabel that contains an icon. Therefore this class is really just a button that contains a JPanel with 2 JLabels added to the panel. (Reason for doing this is it adds layout control to add the 2 components to a panel instead of directly to the JButton) Normally you would do a changepropertylistener to the JButton but because I added the 2 components (JLabel) to a panel and then added the JPanel to the button, the button doesn't notice any change events. How would I detect the PropertyChangeEvent for this cenario?
    thanks,
    Peter Landis

    The solution to the problem is when the instance of the class is created, do a getComponent(0) to get the JPanel component and the do a getComponent(0) to get the JLabel component. Now from here you can add a PropertyChangeListener to the JLabel that you just obtained. The PropertyChangeListener class will look like:
    class RotorItemListener implements PropertyChangeListener
         public void propertyChange(PropertyChangeEvent e)
    System.out.println("CHANGE");
    String name = e.getPropertyName();
    if(name == "text")
    System.out.println("Label changed");
    This will only trap a change that occurs when the label has changed. If you omit the if(name == "text") then when the component is created, a property change event will be triggered which is not what you want. This only traps event that occur only when a change has occurred on the JLabel. Notice that during the instantiation of the component you'll see the text displayed "CHANGE" and not the "Label changed" until the label text has changed.
    Pretty cool huh!

  • Scrolling a custom Component (e.g. JPanel) with overridden paint(Graphic g)

    Hi.
    I&#8217;m creating an application for modelling advanced electrical systems in a house. Until now I have focused on the custom canvas using Java2D to draw my model. I can move the model components around, draw lines between them, and so on.
    But now I want to implement a JScrollPane to be able to scroll a large model. I&#8217;m currently using a custom JPanel with a complete override of the paint(Graphic g) method.
    Screen-shot of what I want to scroll:
    http://pchome.grm.hia.no/~aalbre99/ScreenShot.png
    Just adding my custom JPanel to a JScrollPane will obviously not work, since the paint(Graphic g) method for the JPanel would not be used any more, since the JScrollPane now has to analyze which components inside the container (JPanel) to paint.
    So my question is therefore: How do you scroll a custom Component (e.g. JPanel) where the paint(Graphic g) method is totally overridden.
    I believe the I have to paint on a JViewport instructing the JScrollPane my self, but how? Or is there another solution to the problem?
    Thanks in advance for any suggestions.
    Aleksander.

    I�m currently using a custom JPanel with a complete override of the paint(Graphic g) method. Althought this isn't your problem, you should be overriding the paintComponent(..) method, not the paint(..) method.
    But now I want to implement a JScrollPane to be able to scroll a large model.When you create a custom component to do custom painting then you are responsible for determining the preferredSize of the component. So, you need to override the getPreferredSize(...) method to return the preferredSize of your component. Then scrolling will happen automatically when the component is added to a scrollPane.

  • Popup Menu on JPanel

    Howdy,
    I have a JPanel with various controls on it, like JButton JLabel etc. I'd like to have a popup menu appear from the JPanel regardless of whether the user rightclicks over a JButton or over the JPanel itself. One way this can be done is to trap the rightclick on each control and then pass it on to the JPanel. Is there a simpler solution to this?
    Thanks

    you might be able to override the processMouseEvent method on the JPanel and handle it there. I think that method delegates to the components inward. Not sure.

  • Changing JPanel with button click.

    Hi, I have a class call TOC(Table of Content) which contains all the buttons. One class call MainController. All buttons I add an actionListener which the MainController class will handle. Anothe class which is the main one which contain a JPanel.
    When I click on the button in TOC class, it will go through the MainController class and display the respective JPanel associate with the button.
    Now the problem is how do I change the JPanel in the main class with a click on the button in TOC class?
    Please advise. Thanks in advance.

    Not sure what you mean exactly. However,
    Assuming that your view class is a JPanel, when you create your controller,
    ViewPanel view = new ViewPanel();
    MainController controller = new MainController(viewPanel);
    In MainController track a reference to your viewPanel. Also in viewPanel have a method called setCurrentPanel(JPanel panel). then int he controller's action listener
    public void actionPerformed(ActionEvent ev) {
    JPanel pnl = (JPanel) panelMap.get(ev.getSource().getName());
    viewPanel.setCurrentPanel(pnl);
    I am assuming you have a way of mapping each button to the panel it will use, which is what is in the panelMap. The viewPanel can have a CardPanel layout for the panels it displays and its setCurrentPanel, can bring to front/oradd the specified panel.
    Good luck, hope this helps :-)

  • How to add a JPanel with label and border line

    hi,
    I want a Jpanel with label and border line like this.Inside it i need to have components.Is there a resuable component to bring this directly??
    Any solution in this regards.???
    Label-----------------------------------------------------------
    | |
    | |
    | |
    | |
    | |
    |________________________________________ |

    [url http://java.sun.com/docs/books/tutorial/uiswing/misc/border.html]How to Use Borders

  • I install LION on my mac pro 2008 and it's alway's pop with " there was a problem connecting to the server " Time Capsule" .How can i remove this popup. My Time machine is working fine and also rename it. But the popup keeps on coming with the old name.

    I installed LION on my mac pro 2008 and it's alway's pop with " there was a problem connecting to the server " Time Capsule" .How can i remove this popup. My Time machine is working fine and also rename it with less than 7 karakters. But the popup keeps on coming with the old name.

    I have a BT Infinity router plugged into the Time Capsule, not sure where the radio settings are?
    They are able to use the network settings of the TC i.e. they can connect to the internet via the wifi through the TC but when they try and connect to the AirPort Disk this is where it is not allowing a connection.
    I don;t have the drive shared out at all at the moment, is this necessary?  How do I do this if so?
    I have attached the screen shots of all the settings.
    Thanks again for your help.

  • The report in FI which contains Quantity field with every line item

    Hi Gurus,
    What are the reports in Finance which contains Qty field with every Line Item reports & reports that contains user name & System Id in it along with other informations e.g. G/L, Ar, AP
    Thanks & Regds,
    Santosh Rothe

    Hi
    Using the line item display report you can get the required details by changing layout in the output:
    FBL1N: Vendor line item
    FBL3N: G/L line item
    FBL5N: Customer line item
    VVR

  • XOQ-01950: Cube contains multiple BuildSpecifications with the same name.

    Hi All ,
    While executing the Maintain Cube option it is throwing below issue : Any Clue ?
    XOQ-01950: The AWCubeOrganization for cube "NN_OLAP_POC.MARKET_SALES_CUBE" contains multiple BuildSpecifications with the same name.
    Thanks,
    DxP

    This error should only show up when you create a cube (by importing XML), not when you maintain it. So I will assume that this is what you mean.
    If you import XML that refers to an OLAP object that already exists, then the new definition overrides the old one. The only exception to this rule is the BuildSpecification object. This kind of object is named, but it does not follow these conventions (for messy implementation reasons). If you import XML that has a BuildSpecificaiton with the same name as one that already exists, then you will trigger the error you see. Here is an example of the relevant XML.
    <BuildSpecifications>
    <![CDATA[BUILD SPEC LOAD_AND_AGGREGATE
      LOAD NO SYNCH,
      SOLVE
    ) ]]>
    </BuildSpecifications>The workaround is to delete this section from the XML before importing it.

  • JPanel with Image just doesn't want to show

    Hello,
    i am trying to create a JPanel with a JLabel to which i assign an ImageIcon, but for some reason the JPanel seems not to appear in my JFrame.
    Here's the code: private void jbInit() throws Exception
        NumberListener numListener = new NumberListener();
        frame = new JFrame();
        frame.setTitle("Error Manager");
        frame.setLayout(new GridBagLayout());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        gbc.gridwidth = 1;
        gbc.gridheight = 1;
        gbc.weightx = 1;
        gbc.weighty = 1;
        gbc.gridx = 0;
        gbc.gridy = 0;
        numberList = new JList(numbers);
        numberList.addListSelectionListener(numListener);
        numberList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        JScrollPane listScroller = new JScrollPane(numberList);
        listScroller.setPreferredSize(new Dimension(250, 80));
        frame.getContentPane().add(listScroller, gbc);
        imgPanel = new JPanel();
        imgPanel.setSize(300, 250);
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image img = toolkit.createImage("Somepic.png");
        imgPanel.add(new JLabel(new ImageIcon(img)));
        gbc.gridx = 1;
        gbc.gridy = 0;
        frame.getContentPane().add(imgPanel, gbc);
        frame.pack();
        frame.setVisible(true);
      }

    Sorry forgot to close the code tags...
    private void jbInit() throws Exception
        NumberListener numListener = new NumberListener();
        frame = new JFrame();
        frame.setTitle("Error Manager");
        frame.setLayout(new GridBagLayout());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        gbc.gridwidth = 1;
        gbc.gridheight = 1;
        gbc.weightx = 1;
        gbc.weighty = 1;
        gbc.gridx = 0;
        gbc.gridy = 0;
        numberList = new JList(numbers);
        numberList.addListSelectionListener(numListener);
        numberList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        JScrollPane listScroller = new JScrollPane(numberList);
        listScroller.setPreferredSize(new Dimension(250, 80));
        frame.getContentPane().add(listScroller, gbc);
        imgPanel = new JPanel();
        imgPanel.setSize(300, 250);
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Image img = toolkit.createImage("1_Alpinweiss_III.png");
        imgPanel.add(new JLabel(new ImageIcon(img)));
        gbc.gridx = 1;
        gbc.gridy = 0;
        frame.getContentPane().add(imgPanel, gbc);
        frame.pack();
        frame.setVisible(true);
      }

  • BUG: Popup in page fragment; with many regions and popup binded to backing.

    BUG: Popup in page fragment; with many regions and popup or parent binded to backing bean.
    JDEV11.1.2.1 Popup will not popup.(sometimes works if using RichPopup.Show() in backing bean Java code.)
    I have a bug (Popup will not popup)that only happens when I have more than one of the same region.
    And I have a popup in the page fragment is binded to backing bean.
    My SR guy is out today but we plan to enter one.
    test.jspx
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:f="http://java.sun.com/jsf/core">
        <jsp:directive.page contentType="text/html;charset=UTF-8"/>
        <f:view>
            <af:document title="test" id="d1">
                <af:form id="f1">
                    <af:panelGroupLayout id="pgl1" layout="horizontal">
                        <af:outputText value="BUG JDEV11.1.2.1 and IE7. Broken Popup! If I have a jsff fragment and I have many regions of this fragment."
                                       id="ot2"/>
                        <af:outputText value="Inside the fragment I have a popup. If that popup or its parent are binded to a Backing Bean the popup doesn't work."
                                       id="ot1"/>
                    </af:panelGroupLayout>
                    <!-- with a single region it also works (with bindings in place in fragment). -->
                    <af:region value="#{bindings.taskflowemp1.regionModel}" id="r1"/>
                    <af:region value="#{bindings.taskflowemp2.regionModel}" id="r2"/>    
                    <!--
                    <af:region value="#{bindings.taskflowemp3.regionModel}" id="r3"/>
                    <af:region value="#{bindings.taskflowemp4.regionModel}" id="r4"/>
                    -->
                </af:form>
            </af:document>
        </f:view>
    </jsp:root>region.jsff
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:f="http://java.sun.com/jsf/core">
      <af:group id="g1">
      <!-- If I remove the binding for popop or popup group, the popup works fine. -->
    <!--Working code here
        <af:group id="g2">
          <af:popup childCreation="deferred" autoCancel="disabled" id="p1" >
        -->
           <!-- Problem code here   -->
        <af:group id="g2" binding="#{TestBean.popupGroup}">
          <af:popup childCreation="deferred" autoCancel="disabled" id="p1" binding="#{TestBean.testPopup}"> 
            <!-- End problem code -->
            <af:dialog id="d2" title="Dialog Title">
              <f:facet name="buttonBar"/>
              <af:outputText value="Dialog Contents" id="ot100"/>
            </af:dialog>
          </af:popup>
        </af:group>
        <af:panelGroupLayout id="pgl1">
          <af:panelBox text="Region" id="pb1">
            <f:facet name="toolbar"/>
            <af:commandButton text="showPopupBehavior" id="cb1" >
              <af:showPopupBehavior popupId="p1"/>
            </af:commandButton>
            <af:commandButton text="AdfPage.PAGE.findComponent JavaScript" id="cb2" actionListener="#{TestBean.popupTestJavaScript}"/>
            <af:commandButton text="RichPopup.Show() Java" id="cb3" actionListener="#{TestBean.popupTestJava}"/>
          </af:panelBox>
        </af:panelGroupLayout>
      </af:group>
    </jsp:root>TestBean.java
    package view;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    import oracle.adf.view.rich.component.rich.RichPopup;
    import org.apache.myfaces.trinidad.component.UIXGroup;
    import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
    import org.apache.myfaces.trinidad.util.Service;
    public class TestBean {
        private RichPopup testPopup;
        private UIXGroup popupGroup;
        public TestBean() {
        public void setTestPopup(RichPopup testPopup) {
            this.testPopup = testPopup;
        public RichPopup getTestPopup() {
            return testPopup;
        public void popupTestJava(ActionEvent actionEvent) {
            if(testPopup != null){
                RichPopup.PopupHints ph = new RichPopup.PopupHints();
                testPopup.show(ph);
            }else{
                System.err.println("TestBean.testPopop IS NULL!");
        public void popupTestJavaScript(ActionEvent actionEvent) {
            showPopupTest("r1:0:p1");
        private static void showPopupTest(String popupId) {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            ExtendedRenderKitService service =
                Service.getRenderKitService(facesContext,
                                            ExtendedRenderKitService.class);
            service.addScript(facesContext,
                              "AdfPage.PAGE.findComponent('" + popupId + "').show();");
        public void setPopupGroup(UIXGroup popupGroup) {
            this.popupGroup = popupGroup;
        public UIXGroup getPopupGroup() {
            return popupGroup;
    }

    Thanks that fixed the problem.
    "a user error"
    Well I followed your book! Chapter 6 of the "Oracle Fusion Developer Guide - Working with Bounded Task Flows in ADF Regions". I think this comes back to book writer error. I found almost no mention of BackingBeanScope in this chapter. Don't you think this would be an important note?
    "did you know that there is a Java API (on the RichPopup instance) to launch a popup ?"
    Yes I posted in my code! If you read the above code you would see it there.
    I don't really understand why the scope of the bean has anything to do with af:showPopupBehavior or AdfPage.PAGE.findComponent.

  • Web service response contains SOAP Headers with "mustUnderstand" true

    Hi
    I have a requirement where in I have to consume a web service as adaptive web service model, and while executing the service pass a mandatory parameter to the soap header. We are able to set the mandatory parameter to the soad header. We got the code snippet to do this from a wiki link
    http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-AdaptiveWebService#FAQ-Models-AdaptiveWebService-WhatarethefunctionalgapsofthecurrentAdpativeWSModelImporter%3F
    On executing the service now through web dynpro we are getting the below error
    "Web service response contains SOAP Headers with "mustUnderstand" true which are not handled by the client runtime"
    Any thoughts on how to handle this mustUnderstand attribute with some code snippet? Appreciate all help.
    Thanks,
    KN.

    Hi
    Have you found the workaround?
    Sorry for refreshing topic. Flag mustUnderstand ='1' in response is unussual thing.
    BR

  • I created a photo book in Photoshop elements 11 that contains png files with the invisible backgrounds.  When I export the book to a jpg or a pdf, the png files appear with white backgrounds.

    I created a photo book in Photoshop elements 11 that contains png files with the invisible backgrounds.  When I export the book to a jpg or a pdf, the png files appear with white backgrounds.  Any suggestions on how to fix this? 

    jpg and pdf formats don't support transparency. You need to use a format such as tif, png or psd that does.
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • (bug?)Movie clip contains an object with a z value will not edit the object in place, it goes into a seperate window.

    When a movie clip contains an object with a z value, I can not edit the object in place, it goes into a seperate window.
    This changes the vanishing point relative to the movieclip instead of the stage (allong with everything else).
    This makes it very hard to keep track of where the movieclips will end up when actualy playing the animation.

    I should have explained my situation a little better. I have a machine that's made up of a number of parts, some of them are fairly large and some are quite small. When a user clicks on a part, I want to center that part on the screen and then move whole machine toward the screen until the selected part either fills the screen (for the larger parts) or the part bumps up against the front clip plane (for the smaller parts).
    I didn't think of checking for a collision with the ViewPlatform's TG, thanks for mentioning that. I wasn't sure how the ViewPlatform's location relates to the clipping plane, but I'll dig into it. I'm still learning how the ViewingPlatform, the image plate, and the clipping planes all relate to each other.

  • RGDIR already contains an entry with the same logical key

    Hi Gurus,
    We are getting the error"RGDIR already contains an entry with the same logical key" when we re-run the payroll in ECC 5.0
    Is this a Standard bug in the Payroll program or else configuration error .
    Found some note :776262 related to the same error in 4.0 to 4.7.But not for ECC 5.0.
    Let me know if there are any support packs available...
    Best Regards,
    Srikanth

    Hello Srikanth,
    Regarding your description, it seems there is an inconsistence in the payroll results.
    To analyze the exact problem in the cluster of this employee, You can run the report RPUDIR00.
    Additionally, you can make a test using the standard payroll schema, to see if you get the same error message.
    Kind regards,
    Graziela Dondoni

Maybe you are looking for

  • BI Content Objects

    Hi Experts, I want to install BI Content objects, how to install what are all the steps followed. This version is SAP BI 7.0. Ex:- Sales Overview Infocube all  information including reports this cube, all objects I want to install, how to do, Please

  • Multi-Layered Playlist

    I am wanting to have 3 different playlists on my 4th gen iPod. One for my wife, one for me, and another of songs we both like. After I added the songs on iTunes and imported them onto my iPod, the playlists are only organized by song. Put another way

  • I want to use google as my automatic search engin when i use mozilla

    it does it on another computer how do i make this computer the same

  • Ivr movies

    how do i download ivr based movies to the mac is there a third party patch eon

  • LaCie HD with G5

    I've just bought a LaCie BigDisk and plan to put it directly on top of my G5, will the vibration (when the disk is accessed and powers up) cause any problems for my mac? G5   Mac OS X (10.4.7)