B4J Question Generate Beep on a desktop

Solution
B4X:
Sub Beep
   Dim jo As JavaObject
   jo.InitializeStatic("java.awt.Toolkit")
   Dim toolkit As JavaObject = jo.RunMethod("getDefaultToolkit", Null)
   toolkit.RunMethod("beep", Null)
End Sub

TILogistic

Expert
Licensed User
Longtime User
test:
B4X:
Private Sub Button1_Click
    Beep
End Sub

Sub Beep
    Dim jo As JavaObject = Me
    jo.RunMethod("beep", Null)
End Sub

#if Java
public static void beep() {
    java.awt.Toolkit.getDefaultToolkit().beep();
}
#End If
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
B4X:
Sub Beep
   Dim jo As JavaObject
   jo.InitializeStatic("java.awt.Toolkit")
   Dim toolkit As JavaObject = jo.RunMethod("getDefaultToolkit", Null)
   toolkit.RunMethod("beep", Null)
End Sub
 
Upvote 0
Solution

TILogistic

Expert
Licensed User
Longtime User

Attachments

  • B4XSound.bas
    5.5 KB · Views: 152
Upvote 0
Top