freeze

GUI Freezes During While Loop in Java

我的梦境 提交于 2019-12-02 15:41:01
问题 http://i.stack.imgur.com/XvHm5.png When I click the On button it should start spamming 1's across the JTextField. Instead The entire GUI freezes, including the close button. I am using a while loop that will stop when you click the jButton again. Because the jButton is frozen i cannot stop this program. I have read that Threads and Multithreading would help but all of the tutorials are too complex for me to understand. They say to put the loop and GUI on different threads. I want to

Why does this code hang on reaching the first ReadLine from a StreamReader?

[亡魂溺海] 提交于 2019-12-02 15:16:58
I was passing a large file in the first arg to SendXMLFile() below but, since it was causing the handheld device to "hang"/"freeze" I temporarily hard-coded a much smaller file (3 KB as opposed to 1121 KB) for testing. The file does indeed exist (in the same folder as the .exe/.dll), as can be seen by this code: // test with smaller file: fileName = "DSD_v6666_3_20140310140737916.xml"; MessageBox.Show("Made it before file.Open"); using (FileStream fileTest = File.Open(fileName, FileMode.CreateNew)) { fileTest.Write(info, 0, info.Length); fileTest.Flush(); } if (!File.Exists(fileName)) {

Freezing Columns in JQGrid

不问归期 提交于 2019-12-02 11:37:56
Is there a way to get jqGrid to freeze one or more left-most columns and have the balance of the columns scroll left-and-right? I did Google up at least one person who claims to have done it here: http://www.trirand.com/blog/?page_id=393/discussion/new-freeze-column-plugin/ ... but the sample code is gone. (Ironically and painfully, the screencast of it working is still up, mocking me.) It looks like some here have gotten it working too , but didn't include code. Has anyone gotten frozen columns with scrolling working in a jqGrid with that plugin or another similar plugin? Anyone have that

GUI Freezes During While Loop in Java

亡梦爱人 提交于 2019-12-02 09:42:11
http://i.stack.imgur.com/XvHm5.png When I click the On button it should start spamming 1's across the JTextField. Instead The entire GUI freezes, including the close button. I am using a while loop that will stop when you click the jButton again. Because the jButton is frozen i cannot stop this program. I have read that Threads and Multithreading would help but all of the tutorials are too complex for me to understand. They say to put the loop and GUI on different threads. I want to understand this to fix another program that I am working on which is much more complex. Thats why I made a

C# - for Loop Freezes at strange intervals

只谈情不闲聊 提交于 2019-12-02 07:21:35
I am working on Problem 14 on Project Euler, and my code seems to freeze at random intervals for no apparent reason. static void Main() { int maxNum = 0; int maxLength = 0; for (int x = 2; x < 1000000; ++x) { int num = x; int length = 0; while (num != 1) { if (num % 2 == 0) { num /= 2; length++; } else { num = (3 * num) + 1; length++; } } if (length > maxLength) { maxLength = length; maxNum = x; } } Console.WriteLine(maxNum); Console.ReadLine(); The number that the program hangs at is different each time I run it and doesn't seem to follow any set patterns. Any ideas on why it would be hanging

Xcode 4.4 & 4.5 freezing on project close

久未见 提交于 2019-12-02 04:00:07
Ever since upgrading to Xcode 4.4 and again upgrading to 4.5 (running on Lion), Xcode appears to freeze for about 3-5 minutes every time I close my app project or quit. During this time, activity monitor shows that the CPU is pegged at 95%, although little disk activity is occurring. I have tried uninstalling and re-installing Xcode and this didn't make a difference. Anyone else experiencing this? Any suggestions what I could do? Thanks in advance! This issue is reported: https://discussions.apple.com/thread/4160869?start=0&tstart=0 来源: https://stackoverflow.com/questions/11817771/xcode-4-4-4

Why does Thread.Sleep() freeze the Form?

こ雲淡風輕ζ 提交于 2019-12-02 03:49:24
问题 I try to experiment with Thread.Sleep() . I created basic Windows Forms application with one button. private void button1_Click(object sender, EventArgs e) { Thread thread1 = new Thread(DoStuff); thread1.Start(); for (int i = 0; i < 100000; i++) { Thread.Sleep(500); button1.Text +="."; } } public void DoStuff() { //DoStuff } When I click my button the DoStuff method works fine, but the GUI freezes and nothing happens. Can someone explain me why? 回答1: To keep the UI active, you need for the

Why does Thread.Sleep() freeze the Form?

。_饼干妹妹 提交于 2019-12-02 01:37:59
I try to experiment with Thread.Sleep() . I created basic Windows Forms application with one button. private void button1_Click(object sender, EventArgs e) { Thread thread1 = new Thread(DoStuff); thread1.Start(); for (int i = 0; i < 100000; i++) { Thread.Sleep(500); button1.Text +="."; } } public void DoStuff() { //DoStuff } When I click my button the DoStuff method works fine, but the GUI freezes and nothing happens. Can someone explain me why? To keep the UI active, you need for the main UI thread to service its message pump. It can only do that when it is not handling UI events. In your

Java GUI, need to pause a method without freezing GUI aswell

こ雲淡風輕ζ 提交于 2019-12-02 01:19:49
问题 I know that this problem is caused by the sleep or wait calling on the main thread and that the answer on how to solve this will be to put the method into a seperate thread and then make that thread sleep. But the code is a mess and don't really have the time to sort it out and split it up into separate threads and was wondering if there is any other way of doing this? Even if it is not the cleanest or most common practice for working with GUIs. I only need about a seconds pause from the

Java GUI, need to pause a method without freezing GUI aswell

百般思念 提交于 2019-12-01 21:43:24
I know that this problem is caused by the sleep or wait calling on the main thread and that the answer on how to solve this will be to put the method into a seperate thread and then make that thread sleep. But the code is a mess and don't really have the time to sort it out and split it up into separate threads and was wondering if there is any other way of doing this? Even if it is not the cleanest or most common practice for working with GUIs. I only need about a seconds pause from the method. You can't do it without creating a separate thread. Creating a thread in Java is easy. The only