move

Java move jlabel in animation every 0.5 second

空扰寡人 提交于 2019-12-02 02:15:57
I want simple animation to set location every 0.5 second but it doesnt animate only set location at the end of the loop. int x=1; int y=1; while(x<100){ jLabel1.setLocation(x, y); x=x+10; y=y+10; try{Thread.sleep(500);}catch(InterruptedException e){} } I have tried drawing animation with thread.sleep() and it worked, it was animated correctly but unfortanly that is not option for me as i need to move jlabel around frame wich has figure picture inside it. Can someone pls help me with this problem. i have tried with this two same result jLabel1.setBounds(x, y, jLabel1.WIDTH,jLabel1.HEIGHT); /

Cannot move std::unique_ptr with NULL deleter to std::shared_ptr?

为君一笑 提交于 2019-12-01 22:52:47
I want to move a NULL std::unique_ptr to a std::shared_ptr , like so: std::unique_ptr<float> test = nullptr; std::shared_ptr<float> test2 = std::move(test); As far as I know it should be legal to do so, and it does run fine in Visual Studio 2015 and GCC. However, I can't do the same with a std::unique_ptr which has a deleter declaration, like so: std::unique_ptr<float,void(*)(float*)> test = nullptr; std::shared_ptr<float> test2 = std::move(test); The code above will not compile in visual studio and will trigger the static assert failure "error C2338: unique_ptr constructed with null deleter

tkinter (python): assign class method to a key

自闭症网瘾萝莉.ら 提交于 2019-12-01 22:49:04
In my simple code, a red ball is falling down in a straight line (that's working). When I push the right arrow key, I want the ball to also move in right direction. This is not working, however. What am I doing wrong? from tkinter import * root = Tk() canvas = Canvas(root, height=400, width=500, background='black') canvas.pack() class Bird: def __init__(self, canvas, coords): self.canvas = canvas self.coords = coords self.bird = canvas.create_rectangle(coords, fill='red') def gravity(self): self.canvas.move(self.bird, 0, 10) self.canvas.after(200, self.gravity) def moveRight(self, event): self

Move Semantics in Golang

杀马特。学长 韩版系。学妹 提交于 2019-12-01 21:37:52
This from Bjarne Stroustrup's The C++ Programming Language, Fourth Edition 3.3.2. We didn’t really want a copy; we just wanted to get the result out of a function: we wanted to move a Vector rather than to copy it. Fortunately, we can state that intent: class Vector { // ... Vector(const Vector& a); // copy constructor Vector& operator=(const Vector& a); // copy assignment Vector(Vector&& a); // move constructor Vector& operator=(Vector&& a); // move assignment }; Given that definition, the compiler will choose the move constructor to implement the transfer of the return value out of the

Move Image or Div Up As Window Resizes?

你说的曾经没有我的故事 提交于 2019-12-01 14:34:00
I have an image in my html with a class of "stretch". Currently, with css, this image re-sizes as the window re-sizes to be 100% of the screen width. I would also like it to move upwards as the window is being re-sized. I'm assuming this can be done with jQuery but I am not quite sure. Basically the "top" css value just needs to change as the screen width does. Here is the css that is currently re-sizing it: .stretch { width: 100%; height: auto; min-height: 420px; position: absolute; top: -200px; } Thanks, Wade var origWidth; $(document).ready(function() { origWidth = $(window).width(); /

Batch Scripting Moving files with timestamp

被刻印的时光 ゝ 提交于 2019-12-01 14:15:17
So basically I have a file system C:\Test\BaseLine. Under BaseLine folder I have many folders, it could be one folder or 15 folders, in those folders are image files. I want to copy all the images from INSIDE those folder NOT including BaseLine folder into another location namely C:\Test\Achieve Images with Date stamp as 03-07-2014 at the end of each image. For example i'll have folder system like this: BaseLine - 1.jpg, 2.jpg ->[Folder 123] - 3.jpg, 4.jpg ->[Folder 321] - 5.jpg, 6.jpg At the end of my script i should have my C:\Test\Achieve images having these images like so: Achieve Images -

The efficient way to write move copy and move assignment constructors

房东的猫 提交于 2019-12-01 09:20:20
Are the following assignment and copy move constructors the most efficient? if anybody have other way please tell me? I mean what bout std::swap? and calling assignment through copy constructor is safe in the code below? #include <iostream> #include <functional> #include <algorithm> #include <utility> using std::cout; using std::cin; using std::endl; using std::bind; class Widget { public: Widget(int length) :length_(length), data_(new int[length]) { cout<<__FUNCTION__<<"("<<length<<")"<<endl; } ~Widget() { cout<<endl<<__FUNCTION__<<"()"<<endl; if (data_) { cout<<"deleting source"<<endl; }

Use std::move in C++11 move constructor with uniform initialization syntax

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 09:17:15
I have this simple class: struct Worker { Worker() : done{false} {} Worker(const Worker& rhs) : done{rhs.done}, qworker{} {} Worker(Worker &&rhs) : done{rhs.done} { qworker = std::move(rhs.qworker); } ... } this compile fine with gcc-4.7.2 but if I try to use this version I obtain an error struct Worker { Worker() : done{false} {} Worker(const Worker& rhs) : done{rhs.done}, qworker{} {} Worker(Worker &&rhs) : done{rhs.done} , qworker{std::move(rhs.qworker)} // <- ERROR { } ... } Why? In file included from tlog.cpp:8:0: log11.hpp: In member function ‘void Log11::Worker::run()’: log11.hpp:34:29:

How to move folder/files with path names > 255 characters in Windows 8.1? [closed]

99封情书 提交于 2019-12-01 07:43:57
How can you copy/move a folder or file with path name length > 255 on windows? I have looked around for ages, and the only possible way I have found is to use the subst method. I wish I didn't have to mess about with this. I simply want to copy/move a file or directory, X , to location Y . I'm fine with making a .bat script, or other kinds of scripts to achieve this. PS: this is marked as of topic, which I'm fine with, but it was being done in a programming context. I finally found a good solution! The savior is Robocopy Robocopy supports path names > 256 by default, and even provides a flag

C# Form Move Stopped Event

强颜欢笑 提交于 2019-12-01 05:27:14
Is there any event in C# that fires when the form STOPS being moved. Not while its moving. If there is no event for it, is there a way of doing it with WndProc? The ResizeEnd event fires after a move ends. Perhaps you could use that. This is not a failsafe solution, but it's pure .NET and it's dead simple. Add a timer to your form, set it to a relatively short delay (100-150 ms seemed OK for me). Add the following code for the Form.LocationChanged and Timer.Tick events: private void Form_LocationChanged(object sender, EventArgs e) { if (this.Text != "Moving") { this.Text = "Moving"; }