GUI 1 « Thread « Java Swing Q&A





1. Best Way to Constantly Update GUI Elements    stackoverflow.com

I have a Java GUI that has a number of text fields, the values of which are populated from static variable in another class. I am interested to know what the best ...

2. What is the best way to link your application to Swing GUI?    stackoverflow.com

If I have Swing GUI class and application, how should I manage communication between these objects? Should I pass GUI object link to app or app link to GUI? Example:

public class ...

3. How to instantly termainate an un-supervised script on demand?    stackoverflow.com

I have a GUI which resembles an interpreter. It allows the user to write a script in Jython (implementation of Python in Java) and run it whenever he wants. Apart from ...

4. How do I give this CPU-intensive Java application a GUI?    stackoverflow.com

I'm writing a little genetic algorithm in Java, as a school assignment. Up until now I've pretty much stuck to doing console applications. However I think a UI would be really ...

5. Java: Deleting a GUI object from within the GUI    stackoverflow.com

Can you help me out here? A really simple problem but I just can't get what the solution is! I am coding a listener application that runs on its own thread & ...

6. tooltip causing deadlock in swing/netbeans-rcp    stackoverflow.com

Hi I have a netbeans platform based app. It has an outlineview, with several columns. when i have my app maximised. and hover over the right most column to display the tooltip ...

7. How the simples GUI countdown is supposed to work?    stackoverflow.com

I am trying to write the simples GUI countdown. I found in Internet some code but it is already too fancy for me. I am trying to keep it as simple ...

8. Java Thread problem - updating GUI    stackoverflow.com

I'm trying to use threads to run a lenghty operation in the background and update the UI. Here's what i'm trying to do:

  1. on a button click, display a popupjframe with a message ...

9. IO thread alert GUI thread if error occures    stackoverflow.com

I have a client/server question that i am trying to figure out the best solution for. If a client ever gets disconnected from the server, for any reason, i would like a ...





10. gui hangs even with thread    stackoverflow.com

I have a problem with a java gui and opening a document. My problem is the complete gui hangs until the document is open, but I already threaded the action... I have ...

11. How to figure out when I should make a function call within GUI thread    stackoverflow.com

How can I know, whether I should make a function call within GUI thread.

