Problem removing components from JLayeredPane

Hi all,
I have a problem showing and hiding components on a JLayeredPane. It goes Something like this:
In my application I have a button. When this button is pressed I use getLayeredPane to get the frames layered pane. I then add a JPanel containing a number of labels and buttons onto that layered pane on the Popup layer. The panel displays and funcitons correctly.
The problem comes when I try to remove the panel from the layered pane. The panel does not dissappear and I am no longer able to click on anything else in the frame!
If anyone has any ideas how to get around this or what the problem might be I'd be very greatful to hear it. Sample code follows:
      * Called when the button on the frame is pressed:
      * @param e
     public void actionPerformed(ActionEvent e)
                JLayeredPane mLayredPane = getLayeredPane();
          int x = 0, y = 0;
          Container c = this;
          while (true)
               c = c.getParent();
               if (c != null)
                    x += c.getLocation().x;
                    y += c.getLocation().y;
                    if (c instanceof JRootPane)
                         break;
               else
                    break;
          mPanel.setBounds(x, y, 235, 200);
          mLayredPane.add(mPanel, JLayeredPane.POPUP_LAYER);
//And when a listener fires from the panel I use
mLayredPane.remove(mPanel);
//To remove it from the layered pane and in theory return the
//app to the state it was before the panel was displayedThanks again...

The problem is you only removed it within the program, without actually removing it from the display. If that makes any sense, or whether thats your problem at all.
If you are only using this line.
mLayredPane.remove(mPanel);
I think if you tell it to repaint and revalidate it should work, though i have never used LayeredPane.
mLayredPane.repaint();
mLayredPane.revalidate();

