Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!

Alfonso Sanz

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

Recent posts by Alfonso Sanz

Hi!

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.

Regars,
Hi!

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!
3 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 Mediaplayer.play(). 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.

4 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.
4 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.
4 months ago
That's just what I needed! Thanks you Stephan van Hulst!
4 months ago
I'll give it a try.
Thanks!
4 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.
4 months ago
I have also added Thread.sleep() with a time greater Thanksgiving the Jeep durstion in between but only one os played.
4 months ago
Hi!

I expect for the sound todo.be played twice because player.play() is called two times. Ten... why is sounding once?

BR,

4 months ago
Hi!

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!!

4 months ago
You are right! Understood now!!

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

How did you come to that conclusion? Sorry, but still not seeing it.
4 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...

4 months ago