Moving Two Windows Together

Hello,
A friend asked me this, and I couldn't come up with a reasonable answer on the spot.
Is there a way to keep two windows (JFrames, JWindows, whatever) in the same location relative to one another? As in, if I move Window A, Window B comes along for the ride. I think his end goal is to have a window that contains settings and whatnot slide out from underneath the other window, but stay behind it most of the time. Just a little bit of the "drawer window" would be visible hanging out from behind the main window.
My first thought was, maybe there's a Listener for window movement events, but I couldn't find one. Then I thought maybe overriding the windows' setLocation() methods to first call the OTHER window's setLocation().. but that would only work after the user was done dragging, not during.
Anybody have any ideas?

This works for me. Updates as moving. Is that what you're looking for?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing implements ComponentListener {
    public void stub1(){
        JFrame frame = new JFrame("Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.addComponentListener(this);
        frame.setPreferredSize(new Dimension(800,400));
        frame.pack();
        frame.setVisible(true);
    public void componentMoved(ComponentEvent e) {
        System.out.println("Frame moved: "+e);
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                new Testing().stub1();
    public void componentHidden(ComponentEvent e) {}
    public void componentResized(ComponentEvent e) {}
    public void componentShown(ComponentEvent e) {}
}

Similar Messages

  • Moving two motors together.

    Hi all,
    I'm using MID-7604 motion controller that is driving a set of motors.
    I wish to move 2 motors in tandem.
    Can anyone suggest links to how this is done in Labview?
    Does the hardware actually implement this in parallel, or does it internally serialize it?
    Is there a performance issue with doing this vs moving the motors sequentially?
    Thanks,
    cosmund

    cosmund,
    there are several ways to move two motors together. One option is to configure a vector space that contains both axes and  configure your moves for a vector space. Please refer to the shipping examples (e. g. Two-Axis Vector Move with Position Monitor.vi). Axes in a vector space always start and stop at the same time.
    Another option is to configure the move constraints for both axes independently and use a single instance of Start Motion.flx to start both axes at the same time. You will have to use the Axis/VS map parameter and set the Axis or Vector Space parameter to Axis Control.
    The third option is to use electronic gearing. In this mode you only have to control one axis and the other one will follow with the gear ratio specified by you. Please refer to the shipping examples (e. g. Master Axis - Slave Axis Gearing.vi).
    I hope that helps,
    Jochen Klier
    National Instruments
    P. S.: If you need further information, please add the NI-Motion device type (e. g. PCI-7340) to your next post.

  • Sharing one "Email account" between two Windows "user account" in a "Global Inbox"

    Context: Two "windows user accounts" on a Windows XP PC, having the same email address. The "Local folder" is placed on a "All users" directory and acounts settings specify a POP server with a retention period of 30 days.
    Problem: When User B ask for reception of messages, he received all messages already read by user B. (this probably due to separate popstate.dat).
    On a previous PC two years ago, we do not had this dupplicate reading.
    If you have a solution, could you also cover the Windows 7 case.
    Regards
    Dto75

    I strongly suggest you get the whole profile in the same folder hierarchy before you even consider moving to windows 7.
    Windows XP has Program File
    Windows 7 has Program Files and Program Files (X86) your executable goes in the x86 one.
    XP has applications data
    Windows 7 has appdata
    In windows XP Thunderbird's profile is in application data in windows 7 it is in appdata/roaming
    If you open explorer the old locations appear to be there, but they will not work to locate Thunderbird's disparate parts of it's profile
    And so the list goes on. Hence none of the locations you know will probably exist under windows 7 so if parts of the profile are pointing to locations that have changed, only grief awaits you.

  • Sync bookmarks across two Windows 7 using Firefox 29?

    Hello Everyone,
    I have two windows 7's workstations. One workstation is a new install. The other is a laptop. On the new install I loaded Firefox 29. Didn't sync with the old sync server. So I upgraded the laptop to Firefox 29. I signed up for the new sync on both workstations. On the new install workstation no book marks have been moved from the laptop..
    Any help would be great.
    David

    Closing duplicate thread. Please continue at [https://support.mozilla.org/en-US/questions/999132 /questions/999132]

  • High cpu usage when moving application windows

    Hello all,
    I have two machines with arch installed:
    - an eeepc 701 surf/intel gpu(xorg driver) with xfce
    - an amd 3800+ X2/nvidia 8860 gt(proprietary driver) with kdemod3(also checked with xfce4)/arch amd64 installed.
    I noticed that when i move a window of an application(for example konsole, etc..) too fast i get high cpu usage(30-40 %), when checking with htop.
    Is it normal that the X server uses the cpu so much when moving a window??
    EDIT: up to now i tested it in a friends windows machine, and it happens exactly the same, so i guess is normal. It seems i need to be informed better about how X works :-)
    Last edited by mechmg93 (2008-10-15 08:04:10)

    today i switced back my desktop system to debian unstable and tried to see what the difference is concerning this problem.
    I found out that in kde3 the solution to the "problem" is debians kde default configuration about window behaviour.
    Especially the one mentioned below :
    In debian this is not ticked and this has as a result zero cpu usage when windows are moved.
    Last edited by mechmg93 (2008-10-23 18:36:58)

  • Can I use iCloud on two Windows 7 PC's? (same apple ID)

    Hi!
    I am a new user of Apple products and would like to use iCloud on two Windows PC's to upload Pictures and be able to see them on iPad. I manage to setup one computer and upload a few pictures for test and it worked, however when I setup computer number 2, nothing happens after I put the pictures on the required location to upload.
    Please let me know if this is feasible and if is not, what do I need to do to enable computer number 2 as the one to use and disable using computer 1 (the one working so far)
    Regards

    You can only create iCloud account on an iOS device (iPhone, iPad or iPod Touch) running iOS 5 or higher, or on a Mac running OS X Lion (10.7.5) or higher.  After creating your account on one of these devices you will then be able to sign into the account using your iCloud ID on your PC.

  • Is there a way to add two windows in the same window?

    is there a way to add two windows in the same window?

    what do you mean by your first use of the word "window"? do you mean a visible frame? a section of the gui that the user doesnt see?
    or perhaps you mean you want to add multiple tabs to a single window, so that switching between tabs shows different windows?

  • Open and edit PDF document simultaneously in two windows

    I am currently studying on a very long PDF, about 1600 pages. I have two copies of the same PDF open in full screen, and I use the first (A) to read and highlight, and the second (B) to search for images and references. So if I am on page 200 of A, and it refers to an image on page 270, instead of scrolling 70 pages and losing track of where I was I scroll on B.
    That being said, I tend to highlight on both copies, and I would like to have unified highlights and comments. Is there a way to:
    a) merge the comments and highlights after I close both files
    or
    b) instead of having two copies of the same file A and B, open two windows of the same file A and merge modifications

    Adobe Reader won't but Acrobat Pro XI can open the same document in two windows and it updates both as you make changes "on the fly"...
    The downside? $499.
    Acrobat Standard is $299 and I  don't know if it can do the "one doc two window" editing.

  • Terminal won't stop opening two windows.

    Every time I open Terminal, it opens two windows. One window has a bunch of text at the top that appears to be old commands(perhaps that I had typed? I don't remember all that I've typed into Terminal since the beginning of time ) in grey and then the normal Terminal prompt in the usual green(that's the theme I have) after all the text. The second window is in a fullscreen space thingy(Lion's mission control interface) and it looks similar except the text is different and there is a LOT more of it.
    I'm not quite sure what to do to make this stop. I've tried deleting the plist file for Terminal. I've tried restarting the computer. I've tried closing both windows, opeing a new one, positioning how I'd like it posistioned, then quitting Terminal by holding alt/option and cliking "Quit and Keep All Windows" from the Terminal menu.
    Is there a place where there are setting files for an app's window positions/defaults?
    It may also be good to mention, as it seems possibly relevant, that every time I open iPhoto, it opens in a fullscreen space much like the second Terminal window. I've tried similar things on iPhoto to get IT to stop doing this.
    Thanks for any help!

    Okay, so I actually found a solution to the problem!
    I cannot claim it as my own since I found it on another discussion page as well as CNET, but I'll post what I did here for others to see.
    The two helpful pages were:
    http://reviews.cnet.com/8301-13727_7-20083707-263/managing-mac-os-x-lions-applic ation-resume-feature/
    and
    https://discussions.apple.com/message/15859853#15859853
    What I did was:
    1. Enable "Restore windows when quitting and re-opening apps" under General in System Preferences(I don't know for sure if this is necessary, but it seemed harmless with my new found knowledge as you'll see in a moment)
    2. Navagate to "~/Library/Saved Application State/" in Finder
    3. Find the folder named "com.apple.Terminal.savedState"
    4. Move it to the trash
         This resets the state that the application uses to open each time it opens, when you open it now, it'll recreate the folder
    5. Launch Terminal
    6. Open the Get Info dialog for the newly created "com.apple.Terminal.savedState" and tick the "Lock" checkbox
         This prevents the contents of the folder from being changed, resultantly preventing ONLY Terminal from saving the state of it's windows on closing.
    Not only did this solve THIS problem, but it opened up some cool options:
    -By Locking any of these folders, one can keep a sort of template for how they'd like the windows of an application to open every time.
    -One can leave on the "Reopen windows" preference but select applications for which they do not wan't it to work. It is a semi useful feature, and I can understand why it was added, it just seems like an oversigt that it was only a global or no feature.
    -One can reset the window options of any trouble making apps in the future.
    Note: This also solved the problem I was having with iPhoto!

  • I'm moving from windows notebook to MacBook Pro. When teaching I use a USB quality pointer device and want to know it the MacBook works with it

    Greetings,
    After using only Windows computers at work and home our company leadership now allows us to purchase Mac Pro Books if we desire. I am VERY excited!!!
    Both of our sons work as engineers in Silicon Valley and will not purchase anything but Macs for years.  Both son's schedules hinder me to get the answers quickly from them so I am seeking advice from you.
    I love the idea of finally getting a Mac but have some questions and need to find a source to answer my questions before I send in the request for the new computer. If any of you could respond to these "beginner" Mac questions it would be wonderful.
    1. I teach a large variety of classes using Powerpoint style presentations. I own a very nice wireless USB remote that I use to move between slides.  Will the ProBook allow me the ability to use my remote? If so is there anything I need to know to make it work?
    2. What are the tradeoffs of the 13 inch ProBook versus the 15 inch model?
    3. What external devices/equipment should I plan to have available to be effective in an office environment?
    4. In moving from Windows to Mac what is the best was to bridge the learning curve so I can become effective as quickly and effectively as possible?
    I am very excited to make this change and your advice would be so appreciated.
    Blessings,
    David

    David,
    Have you checked the Web site of the manufacturer of your wireless USB remote, to see if their product supports MacBook Pros?
    In general, the 13-inch MacBook Pro has less powerful hardware than the 15-inch model. A detailed comparison can be found in the right-hand column of the table here.
    Which external devices/equipment do you currently have  to be effective in an office environment with your Windows computer? The list is likely to be similar with a computer that runs OS X.
    Which applications do you currently depend upon under Windows? That might be the best guide to providing advice on how to best adapt to OS X.

  • Multiple problems: can't open two windows, browser doesn't close although window disappears, and after working for a while I loose my ability to cut and paste or use drop down arrows

    Maybe two weeks ago I discovered that I could no longer open two windows at a time (I can still open multiple tabs). I am also having problems with cutting and pasting, which is crucial to my on-line job. Plus, when I exit Firefox, it doesn't always shut down, so then when you go to re-open, of course, it won't (unless you go into process and turn it off). I have re-installed multiple times and I have also used restore. Nothing seems to be fixing this and I really, really don't want to use IE, especially for work.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    See also "Hang at exit":
    * http://kb.mozillazine.org/Firefox_hangs
    * [[Firefox hangs]]
    Maybe also do a malware check with a few malware scan programs.<br />
    You need to use all programs because each detects different malware.<br />
    Make sure that you update each program to get the latest version of the database before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]

  • How do I consolidate an Itunes music library on two windows computers onto one windows computer?

    How do I consolidate an Itunes music library on two windows computers onto one windows computer?

    Click here, pick the option which best fits your situation, open the larger library in iTunes, move the media files from the smaller one into the library in the open iTunes program window or the Automatically Add to iTunes folder, and then import the playlists. Any rented movies will only play on the computer they were originally downloaded to.
    (126751)

  • How do i stop two windows from openning when i clicon an email link, the home page and the link both open. i just want the link to open

    how do i stop two windows from openning when i click on an email link, the home page and the link both open. i just want the link to open

    That is a bug, so you need to wait until this get fixed.
    See https://bugzilla.mozilla.org/show_bug.cgi?id=531552 - Firefox 3.6b opens two windows when opening external links
    (please do not comment in bug reports)

  • How do I share my printer between my two Windows 7 systems?

    Some users find that they have a non-networked printer that worked fine in a mixed Windows environment, but found their two Windows 7 printers (one host and one client) are not able to share the printer.
    Windows 7 handles networking differently than previous versions of Windows.
    The easiest way to get started with sharing printers between multiple Windows 7 computers is to setup a HomeGroup.  A HomeGroup is a way to authorize different Windows 7 computers to talk to each other and share resources.  Microsoft has a good article about HomeGroups that has links to various guides.
    Once the HomeGroup is setup, the next step is to setup a host for the USB printer.
    This article from Microsoft details how to enable file and printer sharing, sharing the printer, and the basic steps of adding the printer.
    The first two sections are fine as they are, but I would like to expand on adding a shared printer to the other Windows 7 computers.  
    This process tends to have the greatest success with sharing printers in Windows 7.  Most USB only printers do have a driver available in Windows.
    1.  Go to Start>Devices and Printers.
    2.  Click on Add a printer at the top.
    3.  While it is a networked printer, it is not the current network standard printer.  Select Add a local printer.
    4.  Select Create a new port with a local port for type.
    5.  Enter \\<host computer name>\<printer name> without the < > symbols.  The host computer name is the name of the computer that has the printer attached to it.  If you do not know that name, go to the host computer and go to Start>Right-click Computer>Properties.  The computer name will be listed here.  The printer's share name was selected in a previous step in the Microsoft article.
    6.  Click Ok and the printer driver screen will appear.  Click on Windows Update to ensure it is the most current list.
    7.  Select the printer model from that list.
    8.  Follow the rest of the prompts.
    At the end of these steps, the printer should be shared from the host computer to the other Windows 7 computers. 
    Some important notes about this setup:
    1.  Only printing will be functional.
    2.  The host computer must be on for printing to work.
    3.  The host computer could enter standby or suspended mode.  This will interrupt the shared printer on the other systems.
    With these steps completed, the printer should be functional on the Windows 7 computers once again.
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓
    This question was solved.
    View Solution.

    I hope this information is helpful to some.  
    ↙-----------How do I give Kudos?| How do I mark a post as Solved? ----------------↓

  • HT201236 I want to do something so simple that there are no instructions. I just need to have two windows open at the same time so I can transfer files from one to the other by drag

    I want to transfer files from one device (or page ) to another by drag and drop , so i need two windows ope   at the same time,
    I know this can be done but I have forgotten how

    Don't use any full screen options for any app that has them
    Mount your device and double click on it to open it. Drag this window to the upper right of your Desktop and resize it to a bit less than half of your Desktop.
    Open the next folder and position it on the lower left side and resize it so you can still see the previous window.

