Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Velika Srbija

Ranch Hand
+ Follow
since Jan 15, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Velika Srbija

I've made my own Socket-based version of Client-Server Remote Desktop application in Java. It works OK with performance comparable to Win7 native RD client. But, there is a problem. My Java RD client can't receive desktop screenshots from server until I connect to the remote machine using Win7 native RD client. Only in that case my Java RD server starts to send desktop screenshots. If I close native Win7 RD client, my server continues to run (accept new connections etc.), but sends empty (black) screenshots to clients.

I have tried jrDesktop application (http://jrdesktop.sourceforge.net/) and it behaves exactly the same, either on Win7 or on WinXP.

How can I resolve this issue?

p.s.
Note that I have asked the same question at the stackoverflow and got no answer at all.
Thanks. I'm using JDK 6.

The syntax is
@SuppressWarnings("all")

but didn't helped. Maybe it is due to IDEA IDE which I'm using.?
13 years ago
Yes, I understand that.
But, is there any way to avoid warning?
13 years ago
Compiler gives me a warning:

Warning: Note: C:\MyDocuments\...\MyFrame.java uses unchecked or unsafe operations.

This happens when I try to read searilized object, e.g.:

ArrayList<String> names = (ArrayList<String> objectIn.readObject();

How can I resolve this?
13 years ago
I wan to allow user to draw a new area (Area class), add to it and subtract from it, whether from the edge or from the inside of the area (e.g. make holes in it). But the problem is that user may subtract from area, make a hole in it using rectangle tool, in such way (edge-to-edge) that the resulting area may be broken into 2 separated areas. It is still one Area object, but consisting of 2 filled subareas and invisible area between them. How could I prevent that? I jus want to have single filled area at any moment; holes are permited.
13 years ago
I have worked it out.

I have put whole method, including double for loop, into new Thread and called update of JLayeredPane through invokeAndWait method (not recommended way, but it works well for me).

Thank you @Darrin Cartwright, for your advice. I knew there was a method invokeAndWait, but as you know, its usage is not recommended, so I was trying to use invokeLater but failed every time with it. Your advice has encouraged me. Thanks again.
13 years ago
No, it won't work. Calculations in the double for loop are so quick so that JVM's redraw of JLayeredPane can't follow it.

Somehow dirty solution came into my mind. I could put all calculations into event-queue followed by the JLayeredPane repaint. But, there is another problem. Putting all calculations into run() method, will cause problems with variables scope, because run() method will reside in the inner anonymous class.
13 years ago
I have a double for loop inside which I have to repaint JtabbedPane for every cycle. It works well if I put whole method into event-queue thread. But in that situation I can't interrupt this repainting, because pressing the "Stop repainting" button causes its event to came after all repainting had been done.

But, on the other side, if I put this method (containing double foor loops) into separate thread I get visual missmatch between for loops and repainting of JTabbedPane, because they run in separate threads, i.e. event-queue is always late.

Is there any way I can get information about when JTabbedPane repainting has been finished?
13 years ago
I don't need immediate refresh of my GUI after calculations had performed. It would be nice to wait for a while, but it's important to refresh GUI between two calculations. Is there any way to call EDT explicitly, something like yield from main to EDT thread?
[ April 09, 2007: Message edited by: Velika Srbija ]
13 years ago
Yes I know that.

I have a method that iterates over some array of objects, perform calculations on them and based on that results, updates GUI. I have had set following statement at the very beginning of the method:

if (SwingUtilities.isEventDispatchThread())

and it returned true. So I realize that I'm not out of the EDT. So, calculations and GUI updates are commig in order. Can not figure where is the problem?
13 years ago
Maybe there is another solution? Here I'll briefly describe the problem.
I wrote an application that has many calculations. After each cycle of those calculations, I change the contents of the JLayeredPane, i.e. remove all existing componants, add new ones and validate JLayeredPane. The problem is that all my calculations continues, but JLayeredPane doesn't get refreshed until the very last calculation has been done. How can I synchronize my calculations cycles with JLayeredPane content refresh?
13 years ago
How do I stop executing of my app until JLayeredPane is repainted and validated?
13 years ago
Yes that was the problem. I put it into the session, and my jsp1 page displayed correctly. But, that is only the part of the problem. I don't get messy jsp1 page anymore, but there is no preselected value in the combo-box. Instead, combo-box is rendered as is, i.e. like at the very first visit of the jsp1 page.
13 years ago
Yes, the flow is: jsp1 -> action -> jsp1

Forward is like: return new ActinForward(mapping.getInput())
But, the same path is for success.

ArrayList is OK.

The problem lies in the fact that when the flow returns to the jsp1 again, it should set the already choosen value in the combo-box (property "producer_name"); that is autopupulating of the jsp1 with values contained in the associated ActionForm. But that doesn't happen.

I have tried to enter static values into combo-box, e.g.:

<html:select property="producer_name">
<html ption value="ford">Ford</html ption>
<html ption value="peugeot">Peugeot</html ption>
<html ption value="fiat">Fiat</html ption>
</html:select>

and in this case, autopopulating works as expected. If I e.g. choose Fiat, when the flow returns me to the jsp1, Fiat will be preselected in the combo-box, and that's OK. But this doesn't work if I dinamically create combo-box values. Why, and what is the solution?
13 years ago