B4J Tutorial Medusa Clocks with JavaObject

Not meant to take anything away from @teddybear post here but thought I would give the clock a shot by using JavaObject. The attached B4J project creates the 16 different clock "skins" within the Medusa Library (medusa-8.0-jar). You need to find the Jar on the web, download it, and then copy it to your B4J additional library folder. I am pointing to Java 14 with this B4J project but earlier versions will in all probability also work.

The alarm is "hard coded" at present to be triggered every morning at 06h30 (inside class medusaClock of the B4J project). I am leaving it up to you to amend the code in class medusaClock of the B4J project to set and handle the alarms - the groundwork has been done and just some setters/getters/events and a bit of logic to be added to set the alarm(s) for each clock.

Main:
#Region Project Attributes
    #MainFormWidth: 800
    #MainFormHeight: 650
#End Region

#AdditionalJar: Medusa-8.0.jar

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
   
    Dim mc1 As medusaClock
    Dim mc2 As medusaClock
    Dim mc3 As medusaClock
    Dim mc4 As medusaClock
    Dim mc5 As medusaClock
    Dim mc6 As medusaClock
    Dim mc7 As medusaClock
    Dim mc8 As medusaClock
    Dim mc9 As medusaClock
    Dim mc10 As medusaClock
    Dim mc11 As medusaClock
    Dim mc12 As medusaClock
    Dim mc13 As medusaClock
    Dim mc14 As medusaClock
    Dim mc15 As medusaClock
    Dim mc16 As medusaClock

    Dim clock1 As JavaObject
    Dim clock2 As JavaObject
    Dim clock3 As JavaObject
    Dim clock4 As JavaObject
    Dim clock5 As JavaObject
    Dim clock6 As JavaObject
    Dim clock7 As JavaObject
    Dim clock8 As JavaObject
    Dim clock9 As JavaObject
    Dim clock10 As JavaObject
    Dim clock11 As JavaObject
    Dim clock12 As JavaObject
    Dim clock13 As JavaObject
    Dim clock14 As JavaObject
    Dim clock15 As JavaObject
    Dim clock16 As JavaObject
   
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
   
    mc1.Initialize
    mc1.Skin = mc1.SKIN_CLOCK
    mc1.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.SecondsVisible = True
    mc1.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.DateVisible = True
    mc1.DayVisible = True
    mc1.AutoNightMode = True
    mc1.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.TickLabelsVisible = True
    mc1.Title = "Durban"
    mc1.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.TitleVisible = True
    clock1 = mc1.makeClock
    mc1.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc1.AlarmsEnabled = True
    mc1.AlarmsVisible = True
    mc1.Running = True
    mc1.TextVisible = True


   
    mc2.Initialize
    mc2.Skin = mc2.SKIN_LCD
    mc2.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.SecondsVisible = True
    mc2.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.DateVisible = True
    mc2.DayVisible = True
    mc2.AutoNightMode = True
    mc2.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.TickLabelsVisible = True
    mc2.Title = "Durban"
    mc2.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.TitleVisible = True
    clock2 = mc2.makeClock
    mc2.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc2.AlarmsEnabled = True
    mc2.AlarmsVisible = True
    mc2.Running = True
    mc2.TextVisible = True

   
    mc3.Initialize
    mc3.Skin = mc3.SKIN_SLIM
    mc3.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.SecondsVisible = True
    mc3.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.DateVisible = True
    mc3.DayVisible = True
    mc3.AutoNightMode = True
    mc3.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.TickLabelsVisible = True
    mc3.Title = "Durban"
    mc3.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.TitleVisible = True
    clock3 = mc3.makeClock
    mc3.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc3.AlarmsEnabled = True
    mc3.AlarmsVisible = True
    mc3.Running = True
    mc3.TextVisible = True

   
    mc4.Initialize
    mc4.Skin = mc4.SKIN_PEAR
    mc4.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.SecondsVisible = True
    mc4.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.DateVisible = True
    mc4.DayVisible = True
    mc4.AutoNightMode = True
    mc4.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.TickLabelsVisible = True
    mc4.Title = "Durban"
    mc4.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.TitleVisible = True
    clock4 = mc4.makeClock
    mc4.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc4.AlarmsEnabled = True
    mc4.AlarmsVisible = True
    mc4.Running = True
    mc4.TextVisible = True

   
   
    mc5.Initialize
    mc5.Skin = mc5.SKIN_ROUND_LCD
    mc5.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.SecondsVisible = True
    mc5.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.DateVisible = True
    mc5.DayVisible = True
    mc5.AutoNightMode = True
    mc5.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.TickLabelsVisible = True
    mc5.Title = "Durban"
    mc5.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.TitleVisible = True
    clock5 = mc5.makeClock
    mc5.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc5.AlarmsEnabled = True
    mc5.AlarmsVisible = True
    mc5.Running = True
    mc5.TextVisible = True
   
   
    mc6.Initialize
    mc6.Skin = mc6.SKIN_INDUSTRIAL
    mc6.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.SecondsVisible = True
    mc6.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.DateVisible = True
    mc6.DayVisible = True
    mc6.AutoNightMode = True
    mc6.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.TickLabelsVisible = True
    mc6.Title = "Durban"
    mc6.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.TitleVisible = True
    clock6 = mc6.makeClock
    mc6.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc6.AlarmsEnabled = True
    mc6.AlarmsVisible = True
    mc6.Running = True
    mc6.TextVisible = True
   
    mc7.Initialize
    mc7.Skin = mc7.SKIN_TILE
    mc7.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.SecondsVisible = True
    mc7.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.DateVisible = True
    mc7.DayVisible = True
    mc7.AutoNightMode = True
    mc7.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.TickLabelsVisible = True
    mc7.Title = "Durban"
    mc7.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.TitleVisible = True
    clock7 = mc7.makeClock
    mc7.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc7.AlarmsEnabled = True
    mc7.AlarmsVisible = True
    mc7.Running = True
    mc7.TextVisible = True
   
    mc8.Initialize
    mc8.Skin = mc8.SKIN_DIGITAL
    mc8.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.SecondsVisible = True
    mc8.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.DateVisible = True
    mc8.DayVisible = True
    mc8.AutoNightMode = True
    mc8.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.TickLabelsVisible = True
    mc8.Title = "Durban"
    mc8.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.TitleVisible = True
    clock8 = mc8.makeClock
    mc8.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc8.AlarmsEnabled = True
    mc8.AlarmsVisible = True
    mc8.Running = True
    mc8.TextVisible = True
   
    mc9.Initialize
    mc9.Skin = mc9.SKIN_DIGI
    mc9.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.SecondsVisible = True
    mc9.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.DateVisible = True
    mc9.DayVisible = True
    mc9.AutoNightMode = True
    mc9.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.TickLabelsVisible = True
    mc9.Title = "Durban"
    mc9.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.TitleVisible = True
    clock9 = mc9.makeClock
    mc9.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc9.AlarmsEnabled = True
    mc9.AlarmsVisible = True
    mc9.Running = True
    mc9.TextVisible = True
   
    mc10.Initialize
    mc10.Skin = mc10.SKIN_YOTA2
    mc10.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.MinuteTickMarkColor =fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.SecondsVisible = True
    mc10.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.DateVisible = True
    mc10.DayVisible = True
    mc10.AutoNightMode = True
    mc10.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.TickLabelsVisible = True
    mc10.Title = "Durban"
    mc10.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.TitleVisible = True
    clock10 = mc10.makeClock
    mc10.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc10.AlarmsEnabled = True
    mc10.AlarmsVisible = True
    mc10.Running = True
    mc10.TextVisible = True
   
    mc11.Initialize
    mc11.Skin = mc11.SKIN_MINIMAL
    mc11.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.SecondsVisible = True
    mc11.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.DateVisible = True
    mc11.DayVisible = True
    mc11.AutoNightMode = True
    mc11.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.TickLabelsVisible = True
    mc11.Title = "Durban"
    mc11.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.TitleVisible = True
    clock11 = mc11.makeClock
    mc11.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc11.AlarmsEnabled = True
    mc11.AlarmsVisible = True
    mc11.Running = True
    mc11.TextVisible = True
   
    mc12.Initialize
    mc12.Skin = mc12.SKIN_FAT
    mc12.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.SecondsVisible = True
    mc12.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.DateVisible = True
    mc12.DayVisible = True
    mc12.AutoNightMode = True
    mc12.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.TickLabelsVisible = True
    mc12.Title = "Durban"
    mc12.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.TitleVisible = True
    clock12 = mc12.makeClock
    mc12.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc12.AlarmsEnabled = True
    mc12.AlarmsVisible = True
    mc12.Running = True
    mc12.TextVisible = True
   
    mc13.Initialize
    mc13.Skin = mc13.SKIN_DESIGN
    mc13.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.SecondsVisible = True
    mc13.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.DateVisible = True
    mc13.DayVisible = True
    mc13.AutoNightMode = True
    mc13.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.TickLabelsVisible = True
    mc13.Title = "Durban"
    mc13.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.TitleVisible = True
    clock13 = mc13.makeClock
    mc13.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc13.AlarmsEnabled = True
    mc13.AlarmsVisible = True
    mc13.Running = True
    mc13.TextVisible = True
   
    mc14.Initialize
    mc14.Skin = mc14.SKIN_DB
    mc14.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.SecondsVisible = True
    mc14.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.DateVisible = True
    mc14.DayVisible = True
    mc14.AutoNightMode = True
    mc14.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.TextColor = fx.Colors.Green
    mc14.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.TickLabelsVisible = True
    mc14.Title = "Durban"
    mc14.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.TitleVisible = True
    clock14 = mc14.makeClock
    mc14.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc14.AlarmsEnabled = True
    mc14.AlarmsVisible = True
    mc14.Running = True
    mc14.TextVisible = True
   
    mc15.Initialize
    mc15.Skin = mc15.SKIN_PLAIN
    mc15.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.SecondsVisible = True
    mc15.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.DateVisible = True
    mc15.DayVisible = True
    mc15.AutoNightMode = True
    mc15.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.TickLabelsVisible = True
    mc15.Title = "Durban"
    mc15.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.TitleVisible = True
    clock15 = mc15.makeClock
    mc15.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc15.AlarmsEnabled = True
    mc15.AlarmsVisible = True
    mc15.Running = True
    mc15.TextVisible = True
   
   
    mc16.Initialize
    mc16.Skin = mc16.SKIN_TEXT
    mc16.HourTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.MinuteTickMarkColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.MinuteHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.HourHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.SecondHandColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.ClockBackgroundColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.SecondsVisible = True
    mc16.DateColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.DateVisible = True
    mc16.DayVisible = True
    mc16.AutoNightMode = True
    mc16.KnobColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.TextColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.TickLabelColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.TickLabelsVisible = True
    mc16.Title = "Durban"
    mc16.TitleColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.TitleVisible = True
    clock16 = mc16.makeClock
    mc16.AlarmColor = fx.Colors.ARGB(255, Rnd(0,256), Rnd(0,256), Rnd(0,256))
    mc16.AlarmsEnabled = True
    mc16.AlarmsVisible = True
    mc16.Running = True
    mc16.TextVisible = True
   

    Form1.RootPane.AddNode(clock1, 2dip, 2dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock2, 154dip, 2dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock3, 306dip, 2dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock4, 462dip, 2dip, 150dip, 150dip)
   
    Form1.RootPane.AddNode(clock5, 2dip, 155dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock6, 154dip, 155dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock7, 306dip, 155dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock8, 462dip, 155dip, 150dip, 150dip)
   
    Form1.RootPane.AddNode(clock9, 2dip, 307dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock10, 154dip, 307dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock11, 306dip, 307dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock12, 462dip, 307dip, 150dip, 150dip)
   
    Form1.RootPane.AddNode(clock13, 2dip, 459dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock14, 154dip, 459dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock15, 306dip, 459dip, 150dip, 150dip)
    Form1.RootPane.AddNode(clock16, 462dip, 459dip, 150dip, 150dip)
   

