Java equivalent of C# system.beep?

后端 未结 8 1357
半阙折子戏
半阙折子戏 2021-01-01 10:31

I am working on a Java program, and I really need to be able to play a sound by a certain frequency and duration, similarly to the c# method System.Beep, I know how to use i

8条回答
  •  清酒与你
    2021-01-01 10:54

    If you're using SWT widgets, you can do it this way (SYSTEM SOUND BEEP!)

    org.eclipse.swt.widgets.Display.getCurrent().beep();
    

    if you want NATIVE JAVA, here is a class for it: https://github.com/marcolopes/dma/blob/master/org.dma.java/src/org/dma/java/util/SoundUtils.java

提交回复
热议问题