Thread « Thread « Java Swing Q&A





1. Guice creates Swing components outside of UI thread problem?    stackoverflow.com

I'm working on Java Swing application with Google Guice as an IOC container. Things are working pretty well. There are some UI problems. When a standard L&F is replaced with Pushing ...

2. From which thread should System.exit() be called in a Swing-app?    stackoverflow.com

In a Swing-app is it okay to invoke System.exit() from any thread? (e.g. on the EDT?)

3. Which is better - mainloop or separate threads?    stackoverflow.com

The scenario is this: I have Java swing application with JFrame. There is textarea where you can type things, then you get the search results in another textarea and when you ...

4. Book Recommendations: Swing & Threading in Java    stackoverflow.com

Can anyone please suggest books on swing that provide complete coverage? I am also looking for some very good books on threading.

5. Java, help with threading/swing    stackoverflow.com

import java.awt.Color;


public class bullet {

    public bullet(int x, int y, boolean up)
    {
        System.out.println("Called");    
 ...

6. How can i allow the thread which is an implementation of interface to communicate with the JWindow objects?    stackoverflow.com

How can i get the Network counter value to include in my Main JButton goal? I was doing something like this: Main.java:

package demo;

import java.awt.BorderLayout;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JWindow;

public class Main extends JWindow
{
 ...

7. how to execute two thread simultaneously in java swing?    stackoverflow.com

My aim is to select all the files named with MANI.txt which is present in their respective folders and then load path of the MANI.txt files different location in table. After ...

8. Thread in Swing    bytes.com

How to implement animation in swing using thread. Whenever I try using Thread.sleep than it is not working ex- if my pro have 3 sleep of 20 second than whole o/p ...

9. Threading AWT/Swing    forums.netbeans.org

Posted: Fri Nov 27, 2009 2:46 pm Post subject: Threading AWT/Swing Hi, I know this is a known topic and it was already discussed, but I did not ...





10. Swing and mutlithreading    coderanch.com

Excellent catch, Dave! It took me a long time to find that sucker. Since then I've learned that a Google for "java anytopic tutorial" almost always gets a winner from Sun or some university course. I have a little program that runs any number of worker threads. As it starts each one it creates a new subpanel for status display and ...

11. Sun Tips: Threads & Swing    coderanch.com

12. Threads and Swings- UI Hangs..    coderanch.com

Hello Folks, I have a user interface which allows the user to start a thread.. the Thread starts perfectly but it freezes the ui. Here is the piece of related code (java 1.4.2): From Action Performed.. starting the thread (LogArea is a TextArea on the ui printing details): { progressBar.setVisible(true); //Create a timer. timer = new Timer(ONE_SECOND, new ActionListener() { public ...

13. Problems in using Threads in JAVA SWING program    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 ...

14. Swing and Thread    coderanch.com

Respected Sirs, I have a GUI application with events. when some action generate I take some data from server(my swing application is a WebService client part). This may take some times. I want to display a JProgressBar with a meassage "Searching Please Wait". For this I am use Thread. As soon as the action generates I call the start() of Thread. ...

15. How to activate threads in Swings.    coderanch.com

Hai Frds, I'm using NetBeans,i'm getting Null Pointer exception after running, wht to do help frds... package networking; import java.io.*; import java.net.*; class Ser extends javax.swing.JFrame implements Runnable { ServerSocket server; Socket client; ObjectOutputStream output; ObjectInputStream input; public Ser() { super("SERVER DISPLAY"); initComponents(); setVisible(true); } @SuppressWarnings("unchecked") // private void initComponents() { PortNo = new javax.swing.JLabel(); PortNoTF = ...

16. Auto save thread in a Swing application    coderanch.com

I've got an application with a Swing GUI and I want it to save some data at a regular time intervals. I've just created a new auto save thread in my application based on the below example code found o the internet: /** Demonstration of using a Thread to automatically save * the user's work periodically. */ public class AutoSave extends ...





17. threading help    java-forums.org

Java Code: import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DecimalFormat; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class fyp7 { counter c = new counter(); JLabel label = new JLabel(""); JButton butt1 = new JButton("START"); JButton butt2 = new JButton("STOP"); public fyp7() { // create frame JFrame frame1 = new JFrame("thread"); frame1.setBounds(50, 50, 400, 200); ...

18. several threads for different parts    java-forums.org

19. Threading not functioning    java-forums.org

Hello, I'm currently working on a project that executes queries to the database. This process takes a long time to be finished, so I would like the user to be able to use the JFrame while its processing. The solution I found is using Threads. I never used it before and after some tutorials online I found a way to use ...

20. Problem using Threads and Swing in Java    java-forums.org

21. java threads with swing    forums.oracle.com

22. Swing_Thread    forums.oracle.com

Another tip: One (of many) ways to get a random non-repeating number is to use a java util List of available numbers, then use the Collections.shuffle(myList) method to shuffle the list. Then whenever I need a number, I check that the list isn't empty, remove the number at position 0 (myList.get(0)), and then remove this number from the list (myList.remove(0)). Your ...

23. Threads and Swing Issue    forums.oracle.com

#1 Pluto IS NOT a planet. Thank god that scientists got this one right #2 I already see quite a few bugs in your code, like the fact that you never start your second runnable, and that you don't seem to have a repaint loop. It's hard to see how this could work at all

24. this java code i made for thread and swing doesn't work!please check..    forums.oracle.com

import java.awt.*; import javax.swing.*; public class PlaySnake { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } public void paint(Graphics g) { g.setColor(Color.red); g.drawLine(10, 10, 100, 100); } private static void createAndShowGUI() { System.out.println("Created GUI on EDT? "+ SwingUtilities.isEventDispatchThread()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(250,250); f.setVisible(true); f.add(new Balls()); } } class Balls ...

25. Threading Issue with Swing    forums.oracle.com

I'm not a big fan of join most times and I'm not much of a fan of how you are using it here. If you want things to be processed serially then there is zero point to using parallel threads. If you want a worker thread then fine, do that, attach it to a queue to which you will send "jobs" ...

26. Thread and Swing problem    forums.oracle.com

Sounds like you're not doing the threading right. You should have a Runnable (or an extension of Thread) with a run method that connects to the other computer via Socket. To activate the Runnable, you do new Thread(myRunnable).start(); With a subclass of Thread, you can just call start(). Do NOT override start, btw

27. Threads, swing etc...    forums.oracle.com

Hi, I need to develop a software that manage the windows creation. Each windows make some operation: eg. show or manage some data or is a text editor and so on.. I need to know the general idea that is behind the design of a software of this type. I make myself more clear: I don't know the startup, if I ...

28. Accessing Swing components from the working thread!    forums.oracle.com

public ChatSingle(Socket clientSocket,String host,int port) { this.hostName=host; this.port=port; this.clientSocket=clientSocket; setBounds(200,200,300, 300); initComponents();//has the GUI components initialization(like JButton,JTextArea,JTextField...) } //The button has the actionlistener which on click generates a new thread that will read the message from the listening server. private void btnSendMsgActionPerformed(java.awt.event.ActionEvent evt) { sendData(tfMsg.getText()); try { // Create a thread to read from the server new Thread(new ChatSingle(clientSocket,hostName,port)).start(); displayMessage(receivedMsg); } ...

29. Threading Network code in a Swing Application    forums.oracle.com

For my final High school project i have decided to code a Poker game to be played over the network. Problem is, as soon the host starts waiting for a client to connect, everything Swing related freezes. A friend of mine said to use Threads. Strangely enough, when i made a small example class, this did not happen. Any e-books,ideas examples ...

30. Threading Swing, is this correct?    forums.oracle.com

Aghhhh! So being a naive nooob, i thought thread meant just one thing (didn't realise that java creates many threads internally itself) So the reason that a swing application needs to be on the EDT of each swing UI (and not on a user thread) is because thats the queue that holds keystrokes, mouse clicks, etc that may need the UI ...

31. Swing Threading Question    forums.oracle.com