End Sub

Class medusaClock:
Sub Class_Globals
    Private fx As JFX
   
    Dim clock1 As JavaObject
    Public SKIN_CLOCK As String = "CLOCK"
    Public SKIN_YOTA2 As String = "YOTA2"
    Public SKIN_LCD As String = "LCD"
    Public SKIN_PEAR As String = "PEAR"
    Public SKIN_PLAIN As String = "PLAIN"
    Public SKIN_DB As String = "DB"
    Public SKIN_FAT As String = "FAT"
    Public SKIN_ROUND_LCD As String = "ROUND_LCD"
    Public SKIN_SLIM As String = "SLIM"
    Public SKIN_MINIMAL As String = "MINIMAL"
    Public SKIN_DIGITAL As String = "DIGITAL"
    Public SKIN_TEXT As String = "TEXT"
    Public SKIN_DESIGN As String = "DESIGN"
    Public SKIN_INDUSTRIAL As String = "INDUSTRIAL"
    Public SKIN_TILE As String = "TILE"
    Public SKIN_DIGI As String = "DIGI"
   
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
   
    clock1.InitializeNewInstance("eu.hansolo.medusa.Clock", Null)
   
End Sub

public Sub setSkin (skin As String)
    'CLOCK, YOTA2, LCD, PEAR, PLAIN, DB, FAT, ROUND_LCD, SLIM, MINIMAL, DIGITAL, TEXT, DESIGN, INDUSTRIAL, TILE, DIGI
    Dim skintype As JavaObject
    skintype = skintype.InitializeStatic("eu.hansolo.medusa.Clock.ClockSkinType")
    clock1.RunMethod("setSkinType", Array(skintype.GetField(skin)))
   
