How to position a window behind its owner

Have you seen these slide out panels on OS X? For example, if you use Preview to view multiple images, a panel will slide out from behind the window, with thumbnails of the images. I have seen similar things on other applications. The effect is that a panel slides out from behind the window.
I want to use this effect to add help information to my dialogs. You click on the "info" icon, and a frameless window slides out from behind the dialog, with additional information.
In any case, I have most of it working. The dialog is a JDialog. The slide-out window is a frameless JWindow with the JDialog as its parent.
The only problem I have been unable to solve, is how to make the slide-out window appear behind its owner. I tried calling toFront() on the parent, but that does not do it. Calling toBack() on the child does not have the desired effect either. The child window remains in front. How do I control the depth of a window, relative to its owner?
-Ron.

I think it should be something about focus and modality (just like other users said).
Anyway, if nothing really works, you could override the JDialog paint method so that everything that is supposed to be 'under' the owner doesn't get painted (calling super and clipping returned graphics may be enough already), could this work?
Bye.

Similar Messages

  • How to create a window with its own window border other than the local system window border?

    How to create a window with its own window border other than the local system window border?
    For example, a border: a black line with a width 1 and then a transparent line with a width 5. Further inner, it is the content pane.
    In JavaSE, there seems to have the paintComponent() method for the JFrame to realize the effect.

    Not sure why your code is doing that. I usually use an ObjectProperty<Point2D> to hold the initial coordinates of the mouse press, and set it to null on a mouse release. That seems to avoid the dragging being confused by mouse interaction with other nodes.
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.collections.FXCollections;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Point2D;
    import javafx.geometry.Pos;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    import javafx.stage.Window;
    public class CustomBorderExample extends Application {
      @Override
      public void start(Stage primaryStage) {
      AnchorPane root = new AnchorPane();
      root.setStyle("-fx-border-color: black; -fx-border-width: 1px; ");
      enableDragging(root);
      StackPane mainContainer = new StackPane();
        AnchorPane.setTopAnchor(mainContainer, 5.0);
        AnchorPane.setLeftAnchor(mainContainer, 5.0);
        AnchorPane.setRightAnchor(mainContainer, 5.0);
        AnchorPane.setBottomAnchor(mainContainer, 5.0);
      mainContainer.setStyle("-fx-background-color: aliceblue;");
      root.getChildren().add(mainContainer);
      primaryStage.initStyle(StageStyle.TRANSPARENT);
      final ChoiceBox<String> choiceBox = new ChoiceBox<>(FXCollections.observableArrayList("Item 1", "Item 2", "Item 3"));
      final Button closeButton = new Button("Close");
      VBox vbox = new VBox(10);
      vbox.setAlignment(Pos.CENTER);
      vbox.getChildren().addAll(choiceBox, closeButton);
      mainContainer.getChildren().add(vbox);
        closeButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            Platform.exit();
      primaryStage.setScene(new Scene(root,  300, 200, Color.TRANSPARENT));
      primaryStage.show();
      private void enableDragging(final Node n) {
       final ObjectProperty<Point2D> mouseAnchor = new SimpleObjectProperty<>(null);
       n.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            mouseAnchor.set(new Point2D(event.getX(), event.getY()));
       n.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            mouseAnchor.set(null);
       n.addEventHandler(MouseEvent.MOUSE_DRAGGED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            Point2D anchor = mouseAnchor.get();
            Scene scene = n.getScene();
            Window window = null ;
            if (scene != null) {
              window = scene.getWindow();
            if (anchor != null && window != null) {
              double deltaX = event.getX()-anchor.getX();
              double deltaY = event.getY()-anchor.getY();
              window.setX(window.getX()+deltaX);
              window.setY(window.getY()+deltaY);
      public static void main(String[] args) {
      launch(args);

  • I found an ipod touch with important medical information - how do I return it to its owner?

    I found an ipod touch in Toronto today. No identifying info on it but possibly important medical information.
    Happy to help reunite it with its owner.

    Report to police too.
    Also go to Settings>iTunes and App stores and send an email to the Apple ID email address if different from the iCloud ID address.

  • I found an ipad, locked of course and I want to return to its owner, but how do I do that?

    How can I find the owner of an Ipad 2 I found?

    that's a constructive and positive answer with a real solution.
    Actually, it's complete and utter bunkum, but I guess you'll find that out when you try. Most people try the answers given before marking them as "solved".
    The only possible way of returning the iPad to its owner is to hand it in to the police nearest to where you found it. That's probably one of the first places the owner went after realising they'd lost it and it was no longer where they last had it.

  • Just found Ipad Nano in Big Island Hawaii. Trying to find the owner to return it back. Tell me what is the color, how many songs and your name(its personalize with a name).

    Just found Ipad Nano in Big Island Hawaii. Trying to find the owner to return it back. Tell me what is the color, how many songs and your name(its personalize with a name).

    I only wish that when I called Apple, they would match the serial number with the owner and give me the contact
    Hopefully you left Apple your contact info (name phone #, email address).
    Apple would simply pass your contact to the last registered owner. It would be up to the owner to contact you. As Dave mentioned, Apple will not give you any info (except may to tell you it was or was not registered, but not to who). Turn it on once in a while and maybe they have activated FindMyiPad and a message will pop up (don't need to be logged onto the iPad to a message).

  • SAPScript: Positioning a Window (Graphic) behind the main window

    Hello,
    I want to print a graphic behind the main window. But I am not able positioning a window or graphic-window behind the main window. The result is that my graphic always shows up in front of the printed text of the main window and not behind the text of the main window, as I wish. I thought that the order of the windows determines which windows is on top? But I am not able of putting a window before the 'MAIN' design window.
    Regards, Lars.

    Hi Lars
    Please check the following thread:
    ABAP Development
    /: BITMAP MYLOGO OBJECT GRAPHICS ID BMAP TYPE BMON
    I think, trick must be in 'TYPE'.
    Try to explore what options you can have (here it is BMON). I will also try.
    Regards
    Ashish Jain

  • TS4006 My situation is the opposite. I found an iPod nano. How do I locate its owner?

    My situation is the opposite. I found an iPod nano. How do I locate its owner?

    It sounds like you have a 5G Nano.  See your iPod's User Guide for information on how to delete these videos from the Nano via the Nano's interface.
    http://manuals.info.apple.com/en_US/iPod_nano_5th_gen_UserGuide.pdf
    B-rock

  • I have found an iPod shuffle. I know its serial number. How do I find its owner?

    I have found an iPod shuffle and so know the serial number. How do I find its owner?

    I found an Ipod Shuffle and I called Apple Support desk to return it to the rightfull owner. I offered them to send my contact details to the owner. And then the owner can contact me if he likes. They refused to do this as it is a privacy issue. They advised me to bring it to the local police who can send the request to a special e-mail address of Apple. But I know that normally the police won't bother. And Apple will like this probably, as the previous owner will buy a new Apple device.

  • I found an ipod shuffle... How can I found its owner?

    I found an ipod shuffle on the beach, and I would like to return to its owner, but I don't know how to find him/her. Any suggestions?

    Apple won’t help with this. If desired, take the device to the local police station.
    (120217)

  • HT201250 When Time Machine starts backingup, It popsup a small window that stays up the whole time it is backingup.  How can I make it do its job in the background without the popup?

    When Time Machine starts backingup, It popsup a small window that stays up the whole time it is backingup.  How can I make it do its job in the background without the popup?

    just let it do it for the first time.  actually you might want to option click the little symbol next to the time representing timemachine then click verify bacups
    Message was edited by: Carlo TD

  • How to Position the 3D Rendering Viewport (not using "BasicScene")

    Hi,
    I wrote a custom scene manager which directly manipulating the scenegraph (Instance3D) - I just need some more direct access to it. The 3D view is part of a bigger sourrounding AIR/Flex-based Application, which displays some graphics using convential displaylist. Now I would need to position the 3D rendering area at certain coordinates in relation to the outer main applicaiton window (stage) and application state.
    I was able to replicate most of the internals of "BasicScene" based on the example "Tutorial05_SpriteBased", but I am struggled on how to positioning the 3D rendering area managed by proscenium:
    - BasicScene exposes a "viewport" property that takes a reference to a DisplayObject. It seems like it internally adjusts dimension and position of the stage3D-based rendering area based on that "viewport" x,y,width, and height.
    - I did figure out how to set dimensions of the area (sg is the Instance3D reference):
                                  sg.configureBackBuffer(viewPort.width, viewPort.height, 2, true );
                                  sg.scene.activeCamera.aspect = viewPort.width / viewPort.height;
    - I could not find any way to define a x/y position.
    Any help would be greatly appreciated - probably its just a small thing, but I do not have the source from BasicScene - otherwise I could look it up myself.
    THanks,
    Philipp

    Figured this out how to set the viewport. The Camera exposes a method "setViewport". There is a Demo "TestViewport". The calculation for the viewports top, left, bottom, right values gets more complicated in my case because I have stage scale mode set to StageScaleMode.SHOW_ALL.
    sg.configureBackBuffer(viewPort.stage.fullScreenWidth, viewPort.stage.fullScreenHeight, 2, true );
    sg.scene.activeCamera.aspect = viewPort.stage.fullScreenWidth / viewPort.stage.fullScreenHeight;
    sg.scene.activeCamera.setViewport(true, -0.5, 0.5, -0.5, 0.5 );

  • Remembering Window Sizes/Positions in Windows 7

    Hi
    I've read this thread regarding windows folder position/size (http://social.technet.microsoft.com/Forums/en-US/w7itproui/thread/5b524d53-df97-405d-835f-f081d106a19b)
    however it doesn't address my issue.
    For me, anytime I open a software, position it, play around in it and then close it, and reopen it again, it never goes back to the size/position I set it to. Same with Outlook. When I open a new email window, set its size and position, the next new email
    window is never where it needs to be.
    Is there a way for windows/outlook to remember where my software windows should be based on a position/size I give it?

    Hi,
    I would like to share the following link with you.
    http://support.microsoft.com/kb/235994
    You can know that how windows remembers the Window size.
    Regarding your outlook issue, you may close outlook then delete the frame key from HKCU\Software\Microsoft\Office\12.0\Outlook\Message\ and restart outlook. This will reset the window to the default size.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • Re: Pre-positioned finder windows get moved automatically!    Mac OS » Ma

    Re: Pre-positioned finder windows get moved automatically! (Mac OS » Mac OS X v10.6 Snow Leopard » Finder and Dock, Sep 19, 2009 11:23 PM)
       I could not find my original post to add this to.
       I have discovered that CONTROL-Command-O will open a pre-positioned window in place while closing its parent. (I think it was Option-Command-O previously.) If you are working in folders within folders, you will need to move the topmost window slightly to the side to allow the first level to open in pre-positioned place.
       Has anyone discovered the procedure to go back up to the top level -- with key strokes or without -- while keeping the original position of the higher up window?
       Is there a way to open an enclosed folder in place without having to close the parent?

    Is there a way to open an enclosed folder in place without having to close the parent?
    Not sure you can get there from here
    Double-clicking will open an enclosed Folder in place, in step fashion....all you need to do to move back is to either click 'Back' in the menu bar of that window.
    Double-click on the parent folder in the icon row along the bottom of that window to move back to it or any higher level folder to the left.
    If you hold the command key and click once on the icon in the top center of that window's upper margin, you will see a vertical list of any parent folders in order (top most at the bottom)...click on one to move to it.
    As you can see, 'back' here is thus defined at least three ways: back, left & down. While it can be distracting to some people who may prefer what at least appears to be a more structured environment, the goal is to provide choices so that the OS appears to provide flexibility rather than being hardwired/inflexible. Don't let the number of choices confuse you - find a style that suits your flow and be happy.
    If you want to peer into some of the thinking behind Apple software, you would do well to invest time (and I don't mean just a quick glance) in reading the 'Apple Human Interface Guidelines' at this link...

  • Clicking around in photoshop on mac regularly clicks through the window and goes to the window behind it on mac only

    Having an issue on photoshop cc 2014 and the other versions ive tried on mac where when Im clicking around the canvas it periodically clicks through the canvas and goes to the window behind it. Anybody know what could be causing this? Im assuming its a bug

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             

  • I purchased a iMAC off eBay. I was wondering how do I take off the previous owner name and replace mines?

    Hi,
    I purchased a iMAC off eBay. I was wondering how do I take off the previous owner name and replace mines? I reset all passwords to log in,but his name in the mac keeps showing up.
    Thanks,
    Honey
    <Re-Titled By Host>

    Before buying a second-hand computer, you should have run Apple Diagnostics or the Apple Hardware Test, whichever is applicable.
    The first thing to do after buying the computer is to erase the internal drive and install a clean copy of OS X. You—not the original owner—must do that. Changes made by Apple over the years have made this seemingly straightforward task very complex.
    How you go about it depends on the model, and on whether you already own another Mac. If you're not sure of the model, enter the serial number on this page. Then find the model on this page to see what OS version was originally installed.
    It's unsafe, and may be unlawful, to use a computer with software installed by a previous owner.
    1. If you don't own another Mac
    a. If the machine shipped with OS X 10.4 or 10.5, you need a boxed and shrink-wrapped retail Snow Leopard (OS X 10.6) installation disc from the Apple Store or a reputable reseller—not from eBay or anything of the kind. If the machine is very old and has less than 1 GB of memory, you'll need to add more in order to install 10.6. Preferably, install as much memory as it can take, according to the technical specifications.
    b. If the machine shipped with OS X 10.6, you need the installation media that came with it: gray installation discs, or a USB flash drive for a MacBook Air. You should have received the media from the original owner, but if you didn't, order replacements from Apple. A retail disc, or the gray discs from another model, will not work.
    To start up from an optical disc or a flash drive, insert it, then restart the computer and hold down the C key at the startup chime. Release the key when you see the gray Apple logo on the screen.
    c. If the machine shipped with OS X 10.7 or later, you don't need media. It should start up in Internet Recovery mode when you hold down the key combination option-command-R at the startup chime. Release the keys when you see a spinning globe.
    d. Some 2010-2011 models shipped with OS X 10.6 and received a firmware update after 10.7 was released, enabling them to use Internet Recovery. If you have one of those models, you can't reinstall 10.6 even from the original media, and Internet Recovery will not work either without the original owner's Apple ID. In that case, contact Apple Support, or take the machine to an Apple Store or another authorized service provider to have the OS installed.
    2. If you do own another Mac
    If you already own another Mac that was upgraded in the App Store to the version of OS X that you want to install, and if the new Mac is compatible with it, then you can install it. Use Recovery Disk Assistant to prepare a USB device, then start up the new Mac from it by holding down the C key at the startup chime. Alternatively, if you have a Time Machine backup of OS X 10.7.3 or later on an external hard drive (not a Time Capsule or other network device), you can start from that by holding down the option key and selecting it from the row of icons that appears. Note that if your other Mac was never upgraded in the App Store, you can't use this method.
    3. Partition and install OS X
    a. If you see a lock screen when trying to start up from installation media or in Recovery mode, then a firmware password was set by the previous owner, or the machine was remotely locked via iCloud. You'll either have to contact the owner or take the machine to an Apple Store or another service provider to be unlocked. You may be asked for proof of ownership.
    b. Launch Disk Utility and select the icon of the internal drive—not any of the volume icons nested beneath it. In the  Partition tab, select the default options: a GUID partition table with one data volume in Mac OS Extended (Journaled) format. This operation will permanently remove all existing data on the drive.
    c. An unusual problem may arise if all the following conditions apply:
              OS X 10.7 or later was installed by the previous owner
              The startup volume was encrypted with FileVault
              You're booted in Recovery mode (that is, not from a 10.6 installation disc)
    In that case, you won't be able to unlock the volume or partition the drive without the FileVault password. Ask for guidance or see this discussion.
    d. After partitioning, quit Disk Utility and run the OS X Installer. If you're installing a version of OS X acquired from the App Store, you will need the Apple ID and password that you used. When the installation is done, the system will automatically restart into the Setup Assistant, which will prompt you to transfer the data from another Mac, its backups, or from a Windows computer. If you have any data to transfer, this is usually the best time to do it.
    e. Run Software Update and install all available system updates from Apple. To upgrade to a major version of OS X newer than 10.6, get it from the Mac App Store. Note that you can't keep an upgraded version that was installed by the original owner. He or she can't legally transfer it to you, and without the Apple ID you won't be able to update it in Software Update or reinstall, if that becomes necessary. The same goes for any App Store products that the previous owner installed—you have to repurchase them.
    4. Other issues
    a. If the original owner "accepted" the bundled iLife applications (iPhoto, iMovie, and Garage Band) in the App Store so that he or she could update them, then they're irrevocably linked to that Apple ID and you won't be able to download them without buying them. Reportedly, Mac App Store Customer Service has sometimes issued redemption codes for these apps to second owners who asked.
    b. If the previous owner didn't deauthorize the computer in the iTunes Store under his Apple ID, you wont be able to  authorize it immediately under your ID. In that case, you'll either have to wait up to 90 days or contact iTunes Support.
    c. When trying to create a new iCloud account, you might get a failure message: "Account limit reached." Apple imposes a lifetime limit of three iCloud account setups per device. Erasing the device does not reset the limit. You can still use an iCloud account that was created on another device, but you won't be able to create a new one. Contact iCloud Support for more information. The setup limit doesn't apply to Apple ID accounts used for other services, such as the iTunes and Mac App Stores, or iMessage. You can create as many of those accounts as you like.

Maybe you are looking for