Object flickers when dragged

i'm trying to write an app in which i can drag swing components around using mouse. i modified the LayeredPaneDemo in teh swing tutorial as a test.
the component i'm trying to drag is aJPanel, since it's a container, it can contain other components, so when i drag it, all components within teh panel should move all together - i registered teh mous listener on teh panel.
for this test. the jpanel has a button with icon, and a label.
but whe i drag the panel, it flickers badly, and i sees 2 panels.
however, if i register teh listener on the button, the flickering will dispear, but only teh button will be moved around, teh label stays at the same spot. thx in advance.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DragTest {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setSize(new Dimension(400, 400));
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int x = screenSize.width/2 - frame.getSize().width/2;
        int y = screenSize.height/2 - frame.getSize().height/2;
        frame.setLocation(x, y);
        Container c = frame.getContentPane();
        c.add(new Draggable(), null);
        frame.setVisible(true);
class Draggable extends JPanel{
    private final JButton dukeButton;
    private final JPanel p;
    private final ImageIcon icon;
    public Draggable(){
        //Create and load the duke icon.
        icon = new ImageIcon("images/dukeWaveRed.gif");
        dukeButton = new JButton(icon);
        dukeButton.setDoubleBuffered(true);
        p = this;
        dukeButton.addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseDragged(MouseEvent e) {
                p.setLocation(e.getX(), e.getY());
                //dukeButton.setLocation(e.getX(), e.getY());
        this.add(dukeButton, null);
        this.add(new JLabel("hello"));

i got it! the problem was that i wasn't translating the event corrodinates correctly. the e.getX() and getY() merely returns the x,y location within teh panel, after i do:
p = this;
this.addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseDragged(MouseEvent e) {
                p.setLocation(p.getX()+e.getX(), p.getY()+e.getY());
        });it moved smoothly =o)

Similar Messages

  • Object flickers when played on TV

    Hi!
    I imported in Final Cut several LiveType projects: one with a backround, another with some animated text and one with an object. I exported the final Final Cut project in QuickTime DVPal (same settings as the LiveType Project) and imported the .mov in DVD Studio Pro.
    When I play the DVD in my TV text appears perfect, and also the backround. But the object (objects/digital/encoding, its not a still) flickers all the time. Do I have to aply a flicker filter in Final Cut to the LiveType project where the object is?
    Thanks!!

    First, it sounds like your fields are reversed, so you should correct that. That will almost certainly fix the problem. If you still have a flicker problem after trying that, then attack it in FCP with a flicker filter.

  • Screen flickers when dragging from dock lists to desktop

    Hi there, I have a Mid 2010, 27 inch iMac 2.93 GHz Inter Core i7 with 8 GB ram with ATI Radeon HD 5750 1GB. Running Lion 10.7.2.
    I have noticed that lately when I click and drag an item from my Downloads (the list on the Dock) to my desktop, my screen flickers for a second before I release it. Screen shot included:
    What can be the cause of this? Is my graphics card dying after 1 year?

    Vlad - you win the award for the most cluttered desktop on the planet.    I think you get a plaque for this!
    It appears you have an issue with the graphics card.  You should run the Apple Hardware Test.
    Here's how:
    The Apple Hardware Test.
    If you have Applecare, set up an appointment at the Genius bar asap (before your Applecare expires).  If you do not have Applecare, I strongly suggest you get it asap (before you no longer qualify to buy it) and then set up your Genius Bar appointment. 

  • Keynote master objects locked when dragged onto page?

    Why can't I edit the objects on the page after dragging the master slide onto the Slides panel? It says 'The object you are trying to select can only be edited in the master slide'. I have another Keynote file where this doesn't happen.
    Thanks.

    I was successfully able to implement a rowset in a page bean.
    Here is how I did it.
    Drop VIR > State on page (creates stateDataProvider and a row set in the session bean). This step is optional. It is just one way to force the dialog box to appear in the next step.
    Drop State on page again, a dialog box appears.
    Select Create Page 1 radio button and click OK (creates stateDataProvider1).
    Drop a Table component on the page. The table displays dummy data.
    Bind the Table component to stateDataProvider1.
    Get rid of stateDataProvider and the session bean's stateRowSet. (Right-click on the nodes in the Outline window and choose Delete)
    Run the project. The table displays the data.

  • Cannot see items move when dragged

    All of a sudden I cannot see objects move when dragged in Photoshop CC Mac. They wind up in a new position when dragged but I just can't see them move as I drag them. This would seem to be a preference but do not know where to change it.

    When confronted with unexplainable Photoshop behaviour restoring Preferences (after making sure all customized presets like Actions, Patterns, Brushes etc. have been saved) is an option:
    http://blogs.adobe.com/crawlspace/2012/07/photoshop-basic-troubleshooting-steps-to-fix-mos t-issues.html

  • How to preserve size when dragging image into another image?

    When dragging a 5x4in photo into a blank 11x8.5in image, the 5x4 is shrunk more than 50 percent.  Any fix for this?

    In a message dated 9/9/2014 12:28:44 AM Pacific Daylight Time,
    [email protected] writes:
    What are the involved images’ resolutions?
       293.63 pixels/cm into 823.193 pixels/cm
    Have you tried placing the image as a Smart Object?
    No, but just treid with same shrinking.
    Larry in Berkeley, California
    >

  • HELP. How do I lock a line to a shape so it will auto extend when dragging the shape?

    How do I lock a line to a shape so it will auto extend when dragging the shape? I cant figure out how to turn this feature on and off.

    Edit: JET got there first but I believe your problem is not as complex as he would have you believe :-)
    Complex? What is simpler for the user than being able to connect pre-shaped text frames (not limited to Illustrator's silly Convert To Shape options) with rules, and then be able to move the text frames and have the rules auto-adjust (automatically avoiding other objects, automatically reshaping right-angle bends, etc. etc,) accordingly. What's "complex" about drawing a flowchart?
    One can properly construct a dozen such diagrams in a program that provides proper connector lines in the time it takes to fuss and twiddle with Illustrator for such a simple task. FreeHand, Draw, Canvas, Visio all provide connector lines features.
    The diagramming features in the draw module of Open Office is as good as any of them for the purpose of mundane decision tree diagrams, org charts, and flowcharts; and OpenOffice can be had for free. The same is true of Inkscape. You can download and install either one in less time than it will take to build a single typical such diagram in Illustrator. Using such tools is vastly more intuitive for a beginner than futzing about with Illustrator's "direct selection" routines.
    JET

  • Mac Pro + Airport Extreme = Mouse Cursor Chaos Display Issues When Dragging

    Graphic display issues (mouse lag and latency displayed on the screen when dragging an object (photo, window, application, document, etc.) from the top 50% of the screen to the bottom 50% of the screen. Mouse cursor starts to display serious lag and latency and loses ability to stay on the object being dragged anywhere below the 50% horizon line of any display.
    Mac Pro (any model 2007 to current 2009 production) with Airport Extreme installed.
    Symptoms:
    On any object the mouse cursor selects and then drags from anywhere in the upper portion (50%) of the screen display (no matter the display being used) to the bottom portion (50%) of the screen display, shows great lagging and latency as if the cursor is "hanging on for dear life" or as if the processor were running several intense applications and cursor was not responding.
    The mouse cursor fails to stay in concert with the object being dragged anywhere in the lower portion of the screen although is fine in the upper portion of the screen.
    Issue only presents itself when selecting and dragging an object from bottom to top or top to bottom of the display.
    I have deduced that the issue with this "polarity" (i.e. the 50% horizon level of the screen north and south) is due to some magnetic or waveform interference from the Airport Extreme card and most likely due to its position on the motherboard and/or next the the Intel processor. Also could be enhanced by the Bluetooth card which is also located next to this card.
    After checking various Mac Pros (at Apple stores, friends and received via Apple Online store) the common denominator is the Airport Extreme Card. When it is NOT present, no issues are present with display cursor lag; when it IS present, all the above apply.
    No one at Apple seems to realize this issue or cares about it. Ditto for Genius Bar Apple Employees; seems to be a mystery on par with the Bermuda Triangle (which ironically is also magnetically-polarity related.)
    Still waiting for a Apple Product Engineer to contact me and have 3 tickets open with Apple from 3 different Mac Pros on this. Problem first noticed May 2009 although first generation Mac Pro from 2007 also suffered same issues and just now putting the puzzle together on this relationship.
    Any others out there notice this as well? Check it out if you have a Mac Pro and Airport Extreme Card installed inside of it.

    I also have the same exact problem. I have a i5 iMac Mid 2011 with an upgrade to 10.10 Yosemite connected to an external display. I like you never had this issue with Mavericks. Zoom is so painfully slow now that I had to disable it. My iMac has 12 GB of RAM and even with no apps opened, zoom is killer slow.. makes me want to punch a wall-kinda slow.
    I think it's clear to say that something is up with 10.10.. some bug.
    Apple please fix us zoomers

  • Icon flickering while dragging a tree node

    I am working on a DND on a tree to a list. While dragging the Icon is set as the cursor. Everything is working fine but when I am dragging the Icon is flickering. the Icon is not clear till I drop it. Is there a way to avoid this flickerring of Icon when dragging. Thanks.

    I see the Icon at the TopLeft corner of the Rectangle. I don't see the rectangle where the Icon is.
    Icon | |
    ------- |
    |
    -------------------|
    I see something like this without border for rectangle. Maybe it's the matter of setting the Cursor size to Icon Size. How can I do this? Thanks.

  • UI delay when dragging

    When dragging a key frame or object it takes about 10 seconds to let go of that object or key frame. I'm working in a after effects comp that uses 3d lights solids and ai vector imaged. The file was started on a Windows machine in which it had no issues
    -I'm working in after effects on my new mac pro that is currently the fastest and most expensive computer that apple sells 5/25/14.
    -I'm working in an after effects comp that uses 3d lights solids and ai vector images.
    -The file was started on a Windows machine in which it had no issues.
    On the Mac. Moving lights or key frames in the time line  it really lags really lag and is barely workable.
    Just got this mac wondering if I need to adjust settings. I hope...
    BTW other things are in fact very fast such as ram preview

    Todd
    thanks for getting back to me so quickly I’ve answered the questions below.
    Let if you need any thing else
    G
    What exact version of After Effects? Include the minor version number---e.g., After Effects CC (12.2.1) or After Effects CS6 (11.0.4). Do not just say "After Effects with the latest updates" or "After Effects CC"; give the specific version number.
    After effects cc 12.2.1.5
    Have you installed the recent updates? (If not, you should. They fix a lot of problems.)
    Yes this morning 5/25/14
    What operating system? This should include specific minor version numbers, like "Mac OSX v10.6.8"---not just "Mac”.
    osx 10.9.2
    If you are getting error message(s), what is the full text of the error message(s)?
    No error message
    What were you doing when the problem occurred? What is the exact sequence of steps that you are taking
    moving a key frame of element in an after effects comp
    Has this ever worked before? If this worked before by doesn't work now, what has changed on your computer in the intervening time?
    Yes on a different computer windows AE
    Tell us about your computer hardware. Include CPU type and number of processor cores, amount of RAM installed, GPU, number and sizes of connected monitors, number of disk drives, and how any external drives are connected.
    Mac Pro
    Processor  2.7 GHz 12-Core Intel Xeon E5
    Memory  64 GB 1867 MHz DDR3 ECC
    Graphics  AMD FirePro D700 6144 MB
    Software  OS X 10.9.2 (13C64)
    What versions of drivers for your graphics hardware do you have installed (including CUDA driver and driver for display adapter)?
    what it came with
    Do you have any third-party I/O hardware (e.g., AJA, Matrox, Blackmagic, MOTU)?
    NO
    What kind(s) of source footage? When telling about your source footage, tell us about the codecs, not just the container types. For example, "H.264 in a .mov container", not just "QuickTime”.
    illustrator files, solids, action essentials stock footage QT( PNG codec)
    Do you have QuickTime installed. (You should.) If so, what version? The answer should be specific, such as "QuickTime 7.6.2”
    YES 10.3
    What other software are you running?
    None
    Do you have any third-party effects or codecs installed?
    not used in this comp but Motion tracker by foundry
    Are you using OpenGL features in After Effects?
    I don’t know classic 3d
    Does the problem only happen with your final output, RAM preview, or both?
    NA
    Are you using Render Multiple Frames Simultaneously multiprocessing
    NO
    Are you using the ray-traced 3D renderer
    NO
    If the problem is with output, give your exact output settings (both render setting and output module settings). Screenshots help.
    NA
    24759 ViewsTags:

  • CE10 Enterprise error "Object Expected" when tyring to view a report.

    I'm getting an error when I try to view a report connecting to Crystal Enterprise that states "object Expected". 
    However I can schedule the report and see the results so the ONLY problem is trying to view the report.
    Now, I have searched these forums and I came across and thread with the title "CE10 - Automation server can't create object Error " and the person responding says "...Your solution might be in note #1216330".
    So how do I find that note in these forums?
    I really need to get this issue resolved.

    Hi Debbie,
    The note means the SAP note (Knowledge based article)
    You can access the SAP note by going to the Service Market Place (SMP) by using the below link
    http://www.service.sap.com
    Click on the SAP note search and put in the above number to search the note.
    In case you are not able to get it below is the content of the same note.
    1216330 - Err Msg: "...Automation Server can't create object." when launching ePortfolio
    Symptom
    In Crystal Enterprise (CE) 8.5 or 9 when ePortfolio is clicked on the Crystal Enterprise Launchpad, the following error occurs:
    "There was an error retrieving data from the server: Automation Server can't create object."
    Why does this error occur and how can it be resolved?
    Resolution
    This error occurs if a Hot Fix is installed under a user account that does not have sufficient rights to correctly install it. If this occurs, Enterpriseframework.dll is not registered with the operating system and Sessionmanager.dll is not loaded correctly.
    To resolve this error message, do one of the following things:
    " Log on to the CE server using the local administrator account and run the Hot Fix executable again.
    - OR -
    " Reregister Enterpriseframework.dll
    To do this:
    1. Log on to the CE server with the local administrator account.
    2. Open Microsoft Windows Explorer and navigate to C:\Program Files\Crystal Decisions\Enterprise 9\win32_x86. Leave Windows Explorer open while performing the rest of this procedure.
    3. Click 'Start', and then click 'Run'. The 'Run' dialog box appears.
    4. In the 'Open' field, type "REGSVR32". Do not click 'OK' yet.
    5. Drag Enterpriseframework.dll from the Windows Explorer window into the 'Open' field of the 'Run' dialog box behind REGSVR32.
    You will see the following after you drag the DLL into the 'Open' field:
    REGSVR32 "C:\Program Files\Crystal Decisions\Enterprise9\win32_x86\
    Enterpriseframework.dll"
    6. Click 'OK'.
    The following confirmation appears:
    "DLLRegisterServer in C:\Program Files\Crystal Decisions\Enterprise 9\win32_x86\Enterpriseframework.dll succeeded."
    Now you can successfully launch ePortfolio from the Crystal Enterprise Launchpad.
    Keywords
    LAUNCH PAD OPEN LOG ON LOGON LOGIN LOG IN Crystal Enterprise ePortfolio User Rights , c2013852
    Regards,
    Aditya Joshi

  • Ordering of List Box Events when Dragging

    I have a multicolumn listbox in which dragging of objects to reorder them is enabled, and I have an event structure handling these drags as well as selection of different items in the list. A problem occurs because when dragging and dropping, LabVIEW generates a value change event before a drag event. In other words, if the user drags an item from position 7 to position 1, LabVIEW first generates a value change event with value 1, then generates a drag event indicating that item 7 has been dragged to position 1.
    The reason this causes a problem is that the listbox is not the data, it's just a representation of the data for the user. The value of the listbox gives an index into an array of objects, and next to the listbox I have a subpane where I insert a VI that allows the user to edit the object; which VI is inserted here depends on the runtime type of the object. 
    To accomplish this, on a value change event, I take the new value to get an object from the array and call a method that gives a VI reference, which is then inserted into the subpane. On a drag event, I rearrange the array and then generate a value change event. So when the user rearranges the list with a drag operation, dragging an object of type A into position 1, previously occupied by an object of type B, the sequence of events is as follows:
    1) Value change; new value = 1: Object at position 1 is type B, so VI B is inserted into the subpane.
    2) Drag; old value = 7, new value = 1: Array is rearranged; object of type A is removed from position 7 and inserted at position 1.
    3) Value change; new value = 1: Object at position 1 is type A, so VI A is inserted into the subpane.
    The result of all this is that the controls for a type B object flash briefly before being replaced by the controls for a type A object. This is a minor but irritating interface glitch.
    Is there a way to change this behavior? If that drag event weren't preceded by a value change, there would be no need to change the subpane at all on a drag event, since the same object is selected before and after; but in the value change event handler, I have no choice but to put a new VI in the subpane, since there seems to be no way of knowing whether the user selected a different item or dragged an item to a different spot.

    You have given a good explanation but is it possible for you to post a sample VI that demonstrates the behavior that you explained?
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • How do i control my object effects when i use a button?

    I want to use a button so when I click on it a square rises up from the bottom of my slide.  What I'm finding is by the time I click the button to make the square visible its effect has already loaded with the slide so you don't get to see the squares effect working, how do i pause the effect of the square until I have pressed the button?  Should I just make the button jump to a duplicate slide so the effect hasn't loaded if so this will be a pain when I have several buttons on the slide that I want to make objects move when i click them?

    Hello,
    Nothing to do with button becoming inactive, really, but with the way the Effects are scripted. Will try to answer your question about the buttons however.
    I'll try to explain the functionality of a button.  A button typically has a pausing point that is visible on the timeline, right? The portion before the pausing point is the 'active' portion, which will mean that the user can click on the button and this will have results. When you click on a button, the action attached as Success action is triggered, in this example the Text Caption is set to visible. But at the same time the playhead is released and moves beyond the pausing point into the Inactive portion, which means that it cannot be clicked again.
    Two possible solutions:
    use a rollover caption instead of your click/text captions work flow.
    Create a small advanced action BtShow1 and BtShow2 for each of the buttons, again I have screenshots ready but they are not accepted, bummer.... Will try to write the statements:
    Show Text_1      for the first button, shows the correct Caption
    Hide Text_2       hides the other caption that could have been shown by the other button
    Assign rdcmndGotoFrame with rdinfoCurrentFrame            this expression puts back the playhead directly before the pausing point so that button remains active
    You can duplicate this action to create Btn2, and you only have to reverse the ID's of the Text Captions
    When you attach those actions to the buttons, you can click as many times as you want. You tell that you have searched the forums? Bit strange because I have been explaining this so many times, and blogged about this kind of micro-navigation (frame by frame):
    Micro-navigation in Adobe Captivate
    Lilybiri
    PS: when updating, I can insert one image, will try to add the other one, in a second update perhaps

  • When dragging mail to a new folder in Mail, the item sticks to my cursor and won't let go.

    I like to keep certain emails organized in folders. When dragging my mail today, the envelope icon on the cursor stuck to it, would not release to the selected folder and would not move the item. In the menu pull down, I could access an option under Message saying Move to (folder) again. Force Quitting helps, but after relaunching, the behavior recurs if I try to drag and drop. The envelope icon remains stuck to the cursor, even if I go to another application. It doesn't resolve until I Force Quit again.

    Update: same thing was happening with Safari 6.1.1 when I tried to drag a URL from toolbar so could save a Webloc. Then I restarted my Mac and both problems went away. Sure hope it's permanent!

  • Why, since CS6 does DW now use ABSOLUTE image paths when dragging images into Design View from a folder in Finder?!

    While I am grateful the previous issue I had with not being able to drag files into design view at all (in CC and CC2014) was resolved.
    Guys (Adobe), seriously, if you're going to change the functioning of something that used to work just fine, at least supply a way for a user to revert to the old way... I absolutely loathe that I need a legacy version of DW to continue with my current workflow. Please put it back to the way it was, or at least allow a user to chose between the two behaviours.
    If there is a way to do this, without using the Site Manager (which still doesn't work from Finder even with relative to document selected), I would appreciate any guidance.
    As for using the Site Manager (before some smart guy suggests that I just use that) I do not wish to navigate to and create up to 20 "sites" a week and wait for DW to cache them all, when I am already in the folder with the image assets in Finder.
    Also before someone pipes up and says: "You shouldn't be diving sites in design view anyway", I don't... I develop many, many newsletters every week and the folder structure is such that navigation to the actual image folder using the Site Manager would be painful at best.
    I don't really like having to and replace all instances of "file:///Users/me/Work/company/Mailers/Year/wk14/mailer/dev/img/prod5.jpg". It is horrendously wasteful, time-wise.
    Thanks in advance for any helpful replies

    Sorry Murray, DW used to have an idea, my point is that since CS6 its developed a case of Amnesia.
    The "elements" are in the "root" folder as follows:
    newslettername.htm
    img
         imagename.jpg
    So the relative path would be <img src"img/imagename.jpg" />
    However since the change: <img src"file:///Users/me/work/Company/year/week/campaign/img/imagename.jpg" />
    Which is completely useless and needs to be corrected before I upload the html anywhere.
    As for using the site directory, I did answer that in my initial post. I use a laptop, I really don't want a site manager taking half my screen just so I can see the folder structure and navigate with that, especially since I am already at the files I need in Finder.
    Again, this is something that used to work just fine in previous iterations of DW, so I don't believe Adobe is incapable of fixing it nor am I being unreasonable asking for a choice for those that may find the local absolute paths useful in some way. All I want is to be able to chose not to use absolute paths when dragging from Finder.

Maybe you are looking for

  • Mac mini as a server for video editing?

    Hi I have bit of networking experience as well as being a mac user for over 20 years. I am however at the moment stuck on finding a solution to our current workflow. We are a small production company and have the following: (1) 2013 iMac (2) 2013 Mac

  • LG IPS display with HDMI plugged to Macbook Pro worked only once

    Hi! I bought this display (http://www.lg.com/us/monitors/lg-IPS237L-BN-led-monitor). I plugged it to my Macbook Pro 13 with Mac OS X Mountain Lion updated to the latest version using a HDMI cable and a HDMI to Mini Displayport conversor. It didn't wo

  • Eclipse -  Application over run but not over debug

    Use Eclipse 3.2.0 on WinXP, jdk1.6.0_06, my project over run can implement completely normally. With the attempt with debug aborts: In Eclipse-log: +!ENTRY org.eclipse.jdt.launching 4 120 2008-05-09 11:21:14.140+ +!MESSAGE Verbindung zu VM kann nicht

  • Color of brushes won't change

    Whenever I try to paint onto the selected layer with a brush, it goes on white. The foreground color is red and background color is blue, but all brushes paint white. Help?

  • How to solve Address in use: JVM_Bind error in server sockets?

    I have a ServerSocket program. My prob is when the client, which initiates connection to the ServerSocket, disconnects itself from the server. The SocketServer should automatically wait for a new connection. My program works fine, however there are t