End Sub

public Sub setHourTickMarkColor(color As Paint)
   
    clock1.RunMethod("setHourTickMarkColor", Array(color))
   
End Sub

public Sub setMinuteTickMarkColor(color As Paint)
   
    clock1.RunMethod("setMinuteTickMarkColor", Array(color))
   
End Sub

public Sub setMinuteHandColor(color As Paint)
   
    clock1.RunMethod("setMinuteColor", Array(color))
   
End Sub

public Sub setHourHandColor(color As Paint)
   
    clock1.RunMethod("setHourColor", Array(color))
   
End Sub

public Sub setSecondHandColor(color As Paint)
   
    clock1.RunMethod("setSecondColor", Array(color))
   
End Sub

public Sub setClockBackgroundColor(color As Paint)
    clock1.RunMethod("setBackgroundPaint", Array(color))
End Sub

public Sub setSecondsVisible (visible As Boolean)
    clock1.RunMethod("setSecondsVisible", Array(visible))
End Sub

Public Sub setDateVisible(visible As Boolean)
    clock1.RunMethod("setDateVisible", Array(visible))
End Sub

Public Sub setDayVisible(visible As Boolean)
    clock1.RunMethod("setDayVisible", Array(visible))
End Sub

Public Sub setTickLabelsVisible(visible As Boolean)
    clock1.RunMethod("setTickLabelsVisible", Array(visible))
