Dragging window around

Hi, I'm trying to drag around the main scene for the program, the stage is undecorated, so no border.
I'm basically using:
scene.getWindow().setX(across);
scene.getWindow().setY(down);
And this works fine, but also, I have a background (An ImageView added to the scene, that I would like to update as the window us moved).
The background is basically a screenshot of the desktop (I'm using this instead of null fill on the stage, since a transparent stage give choppy results).
So next I do...
setViewport(rect);
Where Rectangle2D rect = new Rectangle2D(across, down, s, s);
This works "okay", but when dragging the stage, its usually out of sync,
As if it can't update the viewport in time with the motion of the window across the screen.
I've tried using threads, and platform.runLater, but I can't really get it to work without going out of sync.
Any ideas, thanks.

It's hard to imagine the overhead of manipulating and drawing the background image is going to make things less "choppy" than using a transparent stage. If the aim is simply to have a draggable window where the user can see the desktop in the background, a transparent stage is the way to go. The following test runs fine on my system:
import javafx.application.Application;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Point2D;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class TransparentWindowDragTest extends Application {
    @Override
    public void start(final Stage primaryStage) {
        primaryStage.initStyle(StageStyle.TRANSPARENT);
        final StackPane root = new StackPane();
        root.setStyle("-fx-border-color: blue;");
        final Button button = new Button("Close");
        button.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                primaryStage.hide();
        root.getChildren().addAll(button);
        final Scene scene = new Scene(root, 300, 200, Color.TRANSPARENT);
        final ObjectProperty<Point2D> mouseOffset = new SimpleObjectProperty<>();
        scene.setOnMousePressed(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                mouseOffset.set(new Point2D(
                    event.getScreenX() - primaryStage.getX(),
                    event.getScreenY() - primaryStage.getY()
        scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                primaryStage.setX(event.getScreenX() - mouseOffset.get().getX());
                primaryStage.setY(event.getScreenY() - mouseOffset.get().getY());
        primaryStage.setScene(scene);
        primaryStage.show();
    public static void main(String[] args) {
        launch(args);

Similar Messages

  • Can't drag window around in PS CS4....

    Can someone help me with this?  I just reloaded PS CS4 back onto my computer and it's no longer letting me drag my windows around the screen.  TIA

    Visit this menu:  Edit - Preferences - Interface, uncheck [  ] Open Documents as Tabs, restart Photoshop.
    -Noel

  • Unable to drag window around

    Something very strange happens to me today and I can not figure out how to fix this, so I am hoping someone would shed some light here as it's driving me crazy.
    I was working on my MBP today until somehow it got totally frozen and it did not respond to anything I do including attempt to shut down the machine. As a last resort, I had to press and hold the power button for 2-3 seconds to shut down the machine.
    Upon re-booting my machine, now I notice I am UNABLE to drag the window around (like mail, ical, safari..etc). I can always drag (or move if you will ) the window around by press and hold down my thumb and with another finger. Now all of a sudden, that does not work for me anymore, and the only way to drag the window is to move the cursor to top of the window, tap twice with one finger, then drag.
    I know this sound very bizarre and i am totally baffled by this. I was thinking perhaps when I shut it down using the power button, somehow something was not closed properly and it left something in a limbo state.
    Would someone please tell me how to fix this? like remove some systems file or plist or whatever... please help as this is most annoying not able to drag the window around.

    @macjack
    I removed those two plists you suggested, restarted, it did not help
    @andyball
    Sorry for the confusion, I have always been able to place the cursor on the title bar of a window, hold down with my thumb and move with a second finger. Of course, now that does not work. Tapping twice when the cursor on the title bar is the only way I can move the window.
    Additional info here, when I plug in a mouse, I can move while holding down the button.
    I wonder if my trackpad is messed up.

  • Can't drag windows around using the title bar-CS4

    I just upgraded to CS4 at work last week and I'm already regretting it. Firstly, using two monitors, CS4 must like my graphics card becasue as soon as I open a document and it begins to render the window, the main monitor loses it's signal and cuts off. So I have to hard shut down and make my 2nd monitor the main one, open CS4 and a file on that monitor, then make it the 2nd monitor and pass it over to my real first monitor with a file open and make that monitor the main one again. Added to that, randomly, files will open as tabs even though I have the option unchecked in prefs. I hate tabs, I want my windows floating. But I digress.
    My current issue is the file windows are not movable using the title bar. I can expand/contract every side grabbing the edge, but clicking, holding and dragging any of the title bar is ineffective. I can drag to tab to undock it, but once floating, the title bar is non-funtional for grabbing. I can also double click on it to tab, just not to drag.
    I use a mac at home and thankfully Adobe hasn't forced the edge to edge palette background on that platform. On the mac we get a 'classic view' or something that does away with the desktop blocking grey window background. Seriously, I can't stand the full screen look. Why can't windows have that option to have just the menu bar, palettes and file windows allowing the desktop to be visible? /rant

    A new video card is often a good idea if yours is over 2 years old.  Even the modern "budget" (e.g., ~$100) cards are hugely powerful nowadays.
    This page, I believe, could be a good starting point for everything you want to know:
    http://kb2.adobe.com/cps/404/kb404898.html
    This page, specifically, talks about tested video cards with Photoshop CS4:
    http://kb2.adobe.com/cps/405/kb405711.html
    A similar page for Photoshop CS5:
    http://kb2.adobe.com/cps/831/cpsid_83117.html
    -Noel

  • Lag when dragging windows and scrolling, using ATI Proprietary drivers

    Ok, so I've installed Arch Linux on my Desktop PC, and on top of that I'm using Gnome as my GUI. Because I am addicted to Minecraft, I wanted to play it as soon as possible, but I got this error telling me to install my graphiccard drivers. And so I installed the "ATI Proprietary Driver".
    After rebooting my computer I noticed that when I drag windows around or scroll inside them, it lags, though I have no problems watching movies. And still Minecraft complains about graphic drivers!
    I'm not a pro at Linux so I would really like some help here, because I don't know what to do.
    :EDIT:
    Think I solved it! I just ran the installation one more time and now there's no lag? Hmm...
    /Znax
    Last edited by ZnaxQue (2011-05-21 21:36:20)

    https://wiki.archlinux.org/index.php/Catalyst
    - xorg-server 1.12 is in [extra] repo, catalyst does not support it so please use [xorg111] repo.

  • T61 touchpad won't drag to mark or drag Windows

    Since a recent update to the Ultranav driver (15.1.19) I've got a problem with the touchpad:
    can't use the touchpad to mark text (shift/drag on touchpad), though I can do this with the trackpoint.  Never used the trackpoint much before but am glad I can now still do this basic function with it!  This happens in all programs:  editing programs, IE8, etc.
    Can't use the touchpad to move windows around the desktop either.  You know -- click on the top bar and shift/drag it around with the touchpad.  Can do this with the trackpoint.
    I also get minor pauses intermittently using the touchpad to move the cursor. 
     Thanks.
    PS: sorry to hear of so many problems with T61 series batteries, graphics, etc.  Mine's been working fine for over 3 years (can't say the same of my old T42 -- it bit the dust after 4 years).

    Try this one: KB887823 - "Your portable computer stops responding when you try to put it on standby in Windows XP"
    A good site with links to various hotfixes is here - you will have to register to download the hotfixes But it's better than having to e-mail Microsoft begging that they send you the link to the hotfix you need..
    BTW, the hotfixes designated  "KB" and the "Q" are interchangeable so if you can't find the one that starts with Q, then substitute it with KB.... "Q" was the old Microsoft designation for a hotfix, while "KB" (Knowledge Base) represents the new designation.
    To fix the problem, I would also suggest the following for you (after you install the above hotfixes):
    1) Re-install the Lenovo Power Management Driver for the T61. (Note that there is the Power Management Driver and Power Management Software - referred to as "Power Manager". You don't really need the "Power Manager" but you do need the Power Management Driver!! The driver is what tells your computer to do when you close the lid, i.e. go into standby, etc.. Notice in the Lenovo site there is a hotfix associated with the Driver to work properly (Q918837)).
    2)  re-install the hotkey driver from Lenovo (makes the Fn buttons functionable)
    3) Also, check your settings in "Power Options" in the Control Panel, making sure the actions are associated with the proper event. You may choose to enable hibernation there as well.
    Hope this helps.
    Message Edited by icantux on 04-16-2008 10:51 PM

  • Cannot move/drag windows

    I don't know what happened but it seems all my windows are locked up. I cannot move any window around by dragging. I can only minimize or maximise the window, nothing else. this is crazy and is driving me nuts. i'm running 10.9.3 on mid 2010 mbp.
    hope someone has an idea how to fix this... thanks guys...

    Post a complete screen capture showing the problem.

  • How to drag desktop around without clicking

    I just got a brand new MacBook Air and I'm loving it but there's one thing I can't figure out:  On my MacBook I am able to move desktops around "silently" (i.e., withouth clicking). How can I simply put one finger on the trackpad for a few seconds then have it move the windows (mail, safari, etc)  around? In System Prefs I have everything checked inside Trackpad.

    You can move windows around using the drag function of double tap-hold  drag.
    It's in System Preferences > Universal access > Mouse & trackpad tab > trackpad options... button > check drag, with or without drag lock.

  • Server 2008 R2, XP SP3/7 64bit client remoteapp dragging window problem

    I'm running a small remoteapp server farm in 2008 R2 and am experiencing difficulties with some applications when dragging windows about.
    The problem happens when moving windows around by left click and dragging, they seem to get 'undropped' even though the mouse click is still applied (happening on multiple users) This is usually within the application where 2 documents are open. Moving dockable
    toolbars around is also a problem
    I've tried remote desktop connection onto both the servers and it appears to work with no problems.
    Environment:
    Server 2008 R2 (2 of configured as an RDP farm) 
    XP SP3 clients
    7 Pro 64 Bit
    Photoshop CS5
    Anyone have any ideas/links to hotfix which addresses this?

    Hi,
    Thank you for your reply.
    As the other build-in Windows application is working fine, it seems to be a compatibility issue. Please consider using the “RDS Application
    Compatibility Analyze” below to test the application if meets the requirement of RemoteApp.
    How to detect RDS-specific application compatibility issues by using the RDS Application Compatibility Analyzer
    http://blogs.msdn.com/b/rds/archive/2010/01/19/how-to-detect-rds-specific-application-compatibility-issues-by-using-the-rds-application-compatibility-analyzer.aspx
    Thanks.

  • 4x4 window around one pixel? how?

    5. The processing procedure works as follows. For each pixel of an image, the procedure considers an (n x n) window centered on that pixel, computes the mean/median of gray-level values in the window, and the mean/median becomes the new gray-level value of the new image. The median is defined as the middle value in a sorted sequence. For example, consider the following (3 x 3) window of pixels: 11 90 74 71 14 92 20 87 68. The sorted sequence of these pixels is <11, 14, 20, 68, 71, 74, 87, 90, 92>, and the middle of the sequence is 71, which is the median of the window. The median of the sequence <1,4,7,9> is (4+7)/2=5. The result of replacing all pixels with average values is a smoothed image. Using median values producing the oil painting effect. On the negative side, the new image is blurrier than the original. Corners and edges of the image need to be handled differently. For this project, for the boundary cases, the sliding window will be resized and include only the image pixels within the window.
    how would i makea 4x4 window around one pixel?

    Maybe you should go away and learn Java and then come back when you can understand the answer.

  • TS1248 Trackpad - can't move windows around - curser works -tap works

    Can't move windows around w/trackpad.  

    Try using 3 fingers on the title bar. Can you screenshot your trackpad settings in system prefrences.
    System Prefrences > Trackpad

  • Cannot move photoshop CS6 window around on screen, it is stuck in one spot

    cannot move photoshop CS6 window around on screen, it is stuck in one spot

    Hi there,
    Thanks for your response. I have since fixed the problem by unplugging my
    external monitor and restarting my computer.
    Best,
    -Jake
    On Fri, Jun 13, 2014 at 3:21 AM, c.pfaffenbichler <[email protected]>

  • How do I view page margins and drag objects around to fit?

    How do I view page margins and drag objects around to fit?

    Hi Sime,
    Some ideas for workarounds now that Numbers 3 has lost Page Setup, Print View and Layout View.
    1. Numbers 2.3 is still on your computer unless you deleted it. Look in your Applications folder for the iWork '09 folder. Drag the Numbers '09 (Numbers 2) icon to your Dock. It will become an Alias. Right click (or control click) on it then Options > Keep in Dock. You might actually enjoy running both versions at the same time, to compare features. Just be careful which version you are running before you edit and save.
    2. Use Numbers 3 to export a document 'backwards' to Numbers 2. Be aware that features lost in Numbers 3 may not be restored by exporting 'backwards' to Numbers 2.
    3. In Numbers 3 > Preferences > Rulers
    Those Guides help you to align objects with each other.
    4. Menu > View > Show Rulers. This will show zero for the top or right left margin. Then drag a ruler guide from top or left.
    More hints on workarounds here:
    https://discussions.apple.com/message/23622372#23622372
    What has been GAINED in Numbers 3 is here:
    https://discussions.apple.com/thread/5473882?start=45&tstart=0
    If you want to see what has been lost in Numbers 3, go here:
    https://discussions.apple.com/thread/5470448?start=240&tstart=0
    Regards,
    Ian.
    Message was edited by: Yellowbox. Oops, This will show zero for the top or *right* margin. Mirror image this to *left* margin

  • Moving plugin windows around causes spinning beach ball.. 8.0.2 near???

    last q. for now...how come when moving plugin windows around in logic it can sometimes cause the dreaded spinning beach ball?? you think logic is going to crash but it doesn't, it recovers and then runs real sluggish... logic or leopard bug??? i can't wait for 10.5.2 to see what it magically fixes in logic!! any hope that we might have 8.0.2 in the near future...there are all these other updates floating down from cupertino but yet logic seems neglected...

    Thanks Pancenter... appreciate your input. Really useful information. When I bought my Mac Pro, there was an issue with the video cards; if you wanted to run 2 x 30" ACD's, then you had to up the spec to a more powerful card. The guy in the mac shop assured me the GeForce 7300 GT that came with the machine would be sweet enough for 2 x 23's... and it was. But that was with Tiger. (?)
    Is Leopard &/or LP8 graphically more demanding than Tiger &/or LP7... I wouldn't have a clue? Does anyone have an opinion on this? (I'd be REALLY interested!) Are the cards shipping with these machines really up to the job of running the OS AND something as complicated as LP8? My opinion is; They SHOULD be.
    Thanks Zuelito... I had noticed this thread & was surprised/dismayed that even 8 CORE machines were having this problem too! But then, if it's a problem with underpowered graphics cards, I don't suppose it matters how many cores you've got... does it??? Thanks for your post... again, really USEFUL information. I appreciate it! (GREAT thread.)
    I only get this problem when I open anything UAD; it runs happily in the background but out comes "the ball" whenever I open & move more than 1 instance of a UAD plug. Haven't once had it happen with Logic or 3rd party AU's.
    Thanks again for your input... keep it comin'!
    Cheers...

  • Analog-In code pauses when I move windows around. WIN98

    I was able to fix the digital in/out code with different threads which seemed to have the same problem. The problem I still have is with Analog In. I have attached a copy of the code. If someone wouldn't mind taking a peak at it to see why it freezes when I mess with the UI thread. (ie move windows.)
    Top Level VI is Ain.vi
    Thanks in advance!
    Roger
    Attachments:
    Ain.llb ‏2900 KB

    Not sure about this one. I get different behavior than you�re describing, but I�m running WinXP on fairly fast PC. When I first click on the title bar, I get a slight pause in the execution, but it then resumes and runs while moving the window around. I think this means there�s nothing explicitly blocking due to running in the UI thread.
    One thing you might want to do is try to cut down on your use of Local and Global variables. You�ve got some pretty large and complex data structures in the Globals. Reading a Global or Local variable causes a copy of the data of the variable to be generated. This might be causing some performance problems, but I still don�t think that it should be stopping the execution. You might consider using LabVIEW 2 style Globals, sometimes called Functional Globals. The follow steps briefly describe how to make one.
    A while loop that executes once, an uninitialized shift register, a case structure, two controls and an indicator.
    Inside the loop create a case structure that has two states (read, write), create a control that will determine the state of the case structure and wire it to the input.
    On the while loop create a shift register.
    Outside the while loop place an indicator of the data type that you need the global to be. Wire the output of the shift register to your indicator.
    Place a control of the same data type as your indicator in the 'write' state of your case statement, wire this to the RHS shift register.
    Change to the 'read' case and wire the LHS of the shift register through the case structure to the output tunnel.
    You will now have a VI that performs a global function, set-up the connector pane and try using it as a sub-vi within you application.
    One thing to consider here. In your original post, you said that you used a count down timer to show that when drug and then release the window, that time/code did not continue. Are you still sure the diagram is not executing? Could it be that the front panel is not updating but the code is still running? Just a thought.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

Maybe you are looking for

  • Attaching a portable usb drive to copy pictures/music etc

    Is this possible? as its a micro usb and my hard drive has a normal USB connection. Post relates to: HP TouchPad (WiFi) This question was solved. View Solution.

  • A Feature that would be Nice: Song Name Popup

    I hear a song over and over again in iTunes and I still don't ever remember the name of it, and I would be too busy to switch to iTunes and look at the song name (and I don't want to do that every time). So I think that there should be an option to d

  • How to add RadioButtonGroup?

    I put 2 RadioButton on stage and specify them as belonging to the same group. However, when I export them as a symbol and try to use it in AS3, I can't access that group, only individual buttons? How can I get the group into my symbol too?

  • Link Error: could not initialize java VM

    When I try to run a project I get this error, I have downloaded and installed the lastest version of jre and sdk. It still will not work thought...how can I fix this (I am running windows xp)

  • Remove authorization of forcefully accepting the MIC.

    Dear All While result recording if value entered is not equal to or in between the specified limit then MIC is rejected automatically. But there is an option to set it for processing and then forcefully accepting it. I want to remove this authorizati