Similar Messages

  • Hi I am having problems removing mail from trash folder. Can anyone help please

    Hi I am having problems removing mail from trash folder. I can send mails to the folder but cannot delete them permanently from the trash folder. I am using Iphone 3G and anm up to date with OS. Can anyone help please

    Check that there isn't a different Trash folder to the one with the proper Trash symbol on it.
    If you see one in your list of folders rather than a separate one, highlight it, then click on Mailbox...Use this mailbox for...Trash

  • I am having problem removing sim from E51

    I have problems removing sim from my E51. it seems. its very tight there.

    Did you already try these steps?
    Restart the iPhone.
    Try another means of reaching the activation server and attempt to activate.
    Try connecting to a known-good Wi-Fi network if you're unable to activate using a cellular data connection.
    Try connecting to iTunes if you're unable to activate using Wi-Fi.
    Restore the iPhone.
    If you receive an alert message when you attempt to activate your iPhone, try to place the iPhone in recovery mode and perform a restore. If you're still unable to complete the setup assistant due to an activation error, contact Apple for assistance.
    copied from iOS: Troubleshooting activation issues

  • Remove Components from Library

    I'm new to Catalyst, so this might be a stupid question.
    I created a bad datalist and as soon as I realized my error I deleted it from the Artboard, but it is still in my Library. Now every time I run the project I get an alert that says that DataList1 is missing a required part and will produce an error.
    I don't need DataList1 and I'm not really interested in fixing it. In the current build of the application, is there a way to just remove this component from my library so that I don't have to deal with the error anymore?
    Thanks.

    Currently you cannot remove components from the library panel, but this is something we are working on. There is a temporary solution though: switch to code view and you'll see a panel on the right side of the screen that shows all the files in your project. In the components folder there should be a DataList1.mxml file. Right click on it and choose delete.
    Note that if you follow the above steps and delete a component that is used elsewhere in your project, your application won't compile.

  • Having problems removing tags from script.

    I'm not using the browser to run Adobe Story, but the Desktop version from my iMac.  Cmd + Double Click works, but once every 30 times.  Is anyone else having this problem removing tags from a script?

    There are other ways to remove tags from a script
    From Tagging Panel:
    - Open Tagging Panel from View Menu
    - Click on Edit button. Here you have the option to delete individual tag-items or remove all from the scene.
    From File Menu
    - Open File - Tagging menu
    Here you will find the options to delete all/manually added/automatically added tags.

  • Problem removing folder from Lightroom

    HI,
    I'm new to Lightroom (using 5) and I am trying to get some photo uploads organized. When I imported them, they came in a folder that was poorly organized so I moved them into folders that I preferred. That was fine. BUT now the original folder in lightroom is empty (I deleted from finder after emptying it) and when I remove it from my lightroom ALL the other folders go with it. The funny part is, the total picture count still shows that all the pictures are in lightroom and accounted for, but the folders are no longer there and accessible.
    I have attached a screen shot of the folders. I would like to remove the 2014 folder at the top, but when I do, the desktop folder and everything under it goes as well. Why? And how do i prevent that from happening? THANKS!!
    Ultimately, I would like to move the 2014 folder from being on the desktop as well.
    I

    Your lack of tact was a little bit insulting, regardless of when it happened. No big deal though. I digress.
    Since you cannot view folders in iTunes, you cannot delete folders thru iTunes.
    You could put all the songs you want to delete into a playlist then select all the songs and Command Delete to delete them all at once.
    That's the point. There should be an easier way. But putting them into a playlist before deleting them would be even more work than just deleting them the first time you click them. So this isn't really helpful either.
    Ed's answer was helpful because he addressed the concerns of the original poster. But it also illustrated the need for iTunes programmers to include a feature to remove a folder from your iTunes library as easily as you can add them. If the best way to remove 200GB worth of music from your itunes library is to change the file extensions, then click to delete every single file with an exclamation point next to it; there is quite simply a flaw in design.
    Apple iTunes programmers need to make the adjustment. Right next to the "File" command: "Add folder to library", you could have a command to "Remove folder from library."  Or a "Manage Library" option would be great. Itunes obviously knows what folders it's library consists of so why not allow it to populate a list of them with the option to deselect undesired folders? Why hasn't this been done in one of the numerous iTunes updates? Is it really that hard to understand?

  • Problem removing components not a problem of revalidate

    ello everybody i'm trying to make a chart made of buttons in which every button press removes the pressed button, adds a TextField saves the string that was entered and than adding it as a label of a new Button instead of the one removed. the problem with the code is when i a button it removes the last button that was added
    from the bottom right corner
    import javax.swing.JButton;
    import java.awt.GridLayout;
    import java.awt.TextField;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import javax.swing.JFrame;
    public class SudokoChart{
                    private JFrame frm;
                    private JButton btn;
         private TextField txt;
         private String label = null;
         private static final int DIMENSION = 9;
         private GridLayout chart;
      public class InnerHandler implements ActionListener{
            public void actionPerformed(ActionEvent e){
                    if (e.getSource() instanceof JButton) {
                         btn = (JButton)e.getSource();
                                                         frm.list();
                        //chart.removeLayoutComponent(btn);
                        frm.remove(btn);
                        frm.validate();
                        txt  = new TextField();
                         frm.add(txt);
                         frm.pack();
                         frm.setVisible(true);
                         txt.addKeyListener(new KeyListener(){
                              public void keyPressed(KeyEvent e) {
                                   if(e.getKeyChar() == KeyEvent.VK_ENTER){
                                   label  = txt.getText();
                                   txt.setText("");
                                   frm.remove(txt);
                                   frm.validate();
                                   btn.setText(label);
                                   frm.add(btn);
                                   frm.validate();
                                   frm.pack();
                                   frm.setVisible(true);
                                   public void keyReleased(KeyEvent arg0) {}
                                   public void keyTyped(KeyEvent arg0) {}
         public SudokoChart(){
              frm = new JFrame("Sudoko Solver");
              chart = new GridLayout(DIMENSION,DIMENSION);
              frm.setLayout(chart);
         public void launchFrame(){
                 boolean cont = true;
           for(int row = 0; row < DIMENSION; row++){
                for(int col = 0; col < DIMENSION; col++){
                     //compare between the action button point to  array button point (not related to
                     //the code)
                     btn = new JButton("Push to Enter");
                     //       butpoint[index] = btn; 
                    cont = frm.add(btn).contains(btn.getLocation());
                    System.out.println(cont);
                    //butpoint[index].setLocation(btn.getLocation());
                    // System.out.println(butpoint[index].getLocation());
                     //System.out.println(btn.getLocation());
                     //index++;
                    //  butpoint[index] = btn;
                     //System.out.println(myButton.objCnt);
                     //frm.add(btn,chart,myButton.objCnt);
                     frm.pack();
                     frm.setVisible(true);
                     btn.addActionListener(new InnerHandler());                
         public static void main(String args[]){
              SudokoChart sc = new SudokoChart();
              sc.launchFrame();

    It's an interesting way to go about this, but I'm not sure that I'd want to do it this way. Anyway, one way to possibly solve this problem is to use a 2D grid of JComponent that holds the JButtons, and then swap out your selected JButton for a JTextField, then remove all the JComponents from the container, and then re-add them using your GridLayout and your 2D array to add the components in the correct order.
    Another way to do the same thing is to use a grid of a class that holds a JPanel that uses CardLayout that displays a JButton and on button press swaps this for a JTextField.
    There are probably many ways to do what you want, and I'm not saying that either of my suggestions are best.
    Edit: by the way, don't mix Swing and AWT components in the same app. Your TextFields should be JTextFields.
    Edited by: Encephalopathic on Oct 16, 2009 2:39 PM

  • Problem Removing FocusManager from Memory

    Ok, so I have a class that I use as a menu for my program. It has some Flash components and an instance of FocusManager in it. My base class instantiates this class collects the data from the user via the components and then removes the class and continues on with the program. The problem is that after I remove it and move on it is still being held in memory. The file I am using now was created in Flash CS4 and I then I run the profiler on it in Flash Builder 4. After I take the two snap shots and look at the loitering objects I can see that the FocusManager is still there and it is keeping my class there. Here is what the class looks like (I made it simple test one that does what the class from my application is doing):
    package
    import fl.managers.FocusManager;
    import flash.display.Sprite;
    public class TestMenu extends Sprite
      private var fm:FocusManager;
      public function TestMenu()
       init();
      private function init():void
       //Add code
      public function activateFM():void
       fm = new FocusManager(this);
      public function clearFocus():void
       fm.deactivate();
       fm = null;
    Is there something else that I am not doing? If anyone has some insight into this I would greatly appreciate it.

    What I meant is that instead of using whatever erase functionality (I wouldn't know one), the code inside the function modules of FG1 should clear all global data with CLEAR and REFRESH statements before returning to the calling program. Even better would be to not use any global data in FG1 in the first place, if possible, rather work with local data declarations only inside the function modules.
    Thomas

  • Can You remove Layers from JLayeredPane?

    Hi,
    Can you remove a layer that you once added to a JLayeredPane?
    I am trying to use the "remove" method in the api.
    I add a layer like this:
    r_lp.add(r_close_but, new Integer(2));
    But when i try to remove it like this:
    r_lp.remove(2);
    i get the following:     
    ArrayIndexOutOfBounds Exception: No such child 2
    Why?
    is there a way to achieve what i want, to delete the layer?
    thanks

    Hi Axia,
    You cannot remove a layer from the JLayeredPane, only the components added to the JLayeredPane using remove(int) where int is the indexed component from this pane. This is the absolute index, ignoring layers.
    So you just need to do r_lp.remove(1) assuming there is only one component added to the pane.
    nes

  • Problem removing rows from JTable

    Hello,
    I'm having an issue with a JTable that I'm using. At one point in my application, I want to remove all the rows from the table and regenerate them (from a database). When I try to remove the rows and do nothing else, they remain in the table. The rows are being removed from the model, as I have verified this in code, but the display does not refresh at all.
    I am using custom renderers to change the background color of a cell based on its value, and I disabled them to see if that was the problem, but alas, it is not.
    Any suggestions or ideas why this may be occurring?

    I am using model.setRowCount(0); to clear the model, however the display never refreshes. Then you are doing something wrong because its that simple. Only a single line of code is required.
    Perhaps I should have included this in my original post.Actually, you should have included demo code in your original post. That way we don't have to guess what you are doing.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Removing components from  a  J panel Help?

    I have a J Panel which has on it a stack of 10 components which are composed
    of either jComboboxes or textfields. Duridng program operation I need to clear the panel and then
    add the components again in different locations depending on user selection.
    Problem is I can't seem to get rid of the comboboxes. I am trying a removeAll and then
    reinitializing/rebuilding with all text fields but the combobox won't go away.
    I have used various combinations of
    Even if I just do the removeAll the underlying panel jPanel2 does not clear itself completly
    jPanel2.validate();
    jPanel2.invalidate();
    jPanel2.doLayout();
    Nothing seems to work yet
    Help??

    You can try remove () and then call repaint, unless you've done that...

  • Problem removing Objects from the stage in Flash CS4 (AS3.0)

    I have a problem with this code:
    this.addEventListener(Event.ENTER_FRAME, vanish);
    function vanish(event:Event):void{
         if(character_mc.hitTestObject(vanish_mc)){
              vanish_mc.parent.removeChild(vanish_mc);
    There are two overlapping objects on my stage: character_mc and vanish_mc.
    As soon as i start the scene[Ctrl+Enter] vanish_mc is VISUALLY removed. But the code still sees a collision somehow. How can i Entirely remove the object vanish_mc?
    Thank you for help and advice.

    Ah I think the problem is what my problem not which I proposed, my bad I was trying to keep it simple.
    the remove code in my problem actually looks like this:
    if(character_mc.hitTestObject(this["dollar_mc_"+String(i)])){
         removeChild(this["dollar_mc_"+String(i)]);
    I wanted it to be that way so I could add infinite "dollar_mc_" ' s without writing myself to death with code and or getting confused.
    Imagine it like a game where a character it picking up dollars, which would disappear once they intersect.
    And that exactly is what gives me that argument.
    Do you know a way i could write this code, or do you suggest to leave it that way...because it does run and work im just getting this argument while debugging.
    Thank you for all the help~

  • Problem removing children from within an event handler

    I'm trying to remove a movie clip from an onComplete handler.
    When I try to do this I get the following error
    "ArgumentError: Error #2025: The supplied DisplayObject must
    be a child of the caller."
    The point where my loader is complete is the time that I have
    to remove this movieclip.
    Would any body be able to tell me what the error means and
    help me with a way around it?
    Thanks
    dub

    You can always do it this way -- doesn't matter which display
    list the object is in.

  • Problem removing bundles from group with ZLMAN

    I am having trouble removing a bundle from a bundlegroup with the zlman utility. The syntax I am using seems correct and the groups and bundle name are also.
    Here is the command and it's output from the command with the debug option: (if I use a bogus name for the package the output will tell me that the bundle was removed successfully :-)
    This ZLM72IR2 with Hot-Patch 3
    Any ideas?
    Thanks
    command:
    zlman bgr -U administrator -P xxxxxx -V -d Patches/Servers/sles10-sp1/Pre-Prod-security patch-slesp1-yast2-core-4623_SLES10-SP1-Updates
    output:
    com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIFault={_Message=An error occurred while trying to remove the grouping data.,_Type=5}
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:274)
    at java.lang.Class.newInstance0(Class.java:308)
    at java.lang.Class.newInstance(Class.java:261)
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIFaultMarshaler.deserialize(CoreAPIFaultMarsh aler.java:35)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:433)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:410)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:372)
    at com.sssw.jbroker.web.core.InputStreamImpl.readObje ct(InputStreamImpl.java:278)
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIBinding_Stub.removeMembers(CoreAPIBinding_St ub.java:2682)
    at com.novell.zenworks.zlman.commands.Commands.groupR emove(Commands.java:598)
    at com.novell.zenworks.zlman.commands.BundleCommands. execute(BundleCommands.java:1286)
    at com.novell.zenworks.zlman.ZLMan.main(ZLMan.java:28 0)
    Caused by: com.sssw.jbroker.web.portable.ApplicationException
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIBinding_Stub.removeMembers(CoreAPIBinding_St ub.java:2689)
    ... 3 more
    [5] Fatal Error: An error occurred while trying to remove the grouping data.

    brunold,
    I created a bundlegroup called Testbundle directly under the /Bundles container and tried to remove a couple of different patches. The results were the same. My server is SLES10SP2 64-bit by the way.
    Thanks,
    Frank
    zlman bgr -U administrator -P dnctl2RA -V -d Testbundle patch-slesp1-915resolution-4728_SLES10-SP1-Updates
    com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIFault={_Message=An error occurred while trying to remove the grouping data.,_Type=5}
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:274)
    at java.lang.Class.newInstance0(Class.java:308)
    at java.lang.Class.newInstance(Class.java:261)
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIFaultMarshaler.deserialize(CoreAPIFaultMarsh aler.java:35)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:433)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:410)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:372)
    at com.sssw.jbroker.web.core.InputStreamImpl.readObje ct(InputStreamImpl.java:278)
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIBinding_Stub.removeMembers(CoreAPIBinding_St ub.java:2682)
    at com.novell.zenworks.zlman.commands.Commands.groupR emove(Commands.java:598)
    at com.novell.zenworks.zlman.commands.BundleCommands. execute(BundleCommands.java:1286)
    at com.novell.zenworks.zlman.ZLMan.main(ZLMan.java:28 0)
    Caused by: com.sssw.jbroker.web.portable.ApplicationException
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIBinding_Stub.removeMembers(CoreAPIBinding_St ub.java:2689)
    ... 3 more
    [5] Fatal Error: An error occurred while trying to remove the grouping data.
    zlmprd1:/var/opt/novell/zenworks/scripts/movepatches # zlman bgr -U administrator -P dnctl2RA -V -d Testbundle patch-slesp1-915resolution-4728_SLES10-SP1-Updates
    com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIFault={_Message=An error occurred while trying to remove the grouping data.,_Type=5}
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:274)
    at java.lang.Class.newInstance0(Class.java:308)
    at java.lang.Class.newInstance(Class.java:261)
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIFaultMarshaler.deserialize(CoreAPIFaultMarsh aler.java:35)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:433)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:410)
    at com.sssw.jbroker.web.soap.LiteralEncodingStyle.rea dObject(LiteralEncodingStyle.java:372)
    at com.sssw.jbroker.web.core.InputStreamImpl.readObje ct(InputStreamImpl.java:278)
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIBinding_Stub.removeMembers(CoreAPIBinding_St ub.java:2682)
    at com.novell.zenworks.zlman.commands.Commands.groupR emove(Commands.java:598)
    at com.novell.zenworks.zlman.commands.BundleCommands. execute(BundleCommands.java:1286)
    at com.novell.zenworks.zlman.ZLMan.main(ZLMan.java:28 0)
    Caused by: com.sssw.jbroker.web.portable.ApplicationException
    at com.novell.zenworks.zlman.services.coreapi.admin.C oreAPIBinding_Stub.removeMembers(CoreAPIBinding_St ub.java:2689)
    ... 3 more
    [5] Fatal Error: An error occurred while trying to remove the grouping data.

  • Problem removing package from AUR

    hi, ive been using avant window navigator, the bzr version from the AUR.  after a system update it stopped working and i want to try something else out anyway, but when i try to remove it i get
    checking dependencies...
    error: failed to prepare transaction (could not satisfy dependencies)
    :: awn-extras-bzr: requires avant-window-navigator-bzr
    is there a way i can manually delete it?

    pacman -Rsc avant-window-navigator-bzr
    That will remove avant-window-navigator-bzr and anything that depends on it.

Maybe you are looking for

  • Condition types  Repeating

    Hi All I have created new condition types and creating SALES ORDER with IDOC . If there are two mateials the second material will have both first material condition types and second material condition types Example First material condition type    va

  • Write text with cl_gui_dialogbox_container

    Hi all, I have a dialogbox container cl_gui_dialogbox_container and I need a way to write something inside of it(WRITE 'hello world'), without using alv classes. Are there some classes to use? Should i create a dynpro? can you help me? Thanks. Tony

  • Labview performance suffering with analog input

    Hello, I am using a PCI-6036E and a cDAQ-9172 with LabView 8.0. I have created a VI that systematically writes four different digital outputs, three to the PCI-6036E and one to the cDAQ-9172. Just recently I added a thermocouple to the mix, using an

  • How to config perl cartridge

    I just installed Oracle Application Server 4.07 ON WINNT with sp3. I can start my WEB server. But I cannot know how to config perl application. Please help me! null

  • Hiding buttons in object states

    I am trying to do something that I feel is very simple but I'm losing my head working it out ;-) I have a simple page with multiple buttons that display a full page photo. It's all working fine, but no matter how I try and use layers, I simply cannot