End Sub

Public Sub setNightMode(mode As Boolean)
    clock1.RunMethod("setNightMode", Array(mode))
End Sub

public Sub setTickLabelColor(color As Paint)
    clock1.RunMethod("setTickLabelColor", Array(color))
End Sub

public Sub setKnobColor(color As Paint)
    clock1.RunMethod("setKnobColor", Array(color))
End Sub

Public Sub setAutoNightMode(mode As Boolean)
    clock1.RunMethod("setAutoNightMode", Array(mode))
End Sub

Public Sub setTitle(title As String)
    clock1.RunMethod("setTitle", Array(title))
End Sub

Public Sub setTitleVisible(visible As Boolean)
    clock1.RunMethod("setTitleVisible", Array(visible))
End Sub

public Sub setTitleColor(color As Paint)
    clock1.RunMethod("setTitleColor", Array(color))
End Sub

Public Sub setTextVisible(visible As Boolean)
    clock1.RunMethod("setTextVisible", Array(visible))
End Sub

public Sub setTextColor(color As Paint)
    clock1.RunMethod("setTextColor", Array(color))
End Sub

public Sub setDateColor(color As Paint)
    clock1.RunMethod("setDateColor", Array(color))
End Sub

Public Sub setRunning(running As Boolean)
    clock1.RunMethod("setRunning", Array(running))
End Sub

Public Sub setAlarmsEnabled(enabled As Boolean)
    clock1.RunMethod("setAlarmsEnabled", Array(enabled))
End Sub

Public Sub setAlarmsVisible(visible As Boolean)
    clock1.RunMethod("setAlarmsVisible", Array(visible))
End Sub

