swingworker

Java SwingWorker Socket Server does not get cancelled when i cancel the the SwingWorker

旧巷老猫 提交于 2019-12-11 05:39:59
问题 I got a Socket Server running as a Java SwingWorker. The SwingWorker receives incoming connections, and upon connection, hands over the socket to an Executor that takes care of the connection. The Executor calls a SocketHandler that will handle the socket via the run() method. Now, I have one button on the GUI that says stop. I want to stop the SwingWorker from execution when i press the Stop button. To do so, I had a cancel(true) method called upon pressing the Stop button. Now, the

swing - short-time highlight of a component

Deadly 提交于 2019-12-11 03:21:56
问题 I have a JTable, where a user can select a single row. If that happens, i want to "highlight" another part of the page for a short time to indicate that this is the part of the page that changed after the user interaction. So my question is: What's the best way to achieve this? At the moment i did it by setting the background color of that panel and starting a SwingWorker which sets the Color back after a short delay. It works as intended, but is it a good idea to use a SwingWorker like that?

SwingWorker not executing doInBackGround()

和自甴很熟 提交于 2019-12-11 03:17:52
问题 I will be needing a swing worker for a project that I'm working on, so I attempted to use it. I've tried to use it as shown below, however, this program produces only the "Doing swing stuff" output. How can I get the SwingWorker to complete the doInBackGround method? import javax.swing.SwingWorker; public class WorkerTest { public static void main(String[] args) { Worker a = new Worker(); a.execute(); System.out.println("Doing swing stuff"); } static class Worker extends SwingWorker<Void,

Where should I invoke my swingworker in a Java MVC pattern

半世苍凉 提交于 2019-12-11 02:36:52
问题 I have a program that is basically set up just like the one in this MVC example: http://www.leepoint.net/notes-java/GUI/structure/40mvc.html In my program there is a process which takes quite a bit of time which freezes my GUI. I want to GUI to continuously update while the process is running. To do this I believe I need to use a SwingWorker. I don't know where in my MVC pattern I should be invoking this SwingWorker. My thinking is that I should be running it in the MultiplyListener

Is this SwingWorker not reusing Threads in ThreadPoolExecutor?

房东的猫 提交于 2019-12-11 01:37:37
问题 As part of my Final Year Project I've developed a desktop application, which fits in the category of the "graphical IDE" if such a thing exists. I've implemented a little subset of Jessy James Garrett Visual Vocabulary for Information Architecture and Interaction Design, so the user can draw a diagram (a directed graph in other words) representing the user's experience in a webapp, assign HTML templates to pages and write some code to a connector/transition that will be executed, once the

repainting an applet from a swingworker used to compute triangles and circum-circles

对着背影说爱祢 提交于 2019-12-10 21:05:20
问题 I am trying to replicate the applet found here as a part of an exercise. The applet is using Fortune's algorithm to generate both; a Voronoi diagram and Delaunay triangulation. I am just interested in generating the Delaunay Triangulation in a plane and thus, would be using the incremental algorithms i.e. adding 1 point at a time. I intend to show the triangles being generated at every stage when a sample point is added. I am using a SwingWorker class to create an instance of the Triangulate

Long process under Swing GUI : unexpected delay

南笙酒味 提交于 2019-12-10 19:18:56
问题 To explain my question here is an MCVE where clicking clicking a JButton on JDialog A opens JDialog B: import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; public class DiagA extends JDialog { private DiagB diag; public DiagA() { super(); setTitle("main diag"); setSize(200, 150); setLocation(400,400); JButton btn = new JButton("Show DiagB

JProgressBar while data loading in swing

你。 提交于 2019-12-10 17:54:35
问题 I have a server call from the UI. It has response time is little high. So I was thinking to display a progress bar during data loading from the server. I have tried the following code using this approach to show the progress bar. Some where I am doing wrong I am not seeing the progress bar when I call the calculateResult() method on button click. I no need to display any percentage on the progress bar. It just needs to show that data is loading. // The following code I have tried. import java

Firing events from inner class which extends SwingWorker

别等时光非礼了梦想. 提交于 2019-12-10 11:44:58
问题 I am trying to fire events from inner class, but it is not working. This is my code: ABSTRACT MODEL: public abstract class AbstractModel { public PropertyChangeSupport propertyChangeSupport; public AbstractModel() { propertyChangeSupport = new PropertyChangeSupport(this); } public void addPropertyChangeListener(PropertyChangeListener listener) { propertyChangeSupport.addPropertyChangeListener(listener); } public void removePropertyChangeListener(PropertyChangeListener listener) {

JDK-7 SwingWorker deadlocks?

爱⌒轻易说出口 提交于 2019-12-10 09:27:53
问题 I have a small image processing application which does multiple things at once using SwingWorker. However, if I run the following code (oversimplified excerpt), it just hangs on JDK 7 b70 (windows) but works in 6u16. It starts a new worker within another worker and waits for its result (the real app runs multiple sub-workers and waits for all this way). Did I use some wrong patterns here (as mostly there is 3-5 workers in the swingworker-pool, which has limit of 10 I think)? import javax