if (SwingUtilities.isEventDispatchThread()) {
    // ...
} else {

    SwingUtilities.invokeLater(new Runnable() {
  ...

12. Handling GUI with SWING with multithreading when the GUI does not update informations    stackoverflow.com

So I have a desktop application designed using the MVC pattern inspired by this tutorial (but slightly modified). What this application needs to do is to copy a list ...

13. Exception in thread when refreshing the GUI    stackoverflow.com

My problem is simple, the code is complex and the answer is not so easy to find, so I'm asking for help. I'm programming a multi threaded application, here's how it works: 1) ...

14. Threads in GUI (Swing) - application unfreeze    stackoverflow.com

I have a question regarding threads in Java Swing Application. There's a module in my app which receives and sends email messages. I'd like to assign an action to a Button ...

15. Can not fill an array in thread    stackoverflow.com

This gui should draw moving images on frame panel called "system". But first of all i need to make those objects. Here i'm trying to add them to an array and ...

16. Java thread issue    stackoverflow.com

I'm working on an application in Java that is required to update its results every second until it is stopped. For 30 seconds it will call a certain set of methods ...





17. Java server client thread issue    stackoverflow.com

Hello I have a very simple client-server program that uses sockets simulating a simple atm. In the client part of the program i have a gui class and another thread to communicate ...

18. GUI/Threading Instability in Java on OS X; seems to be related to the Swing/AWT -> Cocoa bridge    stackoverflow.com

I've run up on a really frustrating problem involving OS X and Java Swing GUIs; specifically I'm having a problem with Cocoa Compatibility mode. I work at a robotics lab, and a ...

19. Starting Thread after GUI construction    stackoverflow.com

I have a program that builds the GUI in the constructor. I need a Thread separate from the EDT to run immediately after the object in question is constructed. ...

20. StackOverflowError when using Threads    stackoverflow.com

I am working on a program that is a projectile motion simulation with a user interface. I am getting a StackOverflow error and it seems to occur where I try to ...

21. Operation priority in Java. (An object instantiates and runs before the GUI is updated?)    stackoverflow.com

I want the GUI to change the title of a button from "Go" to "Working..." before an object is instantiated and actually does the work. When finished, I want the ...

22. GUI /application communication    stackoverflow.com

What is the best way to handle GUi/ internal application communication. I have many underlying threads processing data, and would like to post their output to the gui. Should I have some ...

23. Java - using thread with GUI    stackoverflow.com

I'm having an issue with my GUI when I try to change the color of a button after 2 seconds when its has been clicked. What I want to do is ...

24. How to pass the message from working thread to GUI in java    stackoverflow.com

How to pass the message from working thread to GUI in java? I know in Android this can be achieved through handlers and Messages Class. But I want the same thing ...

25. Refreshing GUI by another thread in java (swing)    stackoverflow.com

I have a main program, in which GUI is based on swing and depending on one of four states the GUI elements have different parameters.

public class Frame extends JFrame implements Runnable ...

26. GUI isn't shown while thread is in procces in JAVA    stackoverflow.com

i'm making simple game with very simple thread (1 sec delay) got problem with the thread, i have while(true) loop with the code:

try 
{
    while (true) 
   ...

27. Updating GUI - > Flickering effect    stackoverflow.com

I currently have a JFrame where on it's content pane I draw images on from a game loop at 60 frames per second. This works fine, but at the right side, ...

28. 6.9.1 GUI Designer problem - possible deadlock?    forums.netbeans.org

Posted: Fri Aug 20, 2010 9:53 am Post subject: 6.9.1 GUI Designer problem - possible deadlock? Platform: Windows 7 64bit I've been using 6.9.1 for a few days now; at first I installed over existing NB 6.9 but found significant problems - IDE hung while formatting .java, .jsp IDE hung opening GUI design forms. After several attemps to ...

29. Update the GUI from an external thread    forums.netbeans.org

Hi, I'm developing a simple plug-in that will update the GUI of the plug-in itself (a label in a view) from time to time, according to an external Thread. Now, in Eclipse I start a Thread and I crate a Runnable that gets executed by the one and only GUI thread by a call to

30. How to remove the gui code deadlock    forums.netbeans.org

Hi. I've been messing around with the netbeans gui, and although I find it great, there are things that I can't seem to do, for example: Removing an event I wrongfully added; Deleting a jLabel; (or anything else) If I right click on it in the Navigator and chose refactor -> delete it says it's in use by method X and ...

31. 6.9.1 GUI Designer problem - possible deadlock?    forums.netbeans.org

Happens to me also!!! vrey annoying issue. I found a bug on it (187697), but it is supposed to be resolved in JDK update 24 (or so..). I updated my JDK and it worked like a charm.. until recently. now I can't open any GUI from in neatbeans, even not the simplest one... please provide us with some tools to at ...

32. Pattern for GUI's with threads    coderanch.com

In answering another post, I ran afoul of the single-thread rule: code which modifies GUI components must run in the AWT event thread. Evidently this applies to AWT-only programs as well as Swing. I eventually came up with this approach and I'd like to invite comments - does anyone have a better way? Many introductory thread examples use bouncing balls or ...

33. Refreshing My GUI    coderanch.com

Hello, I have created an app that builds a gui and takes in user entries, which then passes these entries to another class file that does all the number crunching. What I want is for the number crunching to spit out a status on the gui instead of the normal System.out.prinln("stuff"). My gui code is in one .java file and gets ...

34. Thread effect on GUI and how to handle    coderanch.com

Hi All, I feel this is more related to threads than the GUI itself. As an experiment into multithreading I have been working on an application that checks to see if a number of computers are reachable and then displays the results in a table. I have this working but there is one thing that is bugging me. When the 'check ...

36. threading in swing    coderanch.com

i hope my query is valid. I hav read that threading in swing is handled by a separate thread called EVentQueue thread. It is also said that whenever threading is used in threads we hav to take care that we dont manipulate the swing components thru arbitrary running of multiple threads. Can someone please ellaborate on th above and on the ...

37. Threads and Swing    coderanch.com

38. Swing Threading issues    coderanch.com

Hi, In fact, the worker thread will complete execution even if the frame is disposed. But, if you mark the thread as daemon, then on a System.exit() in the main thread, the main thread as well as any other threads are terminated. If you want the UI Frame to be open while the worker thread completes execution, consider using a synchronizing ...

39. Centralized catch for all threads    coderanch.com

Hello, the main ui class in my project calls a method that spawns several threads. I want to know if there is a way i can put a centralized catch so that all the exceptions are caught in this. e.g MainUI.java .. try{ //this method spawns several threads which may throw exceptions ProjectManager.analyze(); }catch(Throwable t){ LogError("Exception" + t + "in some ...

41. Can threads commnicate with one another?    coderanch.com

Hello, I know that threads allow events or actions to take place in parallel. But if a method or some set of actions are being excuted in seperat threads can one one thread send another value to another thread. That is,threads can be parallel but can they also be dependent on one another? Can someone breif me on this please. Thanks ...

42. Thread problem?    coderanch.com

Hi there, I have a problem with a very simple swing app I've written, and I think I will need a thread to solve it. I am still new to swing though, and don't want to reinvent the wheel. My app connects to an Oracle database and picks up messages off of a database pipe. My interface has a slider that ...

43. ProgressMonitor and threading ...    coderanch.com

Vector data = ... //some data Vector tmp = new Vector(2); ProgressMonitor pm = new ProgressMonitor(null, "Building list", "", 0, data.size()-1); pm.setProgress(0); pm.setMillisToDecideToPopup(1000); for (int i = 0; i < data.size(); i++) { if (pm.isCanceled()) { return; } tmp = (Vector) data.elementAt(i); pm.setNote("Examining : " + (String) tmp.elementAt(0)); // do some stuff here } pm.setProgress(i); }

44. Thread is not stopped, even after it is interrupted.    coderanch.com

Hi, simply calling a thread to be interrupted is not enough. There are two ways to stop a thread, the first is the warst, you could call Thread.stop(). This function is deprecated, as I know and it doesn't work under some OS. The second is that you create for your Thread a boolean member, like bStopThread, which is false all the ...

45. Oracle chart builder finish but some threads are still alive ?!?!?!?    coderanch.com

Hello all, I'm using oracle chart builder for presenting data in my application. I use it after supplying its data for gif file generation. The chart is stacked bar but I don't think this is the problem. The problem is that it generates the gif file successfully but my application is still running after the main method is finished, I debugged ...

46. Rapidly calling inner thread classes    coderanch.com

Here's a tricky problem, which I think may be a thread issue, for reasons noted below (but I could be wrong, so I'm posting in this forum). I have a table (JClass LiveTable, but I think that's moot). The last price field in the table is constantly changing. When it changes, I need to make the text green, if its equal ...

47. Thread Issues    coderanch.com

The methods invalidate() and repaint() can definitely be called from any thread, but they are not compute-intensive (repaint() merely queues a request for painting later.) setImage may indeed be expensive, but I suspect that actually it's the image scaling computation that's costly (you just do this once, right -- you don't scale the image in a paint() method). Anyway, what you ...

48. Many (really many) tasks in Swing thread    coderanch.com

Hi there, it looks like adding too many tasks using invokeLater() causes the UI to hang. It's obvious, since the next task must wait until those added before are completed. But it never happens, tasks are executing slower and slower, and the execution stops. The UI is blocked, the event dispatch thread too. Have you ever noticed such behaviour? I did ...

49. Trouble with this thread.    coderanch.com

Hello All, I have this snipplet of code that when I run it without the thread I get my picture up fine also when I run it without the method (CongratulationFrame.dispose() I get the image on the frame fine(but it does not close). I don't know if I am doing anything wrong here, but if I am could you please help ...

50. Graphics and Threads    coderanch.com

51. The GUI Thread.    coderanch.com

52. Any success using threads to isolate printing functions?    coderanch.com

Okay- So I was able to get my question answered somewhat on the thread, but now I have a strictly AWT question (I think): I want to send a cloned ImagePanel to the printer, then allow the user to change the original to whatever they want by opening a new file. My question: Can I successfully clone the ImagePanel (or the ...

53. Swing Thread trouble    coderanch.com

I have an image viewer program in which I use a label with an Icon to view images. The left and right navigation buttons work, but I what I really want is a startShow and stopShow buttons. The startShow btn should iterate through all the images automatically with a 2 second pause starting with the current one and stopShow button should ...

54. Updating Gfx on seperate Swing thread    coderanch.com

If I understand right, there is a single swing dispatch thread which handles all the gui update code. IE pressing a button, makes it show pressed in, calling the registered ActionListeners, etc. I am unclear on the 'right' way to update a swing component outside the swing thread. The usual one would be a progress bar, but I'm trying to update ...

55. Swing thread - polling    coderanch.com

Cross-posted from Intermediate Java--- In summary, what I want to do seems deceptively simple. There are 3 classes: Config, Account, and Mail. I do something like this: Config c = new Config(); Account acc = new Account(c); Mail mail = new Mail(acc); int num = mail.checkMail(); Now I have a swing application that does this in Main(). I want it to ...

56. Swing Threading - how to force it to run?    coderanch.com

Hi there. I am busy writing a client server applications. The results of the communication need to be displayed in a JTextArea. Currently I have the communication working between the client and server on Threads and the update of the JTextArea is on a separate Thread. public void updateTextArea(String message){ final String theMessage = message; System.out.println(theMessage); Thread.yield(); Thread thisThread = new ...

57. Server Sockets Threads/Read files on Stand Alone PC    coderanch.com

Hi Hoping to get help with this small probelm that i have. I have created a client server socket and the code is complete. I am running this on a stand alone machine. I need the client to be able to call a file from the server and i need the server to get the file and display it to the ...

58. loading resultsets in multiple threads in a swing application    coderanch.com

Hi all, I am in the process of developing a J2EE/Swing application. I need to load huge chunks(approx 2000 records) of result set data into a swing grid. How do I speed up this loading huge chunk of data into the swing grid? Is there a way that I use threads, where in one thread populates a set of data and ...

60. using threads in swing    coderanch.com

Yes, you can definitely use threads. In fact, anything that is going to take some time to process (i.e. database reads, i/o activity, etc) you should consider moving the processing of those tasks to another thread. The problem if you don't is that they block your Swing Event Thread from processing any GUI activity which results in a perceived application lockup ...

61. Swing Threading    coderanch.com

62. repaint not calling paintComponent after thread suspension    coderanch.com

Hi, I'm having a problem with repaint. I'm writing a program to control a man walking around the screen carrying out instructions, for which I'm using a thread called midRunner. Up till now, my program had been working fine, but then I decided to add a button to allow the man to be paused and restarted. The pause button sets the ...

63. deadlocks    coderanch.com

64. Threads with A GUI    coderanch.com

Hey there Ranchers! I am completely new to threads, and do not really understand it completely. Here is my code import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.*; public class com implements ActionListener { JButton button; JPanel second; boolean tog = false; JFrame f = new JFrame ("Clock"); public void makeFrame(){ Container c = f.getContentPane(); c.setLayout (new FlowLayout() ); JPanel hour= ...

65. Accessing components in a new Thread    coderanch.com

Hi. I'm reading Art Of Java book and I have a question about Web Crawler example... the application has a button called "Search". This button is associated with an event listener, actionPerformed( ) method called a private method called actionSearch( ). actionSearch( ) tries to verify that some fileds are not blank, if not, it will call a private method called ...

67. Updating GUI from a different thread    coderanch.com

Hello, I've read numerous times on the java tutorials that it is not wise to update GUI from threads other than the thread that the GUI is running on. I have developed applications that are multithreaded and occasioanly some of my threads update a GUI on a different thread. i.e. I initialize my working thread with the swing instance variables of ...

68. Blinking Threads....    coderanch.com

//Run thread so list can be updated Runnable update = this; Thread t = new Thread(update); t.start(); } //Method for Runnable (Required) public void run() { UpdateThread u = new UpdateThread(); u.coreElementThread(this); } //Method for updating list public void updateList() { listPosition = coreList.getSelectedIndex();//Set current list position coreList.setListData(coreArray()); //Repopulate list coreList.setSelectedIndex(listPosition); //Retain position in list otherwise will be null }

69. threads    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

70. Another Image Doesn't Display Thread    coderanch.com

Hi, I'm quite aware that there's already a thread similar to mine. I tried searching but couldn't get the right answer. I'm suspecting that my problem is in some way different from those I've seen... So here's my problem... I try to display an image to JFrame. I do this with the use of 2 classes... My ImageExtractor class and a ...

71. multi threads    coderanch.com

public class MosaicComponent2 extends JComponent implements Runnable { private int tempX; private int tempY; private int r = 255; private int i = 1050; private Color red = new Color(255, 0, 0); private Color green = new Color(0, 255, 0); private Color col; public void paintComponent (Graphics g) { g.setColor(col); g.fillRect(tempX,tempY,10,10); } public void getRed() { col = red; } public ...

73. swing+threads    coderanch.com

The recommendation is given in the note that follows the first paragraph under the header "The Event-Dispatching Thread" on How to Use Threads. If components begin sending events to event listeners before the initial state of your app is complete it can cause trouble. This often happens with ComponentListeners and MouseMotionListeners. It can happen with listeners being added before components have ...

74. Need some examples on Swings and threads    coderanch.com

Hello.. I need some examples using Threads in Swings. I have developed a Swing application with a button and a text area. On clicking the button some content of a webiste is displayed on the text area. Next, i want to create one more button...on clickin this button the content in the teaxt area should be refreshed...this should use threads..where thread ...

75. Threading problem in java 1.5.1    coderanch.com

Hi, I have written a java program in which I have created a panel containing some text fields and buttons. In the program I am trying to set the focus on the first text field ousing the requestFocus() method.For this I am using multithreading, so that on 1 thread the components are being created and in the other thread I am ...

76. Threading issues in Swing...    coderanch.com

Hi All, I've just finished writing my second Swing app and I have some possibly naive questions about threading. First, I have broken my app up into a view class and a model/controller class. All code for manipulating the UI is in the view class and is called by the controller as needed. I've read about SwingUtilities and the fact that ...

77. Swing and threads    coderanch.com

I've been writing java in the web environment for a while, but recently had a chance to play around with swing. I have a small app that when the user clicks a button, it goes out and runs a database query. This query can run for a relatively long time (30 seconds). During that time I don't want the user doing ...

78. Thread in paintComponent doesn't paint    coderanch.com

Hi ranchers, I made a test application to just paint a dot. The paintComponent was overridden in an anonymous class of JPanel. When I changed the line commented out (bold) in the following import javax.swing.*; import java.awt.*; public class Test extends JFrame { private JPanel panel; Test() { super("T E S T"); initGUI(); } private void initGUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(300, 200); ...

79. Question about gif image and AWT (Threads)    coderanch.com

Hi, I want to be able to show a gif image that spins (like a progress). I am able to show the gif image and it is working like it should, but as soon as I do some heavy computing the gif animation stops. I have tried to somehow put the gif image in a seperate thread but it still does ...

80. using threads or there's another way?    coderanch.com

Actually, once your swing application has been displayed, you are not allowed to access any of the components from anything that is not the event dispatching thread. With the exception of a few methods, like repaint(), it is not thread safe to do so. Having a separate thread to handle the timing for changing the visibility is fine, but it is ...

81. about threads.. there's something wrong though i can't seem to find it    coderanch.com

import java.awt.*; import java.awt.event.*; import javax.swing.*; class testing implements ActionListener, Runnable { public JTextArea textArea; public JButton btn; public void createAndShowGUI() { textArea = new JTextArea(); btn = new JButton("Button"); btn.addActionListener(this); JPanel panel = new JPanel(new BorderLayout()); panel.add(textArea, BorderLayout.CENTER); panel.add(btn, BorderLayout.SOUTH); JFrame frame = new JFrame("Try..."); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(panel); frame.setSize(400, 400); frame.setVisible(true); } public synchronized void actionPerformed(ActionEvent e) { notifyAll(); } public ...

82. Thread Concept    coderanch.com

Dear friends My application consists of a method for uploading selective files... When i am clicking on a button it perform the required operation of uploading all the files which i selected... but the problem is that my progressbar is not showing any sign of progressing... I am sending the code as follows: Can you please help me out where the ...

83. Why do initComponent() in work thread?    coderanch.com

84. Anyone familiar with Multi Thread    coderanch.com

Originally posted by Adrian Lee: Hi everyone, I found my UI dead (without any response) for my following program. Someone suggested me to use multi-thread technique to modify the following function, but how can I realize this part for dispose and new()? Any suggestions would be welcome. //this actionPerformed is in UI1, and get to enter UI2 from UI1; public void ...

85. How to prevent deadlocks in Swing?    coderanch.com

In our open source application we have a few(many) model classes driving the UI panels. Currently, we take the approach of allowing the models to be fully unsynchronized and making sure that we touch/read/modify these models from within the event thread. So, when constructing/spawning a worker thread, the required values from the model are passed into the constructor of the worker ...

86. Filthy Rich Clients: Swiing and threads    coderanch.com

This is by design to allow UI and models to be unsynchronized by default, and you can use various multi-threading trickeries to support doing multiple things at the same time, namely to retain UI control and having some work done in the background. However, the lack of communication between the UI thread and spawned worker threads can be difficult to tackle, ...

87. threading issue    coderanch.com

My application uses the SwingWorker utility class for multi-threading. I'm having an issue in which a user can click "cancel", and the swingworker thread is interrupted, but the user must still wait -- staring at the hour glass -- for the process that thread kicked off to complete on the server. Now, true to thread interruption (and correct me if I'm ...

88. Problem with Thread..    coderanch.com

Hi Guys, I am facing some problem with the threads running in swing application. Scenario: I have a file which contains 20,000 records (it can be more). I am doing pagination in JTable to fetch records in chunk (100 or so, at a time). I have a search panel, where user can enter a specific records number or a range of ...

89. [Swing][Thread] How to update the GUI in a bacground task    coderanch.com

Hi, I have a Swing app (with MVC pattern) with a Browser window that browses all my items of type Variantes, and a Variante edition form. Once i save the Variante (button Save in the edition form), i want to reload all my Variantes. But this takes quiet a lot of time. I would like to reload the variantes and update ...

90. deadlock involving AWT-XAWT    coderanch.com

hi all, In our application,a custom printStream is set as the error stream. In custom printStream,println(..) methods are ove-ridden to pop a non-modal dialog after logging the error. The application has been running for 240+ hours. Then a deadlock is observed. The thread-dump looks like this. Full thread dump Java HotSpot(TM) Client VM (1.5.0_08-b03 mixed mode, sharing): "Swing updater" prio=1 tid=0x082b8a98 ...

91. logic problem or thread problem?    coderanch.com

Hi, I have a list of dynamically created components like Jlabel and JCheckBox in a panel as below: Label1cbk1 cbk2 cbk3 Label2cbk1 cbk2 cbk3 cbk4 cbk5 cbk6 . . . Labelncbk1 cbk2 cbk3 I am trying to add/store these sets of values into a hashmap. I store the labelName(String) and capture corresponding checkbox valuess(integer array) into an integer array. Then I ...

92. thread invoke later    coderanch.com

public void showManageApp(final String path,final String temp){ NativeInterfaceHandler.init(); Toolkit.getDefaultToolkit().setDynamicLayout(true); Runnable xxx = new Runnable() { public void run() { ManageDocuments md = new ManageDocuments(path); md.webBrowser.setVisible(false); md.page.setVisible(true); md.sendPostRequest(); // cookie = UserStateManager.getInstance().getAuthKey(); HTMLPath = temp + "savedHTML.html"; new ManageDocuments(path).setVisible(true); } }; // SwingUtilities.invokeLater(xxx); java.awt.EventQueue.invokeLater(xxx); NativeInterfaceHandler.runEventPump(); } i want to call this thread after execute this NativeInterfaceHandler.runEventPump(); but not calling created thread

93. thread invoke later    coderanch.com

public void showManageApp(final String path,final String temp){ NativeInterfaceHandler.init(); Toolkit.getDefaultToolkit().setDynamicLayout(true); Runnable xxx = new Runnable() { public void run() { ManageDocuments md = new ManageDocuments(path); md.webBrowser.setVisible(false); md.page.setVisible(true); md.sendPostRequest(); // cookie = UserStateManager.getInstance().getAuthKey(); HTMLPath = temp + "savedHTML.html"; new ManageDocuments(path).setVisible(true); } }; // SwingUtilities.invokeLater(xxx); java.awt.EventQueue.invokeLater(xxx); NativeInterfaceHandler.runEventPump(); } i want to call this thread after execute this NativeInterfaceHandler.runEventPump(); but not calling created thread

94. invalid thread access    coderanch.com

i have method is there NativeInterfaceHandler.init(); Toolkit.getDefaultToolkit().setDynamicLayout(true); SwingUtilities.invokeLater(new Runnable() { public void run() { ManageDocuments md = new ManageDocuments(path); md.setVisible(true); } }); NativeInterfaceHandler.runEventPump(); i am getting this exception how can solve this one org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Display.error(Unknown Source) at org.eclipse.swt.widgets.Display.checkDevice(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at chrriis.dj.nativeswing.NativeInterfaceHandler.dispatch(NativeInterfaceHandler.java:300) at chrriis.dj.nativeswing.NativeInterfaceHandler.runEventPump(NativeInterfaceHandler.java:293) at com.instacoll.livedocuments.oo.userinterface.ManageDocuments.showManage(ManageDocuments.java:2434) ...

95. Making threading easier with Foxtrot    coderanch.com

96. Threading in Swing two ways?    coderanch.com

97. Swing and Thread nightmare. Please help.    coderanch.com

Hi, This has been eating me in and out. I will give the code here you can try it out. Sorry it might be a little long/boring. import java.io.*; import java.net.*; import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.lang.Runtime.*; public class ShellCommandInterface_ver7 { JTextArea commandDisplay; JTextField commandInput; JLabel label1; JFrame frame; JPanel mainPanel; JFrame passwordFrame; String password = null; ...

98. How to crate KeyListener in different Thread?    coderanch.com

Hi, I have a class which implements KeyListener and in keyPressed() chek whether a a particular key pressed or not? In same class i have to take a decision on the basis of whether that particular key is pressed or not? But i found that control comes to keyPressed() after the decision is taken. I used sleep(), but still the control ...

99. thread problem    coderanch.com

100. gui and thread    coderanch.com

//within the actionHandler when user clicks on the close button of the JFrame Progress closingProgress=new Progress(frame,3000); Thread t=new Thread(closingProgress); t.start(); t.join(); public class Progress implements Runnable{ JProgressBar progress; JDialog dialog; Frame owner; int timeout=3000; public Progress(Frame owner, int timeout){ this.owner=owner; this.timeout=timeout; init(); } protected void init(){ dialog=new JDialog(owner); progress = new JProgressBar(); progress.setIndeterminate(true); dialog.getContentPane().setLayout(new BorderLayout()); dialog.getContentPane().add(progress,BorderLayout.CENTER); dialog.setSize(100,100); RefineryUtilities.centerDialogInParent(dialog); } public void ...