Maybe you are looking for

  • [Solved] Black screen - Installation issues on Dell Inspiron 1720

    Hi, I'm new to Archlinux, and i want to post my experience/issues of my first installation: I performance the core installation (base + devel packages and wireless tools as extra package) relevant hardware/drivers used: b44 for broadcom nic (wired) i

  • 20" iMac screen gets very light at the bottom.

    I just got a new 20" iMac and the screen appears to get lighter and washed out towards the bottom half of the screen. So bad that for example in the itunes library it is supposed to alternate from blue to white, but at the bottom of the screen it loo

  • In CS6 InDesign (8.0.1) I tried looking for Folio Overlays panel and it doesn't appear...

    In CS6 InDesign (8.0.1) I tried looking for Folio Overlays panel and it doesn't appear. So, I tried to go to Updates under Help menu but the Updates button is deactivated. Any ideas?

  • Blue box around link wont go away

    Im using DW cs3 and trying to redo a website. I have everything in place, but when I add a link to an animated gif in center of my page, it adds a blue border around the image. How can I turn this off? I have a nav column on left side of page will ro

  • Upgrading ISA 4.0 to "SAP E-Commerce for mySAP ERP"

    We currently have a Internet Sales (R/3 edition) environment connected to a R/3 4.6C backend. We are upgrading the backend to mySAP ERP 2005. This has necessitated an upgrade of the Internet Sales environmet, too. Has anyone does this or had any expe