awt.Window setAlwaysOnTop (since 1.5)

click

Well, that’s neat. Just stumbled upon it.

In the past you’d to use JNI for stuff like that :slight_smile:

Won’t work for webstart then w/o all permissions huh? :-/

Well, it’s neat anyways.

Have they sneaked in non-rectangular Frames too? :o

Have they sneaked in non-rectangular Frames too? :o

Heh :slight_smile:

Well, I just polished one of my older apps. The pizza timer.

http://kaioa.com/k/pt2.png

http://kaioa.com/k/pt2.jar ~14kb

I initially wrote it some month ago, because I got sick of adjusting my winamp playlist to the correct length :wink:

Well, it’s pretty cool and easy to use.

-start it
-enter the time (eg “1234” for 12min 34sec)
-you can enter also things like “90” for 1min 30sec
-the maximum time is 5999seconds (99min 59sec)
-press enter to start
-press enter to abort
-press anything or click on it for stopping the alarm
-there is a JPopup menu, where you can enable/disable always on top and sound (default both on)
-if it’s armed the bulb is green/yellow… ish
-during alert the bulb flashes red and toolkit.beep() makes some noise (if sound is enabled - if not the bulb is just flashing)
-you can drag it everywhere (except those two button spots)

It checks the time 20 times per second. If there is a change in the seconds a repaint is triggered. I did it like that to avoid drifting, which you would get if you accumulate bad tries at waiting one second.

What’s missing is a visible focus indicator, but I can live without that :wink:

looks cool, but I got a strange error:

I’m pretty sure it’s just me though, I’ve gotten that error with another program recently (Meat Fighter 4K)

edit: I’m running JRE 1.4.2_03, so I’m assuming I’m getting the error because you’re compiling with Java 1.5. I don’t know why I even tried it without 1.5 seeing as that’s what this topic is about… lol
/me is slow

Awesome I like it! :slight_smile:

http://kaioa.com/k/pt2b.jar

new and improved :>

-toFront added
-also works with 1.4.x (always on top option is disabled then)
-the title also shows the remaining time

[quote] Have they sneaked in non-rectangular Frames too? Shocked
[/quote]
I believe awt team was planning this for 1.6…

Great program, but I have a dual display system:

  1. My main display 19" running 1280x1024
  2. My and my 15" display running 1024x768

I can’t drag the pizza timer over to the second display - it won’t let me drag it beyond the main display boundary.

Ooops never thought about that :-[

http://kaioa.com/k/pt2d.jar ~42kb

-comes with 4 sounds (alarm and 3 beeps) [this was added with version ‘c’]
-new “Clamped dragging” checkbox (which is on by default)
-added command line switches (-nosound, -noalwaysontop and -noclamp), which can be used for disabling anything you would switch off anyways.(*)

(*It’s not saved or anything like that… so just create a link to java [or javaw] and add those switches there like -jar “/pt2d.jar” -nosound [or whatever])

Perfect, thank you!

yeah nice program…
but it dosnt want to play a sound or whatever if the time is over… it starts just flashing a bit… :confused:
also i dont see a sound file just the image in the jar

could u maybe add a file chooser dialoge or a commandline argument with wich we can select a .wav or whatever java can easiely playback?
would be great ::slight_smile:

also i dont see a sound file just the image in the jar

Get the latest version (pt2d).

could u maybe add a file chooser dialoge or a commandline
argument with wich we can select a .wav or whatever java
can easiely playback?

Ye, maybe I’ll add that one day(*), but right now I’m quite busy with way too much other stuff. My todo list is quite overwhelming.

(* There are some small things I want to add like “overtime” [counting backwards once the alarm started], saving of the alarm “date” [in case your machine crashes for whatever reasons - so, you could resume then], the ability to use custom sounds and maybe another skin)

oh… stupid me… :confused:
didnt see that u added one letter at the end…
btw nice sounds

changing the sound should be easy… i could just replace the alert.wav with wich one i would like…

but how do i start more than one instance of this over the same vm? iv just started it 3 times and it (the vm) took 3*40mb ram/virtual space
a little much…
(btw i’v just learned java so excuse the question :wink:

That’s indeed a bit much. The default heapsize is to blame, which is a bit hefty for such a small program. You can specify a smaller one via commandline. However, it will still need more ram altogether than spawning several windows from within the application (which is a thing I would need to add).

-Xms set initial Java heap size
-Xmx set maximum Java heap size

You can try something like -Xms2m -Xmx8m, which means 2mb initial heap and a maximum of 8mb heap (if it’s exceeded an OutOfMemoryException is thrown).

[Note: The wavs are loaded to ram on startup. So if you put another big wav into the jar, the mem usage will increase drastically.]

Slick! :slight_smile:

Could you add:


      try
      {
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      }
      catch (Exception exc)
      {
         //
      }

To make the menus/dialogs look better?

And if it’s AlwaysOnTop, you can replace the Frame by a
Dialog, so it doesn’t appear on the taskbar (but be sure
to disable the ‘minimize’ button then)

System L&F hmm… I think the metal laf is ok… for the most part. But I thought about changing the colors a bit (mmm as part of the skin… mmm… feature creep :-X… mmm… waitaminute I already wrote a property loader for exactly that kind of things ;D).

The reason why I used a window is because 1.4.x doesn’t support always on top and even if it’s supported there may be people who prefer to have it minimized (makes sense if your taskbar isn’t set to auto hide). But well, I guess you can exchange it on the fly with a dialog and vice versa (I not sure if you can do something like that without flickers).

You can prevent the flickering, by making the new
Window on top of the previous, and then remove the
first one.
(if both Windows are always-on-top, they have normal
back-to-front rules, just like non-always-on-top)

Further: it’s a matter of taste I guess, but I disgust the
default L&F… your little window is so slick, and then it
has such an ugly Swing-menu :-/ but hey, I never need
the menu anyway :slight_smile:

ugly Swing-menu

Heh. You can change everything. Colors, fonts, additional icons, the border… all you need to do is overriding those in the ui manager.

UIManager.put(“Bla.something”, new ShinyWhatSoEver());

In this case I would extend DefaultMetalTheme and override some things with stuff loaded from a properties :wink:

edit: btw it’s unlikely that the thing you mentioned would prevent flicker… it’s actually the way I thought about in first place. But it’s like… everything that pops up flickers with swing.

Onyx, you need to do a 6 digit version :slight_smile:

I can’t find my alarm clock, and was going to use this to wake me up 2morrow morning - only to find it doesn’t support more than 99.99 :frowning: