This week's giveaway is in the Spring forum.
We're giving away four copies of liveProject: Protecting User Data with Spring Security and OAuth2 and have Laurentiu Spilca on-line!
See this thread for details.
Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!

Stavros Kanarakis

Greenhorn
+ Follow
since Sep 28, 2010
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 Stavros Kanarakis

Hi all,

Let 's suppose that we have an application in which a JFrame appears initially which serves as an input form for the application user.
After the user has completed the form, he submits it and we open a new JFrame which has a JTable inside.

My question is if we can have a JMenuBar that will only be displayed in the second JFrame (after user has submitted on first frame).

I have tried to just create the JMenuBar and put it under the second frame but it is displayed in both frames (initial and JTable).

Please have in mind that once the new frame is opened, the initial one is still open since application assumes that user may choose to close the second frame and re-post things in the form.

Can anyone help me on this?

Thanks
9 years ago
Thanks for the quick answer.

I have though of this solution, however I am a bit frustrated by the fact that in my UI class code, I have a lot of data structure members (primitive multidimensional arrays, object arrays and a lot of single data members/class methods).
All these members are containing valuable information about the tests I am trying to control and need to be accessed inside the while loop.

If I start a new thread waiting for a test to finish, how will I be able to access those data members of UI class?
From the code segment, you can see that objects/primitives/class methods like

runningIPSWindows
hasPreviousTestStoppedNormally
updateTableCells
updateTabeCellsToError
updateTotalRemainingTime

are all needed and these are declared in the UI class (I am using Netbeans GUI builder project).
Hi all,

I hope that this post indeed belongs to this category.

I have implemented an application for monitoring and controlling some external simulation tests.
The application reads an XML config file, and based upon that information, it controls the execution and monitoring of external application (non-Java) simulation tests.

The logic is that my app is executing a remote test, then at some time, it stops the test and waits till that test cleans up.
This waiting period can vary from 10 seconds to 1 minute.

In my application, I managed to do this halting by entering a while loop and using Thread.sleep() method. In each while iteration, I am checking some value that will help me avoid an eternal loop.

Application works fine.
However, my problem is that while my program waits for the simulated tests to clean up (being inside the while loop), it stops responding due to the sleep() method. You can only re-get control of it when while loop is exited.

Is there any other more efficient way to make my application halt and wait for something to happen before going to next command? Something that will make me avoid a freezing application for that period of time?

I am attaching you the while loop code segment





Thanks
Stavros
Hi all,

I have an application in which a Swing timer is started with repeats(false). This is not shown in the code.
Inside that timer actionlistener, and depending on the logic, I want to stop this timer, set another delay value and restart it.

Everything works fine except for the new delay. The timer gets restarted for one time again, but it keeps getting the delay value that was given at the first time of its run. It gets always "someValue" and not "newValue".

Do you know why?

Thanks
Steve

9 years ago

Campbell Ritchie wrote:Beware, beware. Don't use Runtime.exec() until you have read Daconta's article about it. There is a bit about it in the documentation for Process, but Daconta gives lots more details.



Ok thanks, I will have a look.
9 years ago
After a little google and experimentation the solution was to call



Thanks for your help.
9 years ago
I just tried the

cmd \c call "C:\directoryNameContainingSpaces\batchFileName.bat"

from the Windows Run frame and it runs successfully.

However, it does not run from the Java application.

I even added a double backslash to the same command but no luck either.
9 years ago
Thanks for replying.

I have managed to run the batch files from the Windows command prompt by issuing the following command.


>call "C:\directoryNameContainingSpaces\batchfileName.bat"

But when I tried to create this script and give it as argument to the exec method, the batch file did not run as it ran from the command prompt of Windows.
That is why I removed "call" from the String containing my pathname.
9 years ago
Thanks for replying.

I have managed to run the batch files from the Windows command prompt by issuing the following command.


>call "C:\directoryNameContainingSpaces\batchfileName.bat"

But when I tried to create this script and give it as argument to the exec method, the batch file did not run as it ran from the command prompt of Windows.
That is why I removed "call" from the String containing my pathname.
9 years ago
Hi all,

I want to be able to call a Windows batch file from my Java desktop application running at the same machine hosting the batch file.

I have the full pathname in a String named "batchFilePath" in a form C:\directory\batchfile.bat
However, when I am trying to call it, nothing happens.

I tried to change the single backslash to double backslash but nothing happens either.
Could anyone help please?

The code excerpt is below.



Thanks
Steve
9 years ago
How stupid of me....Of course !!

Thanks Rob, this silly bug kept me busy for two hours now...it is always good to have some fresh eyes look at the code.

You are right about checking null values. I should put some checks.

Thanks again
Steve.
9 years ago
Hi all,

I have a strange problem with Strings and I cannot understand why. I suspect variable scope but since I am not sure, I am posting here for help.
I have a class method that must return a double dimensional String array. The variable I want to return is named "dataToReturn".

The method works fine according to its task. I have put various "println" during method execution and I am positive that the "dataToReturn" is populated correctly.
But at the end of the method, when I am returning the array, all array elements are null, so my program crashes with NullExceptionPointer because I need to work on the returned array.

Can you please help me?
Is it something with scoping issues?
I am reading some XML values in the first big for loop and I am assingning values to the array elements (I am checking that they are correctly assigned with "println" statements). Maybe when I come out of the for loop, these array elements which are String objects, are not present any more??

Thanks
Steve



9 years ago