public Sub setAlarmColor(color As Paint)
    clock1.RunMethod("setAlarmColor", Array(color))
End Sub



public Sub makeClock As JavaObject
       
    Dim repetition As JavaObject
    'ONCE, HALF_HOURLY, HOURLY, DAILY, WEEKLY
    repetition = repetition.InitializeStatic("eu.hansolo.medusa.Alarm.Repetition").GetField("DAILY")
   
    Dim zdt As JavaObject
    zdt.InitializeStatic("java.time.ZonedDateTime")
    Dim hournow As Int = zdt.RunMethodJO("now", Null).RunMethod("getHour", Null)
    Dim minutenow As Int = zdt.RunMethodJO("now", Null).RunMethod("getMinute", Null)
    Dim secondnow As Int = zdt.RunMethodJO("now", Null).RunMethod("getSecond", Null)

    Dim alarmtimehour As Long = 6           'time of day (hour) that the alarm should be triggered
    Dim alartimeminute As Long = 30
    Dim alarmtimesecond As Long = 0
    Dim alarmdaystoadd As Long = 0

    alartimeminute = minutenow - alartimeminute
    alarmtimesecond = secondnow - alarmtimesecond
   
    Dim alamhourfromnow As Long
    If hournow > alarmtimehour Then
        alamhourfromnow = 24 - hournow + alarmtimehour
    Else
        alamhourfromnow = alarmtimehour - hournow
    End If
   
    zdt = zdt.RunMethodJO("now", Null).RunMethodJO("plusHours", Array(alamhourfromnow)).RunMethodJO("minusMinutes", Array(alartimeminute)).RunMethodJO("minusSeconds", Array(alarmtimesecond)).RunMethod("plusDays", Array(alarmdaystoadd))
    Dim clockcolor As JavaObject
    clockcolor = clockcolor.InitializeStatic("eu.hansolo.medusa.Clock").GetField("DARK_COLOR")
   
    'initialize a new instance of the clock alarm
    Dim alarm As JavaObject
    alarm.InitializeNewInstance("eu.hansolo.medusa.Alarm", Array(repetition, zdt, True, "", Null, clockcolor))
    alarm.RunMethod("setText", Array("WAKE UP"))
   
'    clock1.RunMethod("setAlarmsEnabled", Array(True))
'    clock1.RunMethod("setAlarmsVisible", Array(True))
'    clock1.RunMethod("setAlarmColor", Array(fx.Colors.Green))
    clock1.RunMethod("addAlarm", Array(alarm))
    Log(clock1.RunMethod("getAlarms", Null))
   
    Dim wdth As Double = 10
    clock1.RunMethod("setBorderWidth", Array(wdth))
    Dim bc As Paint = fx.Colors.Gray
    clock1.RunMethod("setBorderPaint", Array(bc))
   
    Log(clock1.RunMethod("getTime", Null))
    Log(" ")
    Log(alarm.RunMethod("getTime", Null))
    Log(" ")


    'Create an event to be triggered when the clock reaches the alarm time
    Dim jo As JavaObject = clock1
    Dim e As Object = jo.CreateEvent("eu.hansolo.medusa.events.AlarmEventListener", "alarm", False)
    jo.RunMethod("setOnAlarm", Array As Object(e))
   
    'Create an event to be triggered when the clock reaches the alarm time
    'Defines a class that implements the Command interface and which execute()
    'method will be called when the alarm is triggered.
    Dim jo As JavaObject = alarm
    Dim e As Object = jo.CreateEvent("eu.hansolo.medusa.Command", "execute", False)
    jo.RunMethod("setCommand", Array As Object(e))
   
    Return clock1
End Sub

Sub alarm_Event (MethodName As String, Args() As Object) As Object
    Log(MethodName)
    Log("HERE - IN EVENT ALARM TRIGGERED")
    Log(Args.Length)
    For i = 0 To Args.Length - 1
        Log(Args(i))
    Next
    Return True
End Sub

Sub execute_Event (MethodName As String, Args() As Object) As Object
    Log(MethodName)
    Log("HERE - IN EVENT EXECUTE")
    Return True
End Sub

Enjoy!


1755348221475.png
 

Attachments

  • medusaClockJOClass.zip
    5.4 KB · Views: 34
Last edited:
Top