Wednesday, February 20, 2008

Java Swing UI and MacOS X

I wrote an application using Swing UI library, but it does not fits to MacOS X by default. So here is a small tip how to bring main menu to MacOS. So, in your Java Swing application, if you need this:



...to be done like this:


...set com.apple.macos.useScreenMenuBar to true. It is possible to do as JVM parameter (-D is your friend), but better within the application somewhere at the beginning in the main() as follows:

System.setProperty("com.apple.macos.useScreenMenuBar","true");

This is one more step toward Apple MacOSX integreation. However, this is good for Java 1.3 and less. These days we use 1.5 or 1.6 developers preview. :-) It is quite sad that Apple Java releases takes a gap for about a year, but on the other hand Java on Mac really that stable and reliable. Well, anyway, here is the list of deprecated values system properties that were available in Java 1.3.1 but are likely trying to be no longer supported since Java 1.4.1. This is not very true due to they are supported in Java 1.6, though it is nice to get rid of them ASAP:

1. "com.apple.macos.use-file-dialog-packages" and "com.apple.macos.useScreenMenuBar" are replaced with "apple.laf.useScreenMenuBar".

2. "com.apple.macos.useSmallTabs" and "com.apple.macosx.AntiAliasedTextOn" are replaced with "apple.awt.textantialiasing".

3. "com.apple.mrj.application.growbox.intrudes" replaced with "apple.awt.showGrowBox".

Sunday, February 17, 2008

Bye-bye ReportLab

Recently I am having fun playing with my new toy: porting my Python project "OpenRML" to Java. Python's OpenRML is using ReportLab library as a PDF generator. Among it is relatively slow, also there are number of features I really missing. Also it is quite expensive by time to add third-party stuff. So I've decided to say "bye-bye" to ReportLab.
First thought was to re-implement stuff in Jython or Groovy, because these are dynamic languages. But then I've decided to go with plain Java to avoid troubles in a future.
In this project, will no more ReportLab's RML markup for documents for a number of reasons. In short: I want markup to be small, cute, flexible and extendable, unlike RML. I had implemented a reporting middle-ware in Aozora Bank and now I see why RML is quite clunky idea.
Now, the project is in very early stage, no any RPC server yet and data integration. But it already can produce something: rich text paragraphs, coloring, fancy tables, clickable table of contents, insert images from URL or file etc. 
Today I had implemented Japanese QRCode barcode. It is amazing data encoding, which is damage-resistant and can contain lots of data on quite small print-out size. We have plenty of them everywhere and we need them on a paper too. I also working on mobile application, which scans the code from a camera or any image and decodes it back to text.

Screenshot below shows what my current newly ported from Python library produces:



Tomorrow I am going to implement SVG support. :-)

Wednesday, November 28, 2007

Java 6 Port on Leopard

Recently latest Java has been partially ported to MacOSX. Still no sound support, UI libraries still require X11, no mach thread priority and other odds. However, if you run JRuby or JPython on top of it, it works faster than originally written implementations on C++.

I did not tested JRuby, but latest JPython 2.2.1 runs Fibonacci test 10% faster than CPython 2.5.1 on the same machine.

Links:
1. Java 6 port for MacOSX: http://landonf.bikemonkey.org/code/macosx/ 
2. Jython: http://jython.org/

Tuesday, November 27, 2007

Input Switch For Leopard

In Leopard 10.5 my option for International support that stays for "Allow a different input source for each document" no longer exists.

Why, Apple, why?! Steve, along with 3D dock you gave me that I pimp myself, what's wrong with multi-language support on each window separately and why I have to switch between four keyboard layouts all the time?..

Monday, November 26, 2007

Pimp Your Dock

I've just found yet another pimpizer for things and this time it had pimped my dock. Twice. Maybe previous arrows was better?

Mmm... No, I am not sure. This one is slightly better try:


Now, if you want, go and pimp up yourself. ;-) Here is the link: http://www.malcom-mac.com/pimpmydock/

Saturday, November 03, 2007

Friday, November 02, 2007

If you drink too much, then next morning, after Halloween party...