Alfonso Sanz

Ranch Hand
+ Follow
since Dec 19, 2015
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alfonso Sanz


Under "Understanding Views"

The text says: "... Both of these methods can throw a checked IOException, such as when the view class type is unsupported." 

But public static <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) does not throw any IOException.


I am sure it will be a great book and I hope there will be lots of test-like questions to practice!

Congrats to Sierra, Bates and Robson!
great and very very instructive answer!! I learnt a lot on your explanation. Thanks a lot John Damien Smith!!

PD: Indeed I had already used AudioClip.

Thanks again!
6 months ago
Great post and great book! Thanks Knute Snortum.

For the time being I am just invertigating how to play sounds and still not sure whethrt to use Clip.loop() or It's not about JavaFX.

I also consider using "aplay" system call cause so far this approach is working best on Linux, where as I said above, two instanciations of MediaPlayer give sometimes MediaException.

In anycase, I'll consider to buy the book you recommend me. It looks quite interesting.

Thanks again.

6 months ago

Knute Snortum wrote:Instead of
what about Thread.sleep(1000); // one second

That may not be the best way of getting a delay in JavaFX, though.

Thread.sleep() has the same effect. Both sounds at a time.
6 months ago
One more question:

Here is the second piece of code:

In spite of the delay, both sounds are being played in parallel. Why? How to make a real "gap"?

By the way... under Windows everything runs conveniently, but under RHEL,  when creating looks like randomly I get MediaException in init(). Enybody knows??

Thanks in advance.
6 months ago
That's just what I needed! Thanks you Stephan van Hulst!
6 months ago
I'll give it a try.
6 months ago
I have also added Thread.sleep() with a time greater than the beep duration as parameter in between but only one os played.
6 months ago
I have also added Thread.sleep() with a time greater Thanksgiving the Jeep durstion in between but only one os played.
6 months ago

I expect for the sound played twice because is called two times. Ten... why is sounding once?


6 months ago

I have a question regarding this code snippet:

My question is why the sound is played only once instead of twice?

Other way... how to make the audio file to sound two times in a row?

Thanks in advance!!

6 months ago
You are right! Understood now!!

Thank you so much again, Rob.
7 months ago
Perfect! Thank you very much, Rob.

How did you come to that conclusion? Sorry, but still not seeing it.
7 months ago
Hello Guys,

I came accross a piece of Swing code based on a JTable. It is a nice code, but I spot something weird...

The third column of the JTable holds a JCombobox, but I see the first time pressing on the Combobox, even though the shown item is right, the highlighted one is always the first item (Spain). After choosing some item and make the ActionEvent trigger, next time you press on Combo, the item shadowed is the one chosen the time before.

Let's see the code:

My question is... how to make the first time I press the combo for the app to highligt the item by defaut (for the first row: Japan) instead of the first item in listCountry (Spain)??

Thanks in advance...

7 months ago