2012-07-09

Log-off, restart and power-off in Windows 8

Recently I've installed a Release Preview of Windows 8 in virtual machine. Luckily apart from completely new Start menu, all other major features are similar to Windows 7. Also the new Windows Explorer includes the scenic ribbon, which I prefer much more than previous "hidden-until-alt-key-pressed" regular menu.

But there are some basic things in Windows 8 I needed to re-learn, even though I find it unnecessary to be so complicated (compared to previous Windows):

  • Power options: (restart, hibernate and power-off)
  • Logging off
  • Swithing users (WinLogo+L)

To find how to turn off the system I needed to consult Windows Help (it proved to be helpful this time). But to find out how to use new "Sign-out" function I needed to use Google for it, but again I've found what I was looking for:

http://www.askvg.com/how-to-log-off-restart-and-shut-down-windows-8-pc/

To be honest, sign-off is now similar to web e-mail programs, where one needs to click user account image to close the session (okay, I consider this to be a slight improvement). But putting power options inside a hidden, pop-up vertical bar of new Start menu is way too complicated! Since Windows 95 a user needed just to click "Start" to find option to close the system - now it's so well hidden I suppose less experienced users will just pull the physical plug than to find where the damned power-off button is.

2012-05-26

Elegant Event Handling in Java

Here's a comment I added to a great post with a very nice piece of Java code:
Elegant Event Handling in Java

Yes, that's very elegant. I was implementing some Java class, when I went "hey, I need to handle events". I know how to do this in Delphi and .NET/C#, and I know how to use Swing events (even if I don't really like their approach).

So I've looked into JButton searching for "actionPerformed()" method, but no luck.
Then I went to AbstractButton and found "fireActionPerformed()" - which looked pretty ugly.
I even went to EventListenerList - to confirm my suspicion, that there is a mess in Java regarding events. And it is inherited from old, pre-generics, Swing design.

I knew there must have been some better way.

I've found Mr HappyObject - funny, but not so useful.
Then this: How To Create Your Own Events In Java - little better, and with synchronized methods (nice bonus).
This one looked promising: Generic event code - quite promising, but I kept on looking.

But your code is the best so far. I'm going to test it and will probably use it in my internal, little project.

Thanks a lot!

And here is a link to original code on GitHub: EventListeners.java