Archiv: Contributed

Compiling OpenJDK 7 with Ubuntu 12.04 64bit

When Sun Microsystems was still the head of Java, the wise decision to OpenSource it was made. (Thank you, whoever was behind it...) OpenJDK as of today can be built without any binary plugs, so it can be considered as really OpenSource and free. To exercise the liberty of building your own, runnable Java it takes amazingly low effort - that is the topic if this short blog entry.

While consumers and corporate IT seems to prefer Windows as primary operating system, developers tend to choose a unixoid OS: Linux (Debian, Arch, Ubuntu), Apple OSX or OpenSolaris. OpenSolaris lacks a current open source desktop distribution Ubuntu was chosen for this example. To add some complexity Canonical went with a multi-arch setup since Ubuntu 11.04 which looks like being extended/change on Ubuntu 12.04. (This is described on the MultiArch wiki page. We will come back to the problems caused by the transition later in the article.)

In order to retrieve the OpenJDK sources mercurial has to be installed:

sudo apt-get install mercurial

OpenJDK contains many sub-projects, in order to be able to manage the sources separately, the hgforest extension to mercurial is used. Installing it is a little more effort:

  • Clone the hgforest sources: hg clone https://bitbucket.org/pmezard/hgforest-crew/overview/ "$HOME/hgforest"
  • Add the hgforest extension to your mercurial setup by editing ~/.hgrcand adding
    [extensions]
    forest=~/hgforest/forest.py
  • Please adjust the path accordingly, if you did not clone it to your home directory

As a last preparational step build time library dependencies have to be installed:

sudo apt-get install gawk g++ libcups2-dev libasound2-dev libfreetype6-dev libx11-dev libxt-dev libxext-dev libxrender-dev libxtst-dev libfontconfig1-dev

Now it is time to retrieve the OpenJDK7 sources - use the "7u" repository in order to retrieve the latest update release sources:

hg fclone http://hg.openjdk.java.net/jdk7u/jdk7u openjdk7u

The time depends on your internet connection of course, but it should not take longer than a couple of minutes with a consumer class broadband connection. (Calculate about 1GB of hard disc space for the sources and build output.)

Please make sure that you have a Java compiler installed, it is needed during building OpenJDK. (Of course you can use OpenJDK itself, once it has beend build.) For this tutorial a current Java JDK has been placed at /usr/lib/jvm/jdk1.7.0

After preparation is finished we can build OpenJDK on Ubuntu:

cd openjdk7u
unset JAVA_HOME
export LANG=C
export ALT_BOOTDIR="/usr/lib/jvm/jdk1.7.0"
export ALLOW_DOWNLOADS=true
export EXTRA_LIBS=/usr/lib/x86_64-linux-gnu/libasound.so.2
make sanity && time make

The "ALLOW_DOWNLOADS" parameter is used by the build system to retrieve additional libraries which are required for building and may be missing in the system wide installation. Note the "EXTRA_LIBS" environment entry: This is due to building on a 64 bit Ubuntu using the MultiArch setup. The OpenJDK build system itself does not detect where the alsa sound libraries are installed on this particular setup.

After a while (about 20 minutes, depending on your machine), you should see this:

#-- Build times ----------
Target all_product_build
Start 2012-05-12 11:40:32
End 2012-05-12 12:04:01
00:01:27 corba
00:10:15 hotspot
00:00:18 jaxp
00:00:27 jaxws
00:10:30 jdk
00:00:32 langtools
00:23:29 TOTAL
-------------------------
real 23m30.532s
user 32m10.625s
sys 2m24.617s

The OpenJDK build is created in build/linux-amd64 - you can run your Java from there:

./build/linux-amd64/bin/java -version
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-tkruse_2012_05_11_20_23-b00)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)

Bonus: OpenJDK 8 is building accordingly. Just substitute the mercurial clone path http://hg.openjdk.java.net/jdk7u/jdk7u/  with http://hg.openjdk.java.net/jdk8/jdk8/

The build result should look like this: -- Build times ----------
Target all_product_build
Start 2012-05-12 11:10:35
End   2012-05-12 11:35:00
00:01:30 corba
00:10:30 hotspot
00:00:19 jaxp
00:00:24 jaxws
00:11:08 jdk
00:00:34 langtools
00:24:25 TOTAL
-------------------------

And you can run your own Java 8 now: ./build/linux-amd64/bin/java -version
openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-tkruse_2012_05_12_11_10-b00)
OpenJDK 64-Bit Server VM (build 24.0-b09, mixed mode)

As a side note: If you are using Java Native Access (JNA) on an Ubuntu 12.04 64bit machine and you have problems with libraries not being detected properly, update to JNA 3.4, fixes have been incorporate there.

Java Testing best practice: Projekt Organisation

Im folgenden wird beschrieben, wie man sein Projekt so strukturieren kann, dass auf der einen Seite das Testen erleichtert wird, auf der anderen Seite die Tests vom produktiven Java Quellcode separiert werden. Das erleichtert zum Beispiel die Paketierung zur Auslieferung an Kunden, die lediglich den produktiven Quellcode erhalten sollen.

Bei einigen Entwicklungsumgebungen, wie z.B. Netbeans, ist bereits bei einem leeren Java Projekt eine Separierung von Test Quellcode und Java Quellcode vorgesehen: Es gibt einen Ordner für "Test Packages" und einen für "Source Packages". Im Dateisystem werden diese auf die Ordner "src" und "test" entsprechend abgebildet. Bei der Tastenausführung werden aus beiden Verzeichnissen die Quellen übersetzt und die Ergebnisse zusammen geführt. Bei dem von Netbeans standardmäßig erstellten Buildfile kann man auch von der Kommandozeile mittels "ant test" die Tests ausführen, bei "ant jar" wird eine JAR Datei (im "dist" Verzeichnis) erstellt, die lediglich den produktiven Code enthält.

Weiterlesen »

JPA Einführung: Entity Klassen

Nachdem im ersten Teil der JPA Einführung die Infrastruktur für die Arbeit mit JPA fertig gestellt wurde, kommen wir nun zu den Entitätsklassen. Bei den Entities handelt es sich um ganz normale Java Klassen (POJOs), die kein spezielles Interface implementieren oder von einer vorgegebenen Oberklasse erben müssen. Lediglich ein default Konstruktor muss vorhanden sein.
Dank JPA Annotationen kann man erkennen, dass die Objekte persistiert werden.
Möchte man EJB3 konform arbeiten, so sollten die Annotationen dort angebracht werden, wo auf die Properties zugegriffen wird: An den Attributen für field-access, an den Getter-Methoden bei property-access. Dies sollte konsistent gemacht werden, und die beiden Formen sollten nicht gemischt werden. (Zwischen den beiden Formen wird über die Position der @Id Annotation unterschieden.)
Die Annotation der Attribute hat dabei den Vorteil, dass schnell erkennbar ist, was wie persistiert wird - kann jedoch bei einigen JPA Providern zu Performance Problemen führen. Auf der anderen Seite führen Getter-Methoden, die nicht zu persistierende Werte liefern und nicht explizit von der Persistierung ausgenommen werden zu möglicherweise schwer zu findenden Programmfehlern.

Weiterlesen »

Spring Integration 2:RC1

Von der Firma SpringSource wurde jetzt "Spring Integration 2" als Release Candidate 1 veröffentlicht. Spring Integration ist eine auf dem Spring Framework aufbauendes Framework das Enterprise Application Integration und die EAI Patterns von Hohpe und Woolf umsetzt. Dabei unterstützt Spring Integration Messaging innerhalb von Spring Anwendungen und ermöglicht so einen modularen und lose gekoppelten Aufbau der Anwendung, externe Systeme können jedoch deklarativ zusätzlich angebunden werden.

Spring Integration 2 bringt bereits Adapter für die Anbindung von verschiedenen Systemen wie Messaging (JMS, XMPP), FTP, Mail, Webservices und auch spezielle Dienste wie Twitter mit. Neu ist in der Version 2 von Spring Integration dass die Spring Expression Language verwendet werden kann, und in der Eclipse basierten Spring Source Toolsuite (STS) ein grafischer Editor für die Modellierung der  Spring Integration Realisierung vorhanden ist.

Weiterlesen »

JPA Tutorial: JPA Einrichtung

JPA, die Java Persistence API bietet im Vergleich zu JDBC ein erhöhtes Abstraktionsniveau und ermöglicht damit in kurzer Zeit Anwendungen zu entwickeln, in denen Daten dauerhaft gespeichert werden müssen.
Zum Hintergrund von JPA: Bei dem Umgang mit Datenbanken gibt es schon sehr lange JDBC (Java Database connectivity) als einheitliche API um die Verbindung zu Datenbanken herzustellen. Auch hier handelt es sich bereits um eine einheitliche Schnittstelle, jedoch wird darüber lediglich festgelegt, wie Verbindungen aufgebaut werden, wie eine Abfrage eingeleitet wird und wie Transaktionen manuell gesteuert werden können.
Damit bleiben zwei Probleme: Der SQL Code muss von Hand erstellt werden, was gerade bei CRUD (Create, Update, Delete) Anwendungen viel Produktivität kostet, und zudem ist der SQL Code in der Regel herstellerabhängig. Ein Wechsel von Oracle zu Postgres bedeutet damit das Programm an vielen Stellen ändern zu müssen. Auch sind händisch erstellte Abfragen nicht immer optimal: Lazy loading von Entitäten, Caching Strategien und Transaktionssteuerung können sehr aufwendig werden. Dazu gesellen sich der relativ hohe Wartungsaufwand und die Gefahr von Fehlern die erst zur Laufzeit entdeckt werden.

Weiterlesen »

Versioning and signing jar files in Netbeans

Hi again,

these days i've got the problem that i need to add a version number to the SteelSeries java component library and to be honest i had no idea how to realize it.

So after a short internet research i figured out that there is the ability to add version information to the manifest file that's included in a jar file.

If you do not know what a manifest is or how it is embedded in the jar file you will find a detailled description here.

Now that i knew where to put the version information the question was how to get Netbeans adding this information automaticaly to the manifest file during the build process. Well Netbeans is using Ant under the hood to build your projects and because i knew ant build scripts from using the Hudson Continues Integration server it was easy to achieve this.

First of all you have to locate the build.xml file in your Netbeans projects folder. Simply open it in Netbeans itself and you will see something like this...

Weiterlesen »

SteelSeries update

Hi there,

this is just to inform you that there is a updated version of the Java Swing component library "SteelSeries" available.

I added 10 more components...

There are radial bargraphs which you could see below

ishot-4.png

 

In addition to these i added another version of the Radial2 component which is called Radial2Top

ishot-6.pngThe last component i added is called RadialCounter. I saw this kind of component during a visit of a german u-boat

where it was used to visualize the depth of the boat.

ishot-7.png

 

In addition to the new components there a some more modifications like colored tickmarks etc.

ishot-5.png

 

For more info please go to http://www.harmonic-code.org

 

Follow me on twitter if you like...

SteelSeries Java Swing component library

Here we go again...

A few months ago i started a new project where i again focussed on gauges (i love that stuff). It took me some time because i only work on the project on my spare time (which is rare) but now i finished a first version of a little library that contains a lot of gauges for Java applications...

First of all i have to mention that this library was not meant to be a professional components library and should not be used on mission critical software. Means if you use the library it's on your own risk !

I've never before created a component library and for me it was and is a great challenge to dive deeper into the Java universe...

But now let's have some fun...

The library contains two general types of gauges, radial and linear ones and some little candy in the form of additional components like a Radar component etc.

I add some properties to the gauges that hopefuly will be useful for some of you.

Here is a short list of the most interesting features:

  • frameDesign (metal, shiny metal, blackmetal)
  • backgroundColor (dark gray, light gray, white, black, beige, red, green blue)
  • pointer/bar color (red, green, blue, yellow, orange)
  • a three colored track to visualize areas of special interest (e.g. a critical temperature range)
  • thresholdIndicator
  • blinking threshold led (red, green, blue, orange, yellow)
  • adjustable tickmarks
  • indicators for min. and max. measured values
  • auto reset to zero feature

It should be possible for you to create your own components out of these library and  if you'll take a look at the source you will find components like Radial1Lcd, Radial2Lcd and Radial3Lcd where i used Netbeans matisse gui builder to create the component from the FrameCircular and DisplaySingle components.

So you should be able to check read the sourcecode of these components and see how i did it (the easiest way would be to use Netbeans to check the source).

But to give you a impression, let pictures speak...

Weiterlesen »

Java2D Conical Gradient Paint

Just a short blogpost about a little tool that i would like to share with you...
A few months ago i was creating a worldclock with a night and day display where i needed a conical gradient.
So what is a conical gradient ? Here we go...

Weiterlesen »

Android AutoConversion EditText component

AutoConversion EditText component:

Yesterday i created a Java Swing textfield component that autoconverts a given value into a selectable unit which could be useful.

In the evening i got the idea to port this component to Android and see if it will work there.

Just as a short note...if you are a Java developer you should take a look into Android...it's sooooo nice, porting the component tooks me not more than 2 hours (and i'm not really into Android development).

Here is the result:

ishot-2.pngishot-3.pngishot-4.png

 

 

 

 

 

 

 

 

 

 

 

So you could type in a value with the unit of your choice and after leaving the field the value will be converted into the EditText "base unit".

I changed the units with special characters like µ, Å, ² and ³ to u, A, 2 and 3 which leads to units like:

um  <=>  µm

A <=>  Å

m2  <=>  m²

m3  <=>  m³

and so on...

The upper spinner will select the type of unit you would like to use.

The middle spinner will select the current base unit for the textfield.

The lower spinner will adjust the number of decimals for the textfield.

Because it displays the unit directly in the textfield there's no need for a additional label for the unit.

You also might check this little video

Well again this is nothing very fancy or gui related but it was a nice challange for me so i decided to share it with you... AutoConversionField.zip

 

follow me on twitter if you like...

 

Java AutoConversion textfield component

AutoConversion textfield component:

If you drive a motorized stage of a microscope you often have to handle coordinates in a unit like millimeter [mm]. But it might happen that the sample in your microscope is only in the range of microns [µm].

So would it not be nice to directly type in the coordinates in µm and the textfield would automaticaly convert the unit into [mm] ?

This would increase the workflow a lot because you do not have to think about conversion of units. There seems to be countries that are using inches and people living there might like to type in coordinates in inches instead of millimeters..etc...

For this reason i created a little component that extends a standard javax.swing.JTextField and is now able to do the conversion. You could also use the conversion alone without the textfield to create some kind of unit converter...it's up to you.

Here are a few screenshots of a demo app that uses the component:

#1 Step

#3 Step#2 Step

So you could type in a value with the unit of your choice and after leaving the field or pressing enter the value will be converted into the textfields "base unit".

The upper combobox will select the type of unit you would like to use (it supports angle, area, length, mass, temperature, time at the moment but one could easily add more units to it).

The middle combobox will select the current base unit for the textfield.

The lower combobox will adjust the number of decimals for the textfield.

Because it displays the unit directly in the textfield there's no need for a additional label for the unit.

You also might check this little video

Well this is nothing very fancy or gui related but it was very useful for me so i decided to share it with you... ConversionField.zip

 

follow me on twitter if you like...

Kritische Sicherheitslücke im Spring Framework

Spring Source hat mit CVE-2010-1622 auf eine kritische Sicherheitslücke im Spring Framework aufmerksam gemacht. Die von Meder Kydyraliev, Google Security Team gefundene Lücke ist seit April bekannt und wurde mit dem Release Spring Framework 3.0.3 gefixt. (Dieses Release wurde jedoch nicht als sicherheitskritisch gekennzeichnet und das Problem könnte so leicht übersehen werden!)

Weiterlesen »

JUG SummerEvent

Am 12. Juni ist es soweit...ich werde bei mir zu Hause den inoffiziellen JUG SummerEvent veranstalten...

Dabei geht es im wesentlichen darum sich zu treffen, ein paar Bierchen zusammen zu trinken, etwas auf den Grill zu schmeissen und natürlich auch ein wenig Java zu coden (natürlich nur wer Lust dazu hat). Desweiteren steht ein Tischkicker, evtl. eine Carrerabahn (muß ich erst aufbauen) und ein Trampolin zur Verfügung für diejenigen von Euch, welche sich sportlich betätigen möchten.

Da wir bei uns zu Hause natürlich keinen geeigneten Raum haben um Vorträge zu präsentieren, würde es sich ja anbieten diesen Event für sog. Lightning Talks zu nutzen. Dabei kann jeder der Interesse hat ja etwas vorbereiten, was er den anderen in max. 10 Minuten zeigen möchte.

Ihr könnt Euch auch hier bei Xing als Teilnehmer eintragen falls Ihr mögt...

 

Zur Veranstaltung:

Wer: jeder der Lust und Zeit hat sich ein wenig auszutauschen

Wo: Bei mir zu Hause (Westfalenstrasse 93, 48165 Münster GoogleMaps)

Wann: ab 11 Uhr könnt Ihr bei mir eintrudeln, Ende offen

Mitzubringen sind:

- Grillfleisch

- Notebook (falls benötigt)

- wenn mögich Salate und Brot

 

Getränke, Grill etc. sponsor ich...

sonne.gif

Using Smack xmpp lib on Android with Netbeans

Android + XMPP + Netbeans

Last week i got my Android phone and finally started coding for a mobile phone (which really is a great experience and lot's of fun).

During my daylight work i'm using xmpp in different projects and tools and so i would really like to use it on the Android phone also. In the java world there is a really neat library called smack from ignite realtime which makes using xmpp a piece of cake and so i asked myself if it would also run on android?

Yes it does...BUT...you need a patched version that i found on the net...
In Eclipse it seems to be easy to link a external library to a android project but in Netbeans i was not so intuitively as i thought...
You need three little steps to include a external library like smack and here they are:

#1 STEP:

Create a local folder named "lib" in your Android project folder like this:

lib folder in project directory

Now copy the patched smack.jar file into this folder.

Weiterlesen »

FXG to Java2D converter

convertersplash.png

During the last months i was working a lot on Java Swing components which really is a lot of fun. It took me some time to establish a workflow to transfer my design prototypes from Adobe Fireworks into Java2D elements.

With not too complex shapes this was not a big deal even if it was a lot of coding (see also Drawing in code part I and Drawing in code part II) but during the work on my current component (which will be a combination of weather and time of day display for different cities) i needed to create clouds...

Did you ever create clouds in vector programs ? It's really not so easy if they should look nice and you will need a lot of ellipses in different sizes to get a result which looks not too bad.
After creating my first cloud out of 49 circles (all the same size) i figured out that it would take a looooooooong time to complete these clouds.

Weiterlesen »

Swing event departure board

Sitting at Gard du Nord train station in Paris in January this year i saw this huge departure board:

Gare_du_Nord_Paris.jpg

It was fascinating to see and hear all these flipping characters everytime a departure time changed. I guess most of you know already how these boards work but for all others i will explain it shortly.

The arriving trains are in chronological order from top to bottom of the board which means the trains that arrives as next stays on top of the board.
The flipping characters are made of little metal plates that are printed on the front and backside with characters that are split into half. The Top part of the character is printed on the frontside of the upper plate and the bottom part of the character is printed on the backside of the lower plate (i tried to visualize it with a little image).

Weiterlesen »

Swing Weather Worldclock

Remember the worldclock blogpost? Well it was ok but i thought there was one thing missing...

Weather information

For that reason i added this missing feature to the known worldclock component so that you now might choose out of four clocks:

  • Pure clock and icon indicator for time of day
  • Pure clock, icon indicator for time of day and weather information
  • Clock with inbuild time of day display
  • Clock with inbuild time of day display and weather information

This image shows all available clocks:

ishot-6.png

To get the weather information for all the cities in the enum i provide, i needed to add the country for each city and by adding all these countries i translated the cities to their (hopefully) right english names (in the original worldclock post i used german city names).

I use weather underground to retrieve the weather information because they provide an easy to access service for free. You will find a package called "net" in the project in which i put the classes responsible for fetching the weather condition. There is timer which checks every 30 seconds for the availability of the connection.
The clockpanels will every 10 minutes add a so called ConditionFetcher thread to the queue of the WeatherService which will be handled by a ExecutorService. The WeatherService will tries to use the system proxy server if there is one so it hopefuly works out for you.

The most of the work was done by creating all the different weather condition images which you will see in the next image:

ishot-7.png

Weiterlesen »

Swing Worldclock

During my trip to JFokus conference last month i was waiting for the train on a german trainstation.
Because i started working on a little swing tool (i will blog about it later) for our usergroup i was in the need for a analog clock.
So the german railway company "Deutsche Bahn" has a famous analog clock on nearly every german trainstation which looks like this:

DB_Clock.jpg

Weiterlesen »

Drawing in code (Part 2)

Drawing in code:

Part 2 (Transfer the prototype into swing):

So you will find out that this is not magic but only drawing the same elements that we used in the vector drawing programm but now in their Java2D representations. We just create a buffered image with the same size as the prototype. So we could use the same pixelcoordinates for the shapes and gradients in swing.

Weiterlesen »

Drawing in code (Part 1)

Drawing in code:

Part 1 (Drawing the prototype):

After i published my little fun swing nixieclock i got a lot of requests on how i transferred the image into swing.
Because i remember when i was starting swing development i asked myself the same questions when i saw the amazing work of swing/design guru's like Kirill Grouchnikov, Romain Guy, Joshua Marinacci, Chet Haase, and others.
Well in the meantime i figured out how to do this and find a workflow that i would like to share here. By the way this is really nothing compared to the things these swing/design guru's are able to do.

So here we go, first of all i have one good advice for you "Know your tools",
which means not only java and swing but also your graphics program.

So i'm using Adobe Fireworks for that but you could also use any other kind of graphics program like Adobe Photoshop, Gimp, Inkscape etc.

I will start the tutorial with the drawing of the tube in Adobe Fireworks because it makes coding in swing so much easier if you know how to draw it in a graphics program. So the first part will be focussed on the drawing and the second part will explain how to draw all the different points in java2d/swing:

Weiterlesen »

Swing NixieClock

During my search for some i²c stuff i found these nixie tube clocks. So my first idea was to create such a clock in Swing.
Here is the original i took as master...

To my surprise it was really not a big deal to complete this task and it tooks me around 4 hours until i got my first homebrew swing nixie clock.
Because i received some question on how i did this i will shortly explain it here:

Weiterlesen »

Swing Apollo space program mission timer

Still on vacation i took the chance to spent some time on watching movies i ordered some time ago and so i watched several movies related to the Nasa moon landing program which lead to the landing on the moon in july 20th 1969.
In the movie MoonShot which tells the story of Apollo 11 and it's flight to the moon in 1969 i was fascinated by the board computer of the command module and took a picture of the mission timer which looked great to me...

MissionTimerOriginal.jpg

Because i love coding in Java and those things could be easily done in Java's swing framework i decided to create a little mission timer by myself and that's a picture of the result

MissionTimerJava.png

I don't know if it's useful to anybody but for those of you who like it, i added the source as netbeans project here MissionTimer.zip

You will find two classes in the project, a JFrame and a TimerPanel. (If you would like to use the TimerPanel in another project you just can drag'n drop the TimerPanel class onto a JFrame, JPanel etc.)

To start or stop the timer you just have to click on the panel with the left mousebutton. To reset the panel just doubleclick on the panel.

Enjoy it and keep swinging...

Custom swing component

During my vacation i'm playing around with the SunSPOT's from Sun Microsystems which are fantastic little gadgets. (Please find more information about them here.)
I attached a combined temperature/humidity sensor to one of my spots and used xmpp protocol (with smack library) to communicate with my SunSPOT host application from wherever I am.
To visualize the measured values I needed something sexy and because there was nothing ready to go I created two little "instruments" that I would like to share with you.

And here they are:

First a gauge:

ishot-2.png

Second Java Swing component is a display (yes I know it's inspired by Apples iTunes):

ishot-1.png

Third custom Swing component a combination of the display with a led panel:

ishot-3.png

I think I'll have to do some work at the 3d-effect of the rounded rectangle but as a first prototype they looked ok to me.

You can find my presentation on custom Swing components here, the Netbeans project for the components in the article can be downloaded here: Instruments, the Netbeans project for the application from the slides is here: SD.zip

If you are interested, please leave a comment...

JavaFX Composer

Seit dem 15.12.2009 läßt sich der auf der Devoxx 2009 angekündigte JavaFX Composer unter Netbeans 6.8 als Plugin installieren.
Voraussetzung dafür sind Java 6 und eben Netbeans 6.8. Da meine ersten JavaFX Versuche meistens kläglich gescheitert sind, war ich schon ganz gierig auf das Tool und habe mir heute morgen mal 2 Stunden mit diesem Tool gegönnt.

ishot-3.png

Hier mein erstes Fazit:

Die Installation des Composer's war sehr einfach, man geht in Netbeans in die Plugins und macht dort ein "Reload Catalog".
Daraufhin findet man unter den "Available Plugins" nun auch den sog. "JavaFX Composer".
Diesen wählt man dann einfach aus und installiert das Plugin...fertig.
Legt man jetzt ein neues JavaFX Desktop Projekt an, so öffnet sich ein Design View, ähnlich wie man es vom eingebauten Swing Matisse GUI Builder gewohnt ist.
An der rechten Seite finden sich die zur Zeit zur Verfügung stehenden Controls (wie z.B. Panel, Button, Check Box, etc.), welche sich durch drag'n drop auf die Designfläche ziehen lassen.
Dort kann man nun wie gewohnt die Größe und Position anpassen. Der Properties Dialog, welchen man unterhalb der Palette findet ist konfigurierbar gestaltet, was es einem ermöglicht lediglich die Parameter zu sehen, welche man im Regelfall ändern möchte. Muß ich bspw. häufig Transformationsparameter (z.B. Rotation etc.) für Controls einstellen, so kann ich diese Properties über einen extra Knopf in der Liste sichtbar machen...nette Idee, wünschte ich mir auch für den Swing GUI Builder.

Über dem Designbereich findet man einen Bereich, in welchem States definiert werden können. So kann ich bspw. ein Textfeld auswählen und die Transparenz für dieses Feld auf 50% setzen. Danach lege ich einen neuen State an und setze die Transparenz für dieses Feld auf 100%.
Nun kann ich durch einen Knopf, welcher sich neben jeder Property im Properties Dialog befindet in einem extra Dialog den Übergang zwischen den States festlegen, dabei kann man bspw. Parameter wie Dauer der Transition, Übergangsart (linear, ease in , ease out, etc.) festlegen.

ishot-1.png

Somit lassen sich relativ einfach animierte UserInterfaces zusammenklicken, ohne das man dazu in den mir noch etwas befremdlich wirkenden JavaFX Code eintauchen muß.
Für eine Preview Version läuft der Composer recht stabil, es braucht jedoch ein wenig Zeit, bis man sich mit dem Prinzip der States angefreundet hat.

Sun hat natürlich vorgesorgt und hat für den Composer ein Wiki angelegt, welches bereits umfangreiche Informationen zur Arbeitsweise mit dem Composer enthält. Ihr findet das Wiki hier.
Der Composer ist mit Sicherheit ein ganz wichtiges Tool um die Verbreitung von JavaFX zu fördern, da man nun endlich in der Lage ist ein UserInterface für eine Applikation zusammenzuklicken. Das komplette coden der UI ist doch für viele ein Hemmnis, vor allem wenn man noch nicht mit der Syntax von JavaFX und dessen SceneGraph vertraut ist.

Devoxx Konferenz: Tag 3

Der dritte Tag Devoxx - der erste Tag der Deboxx Konferenz.
Es gab viele interessante Talks - unter anderem Java Enterprise Edition 6 (JEE6), für das mit Glassfish zum 10. Dezember 2009 eine Referenzimplementierung angekündigt wurde. Ansonsten hat Mark Reinhold für Java JDK 7 Closures in Aussicht gestellt, die eine einfache Version der viel diskutierten Closures für Java darstellen könnten. Ganz im Sinne der 80/20 Regel sieht Reinhold da die Chance einen Großteil der Wünsche der Community zu befriedigen, aber evtl. ein paar Randfälle außen vor zu lassen.

Weiterlesen »

Devoxx update #2

Zusammenfassung des zweiten Tages:

Folgende Talks waren heute auf dem Programm:

  • Effects in Flex von Chet Haase

    Dieser Talk war im Programm zunächst gar nicht vorgesehen, da aber ein anderer Talk ausgefallen war ist Chet Haase eingesprungen.....zum Glück.

    Also ich war ja gestern schon von Adobe's Catalyst Tool sehr angetan und als ich heute gesehen habe, was mit Flex 4.0 alles so geht, war ich ja schon ein wenig neidisch. In dem Talk zeigte Chet was sich mit Flex 4.0 in Sachen Animationen so alles getan hat und ich muß sagen Hut ab, einfacher geht es bald nicht mehr. Wenn ich also bspw. ein Userinterface in Flex gestalte, kann ich diesem sog. States hinzufügen. Nun kann man jedem State gewisse Eigenschaften verpassen wie bspw. Opacity, Position, Size etc. danach kann ich bestimmen, wie die Transitions zwischen den einzelen States aussehen sollen und fertig. Dabei wird also z.B. ein Anfangszustand eines Objektes angegeben (z.B. Farbe=Rot) und ein Endzustand (z.B. Farbe=Blau) und dann legt man nur noch fest wie der Übergang von Anfang- zu Endzustand ablaufen soll (mit sog. "easing" oder ohne) und das war's.

    Alles in allem für einen Ersatztalk sehr beeindruckend.

  • Turbocharge your UI in Android von Romain Guy

    Auch dieser Talk war ein Ersatztalk für einen ausgefallenen Talk und war im Prinzip die Wiederholung eines Talks von der letzten Google IO Konferenz. Es ging im Prinzip darum wie man in Android das Ansprechverhalten seiner Anwendung verbessern kann bzw. möglichst hohe Framerates erreicht um ein responsives Userinterface zu erhalten. Hier war der eine oder andere Trick dabei, welcher sich auch durchaus in Swing übertragen ließ, alles in allem aber nicht so wertvoll für mich, da ich leider nicht über ein Android Phone verfüge.

  • The Java FX platform - a java developers guide von Stephen Chin

    In diesem Talk wurde zum einen noch einmal das Binding Prinzip in Java FX erklärt, es wurde auf das WidgetFX Project von Stephen Chin eingegangen und ein Program entwickelt, welches Devoxx bezogene Tweets in einem schicke Fenster ausgibt. Das Beste an diesem Talk war jedoch die Einlage von Tor Norbey, welcher ein brandneues Java FX RAD Tool vorgestellt hat, welches in Netbeans 6.8 als Preview enthalten sein wird. Und dieses Tool ließ mich dann wieder hoffen, denn im Prinzip fanden sich hier viele Dinge wieder, welche ich bereits gestern und heute in Flex Talks gesehen hatte. Man kann in Zukunft in Netbeans direkt in eben dem neuen RAD Tool UserIntefaces in Java FX zusammenklicken. Hier lassen sich nun auch States und Transitions zwischen diesen States definieren. Das ist genau das Tool, worauf ich gewartet habe, denn wer hat schon Lust alles von Hand zu coden. Mit Hilfe dieses RAD Tools wird es sehr sehr einfach werden ansprechende UserInterfaces zu bauen, welche Transitions mit Animationen beeinhalten und ich denke das wird Java FX eine großen Schub geben.
    Es sei angemerkt, daß es sich hierbei nicht um das Java FX Authoring Tool handelt, welches Tor auf der Java ONE vorgestellt hat sondern um ein zweites in Netbeans integriertes Tool. Jetzt heißt es also warten auf Netbeans 6.8

  • A year of monitoring with Java-Monitor von Kees Jan Koster In diesem Talk ging es um das Java-Monitor Tool und viele Informationen zu den verschiedenen Versionen des Garbage Collectors in der JVM. Der Talk war wirklich sehr interessant, aber leider mußte der Author etliche Slides überspringen, da er mit der Zeit nicht hinkam, somit freue ich mich schon auf die Version in Parleys, damit ich mir das ganze noch einmal ausführlich anschauen kann.
  • So, daß war's erst mal wieder und jetzt geht's auf zu Tag 3 der Devoxx

Devoxx update

Zusammenfassung des ersten Tages:

Thomas und ich sind ja diese Woche auf der Devoxx in Antwerpen (Belgien). Diese Konferenz ist die größte Java Entwicklerkonferenz in Europa und auf jeden Fall eine Reise wert.

Folgende Talks standen bei mir heute auf dem Programm:

  • Introduction to Java Generics von Prof. Eric Steegmans

    Der Talk war im Vorlesungsstil wobei Prof. Steegmans anhand einer BoundedArrayList den Einsatz von Generics in Java erklärt hat. Interessant waren die Hinweise auf Tücken und Problem, welche beim Einsatz von Generics in Java auftreten können. Es wurde jeweils dargestellt, wie sich Generics in Java im Vergleich zu Generics in anderen Programmiersprachen verhalten. Besonderes Augenmerk wurde auf den Punkt "Type Erasure" in der JVM gelegt, welche die Abwärtskompatibilität zu älteren Java Versionen sicherstellt und auch den Hauptunterschied zu dem Einsatz von Generics in anderen Programmiersprachen darstellt.

  • JSF 2: Keep the progress coming von Dan Allen, Peter Muir und Andy Schwartz Angekündigt war der Talk unter anderem auch für Neulinge auf dem Gebiet JSF, womit ich mich eindeutig identifizieren konnte und somit teilnahm. Leider muß ich hier gestehen, daß ich den Saal nach der Hälfte der Zeit (1.5 Stunden) verlassen habe, weil ich kein Wort verstanden habe. Ich vermute für Leute mit JSF / JSP / Facelet Hintergrund war der Talk durchaus interessant, aber für Neulinge war er eindeutig zu detailverliebt und nach meiner Meinung ungeeignet.
  • Design to development Part 1: Adobe "Flash" Catalyst von Chat Haase Allein der Name des Speakers war für mich schon Grund genug an diesem Talk teilzunehmen, denn wer Chat Haase kennt (er ist ein ehemaliger Sun Mitarbeiter, welcher lange Jahre im Java2D Bereich tätig war und letztes Jahr von Sun zu Adobe gewechselt ist), der weiß, daß er ein hervorragender Speaker ist, welcher es versteht das Publikum zu fesseln. Obwohl es sich ja hierbei nicht um Java sondern um Adobe Flash handelte war das Tool Adobe Catalyst wahrlich faszinierend. Mit diesem Tool kann man ein Userinterface zusammenstellen, welches man vorher zum Teil in Adobe Photoshop oder Adobe Illustrator erstellt hat. Als Beispiel wurde hier z.B. ein Suchfeld aus einem Adobe Photoshop Bild erzeugt, ein in Adobe Illustrator designter Button hinzugefügt und eine ScrollBar ebenfalls aus einem Adobe Photoshop Bild erzeugt. Man kann sich das so vorstellen, daß man in Catalyst ein Adobe Photoshop Bild öffnet und dort z.B. ein gemaltes Textfeld selektiert, dann sagt man in Catalyst, daß es sich bei dieser Selektion um ein Textfeld handelt und fertig ist das funktionstüchtige Textfeld, welches sich dann gleich als SWF-File kompilieren und starten läßt. Alles in allem eine eindrucksvolle Demo, wobei man jedoch auch sagen muß, daß es sich bei dem Tool um eine Betaversion handelt und die finale Version erst nächstes Jahr erscheinen wird.
  • Design to development Part 2: Adobe "Flash" Builder von Christophe Coenraets In diesem Talk wurde das Userinterface aus dem vorigen Talk verwendet und mit Daten aus einer Serveranwendung gefüllt. Dieser Talk war wieder eher etwas für Flash Entwickler und nicht für Unwissende wie mich, jedoch wurde die Anbindung einer Flash Anwendung an Daten von einem Webserver sehr anschaulich dargestellt. Alles in allem kann ich hier den Jungs von Adobe nur ein Lob aussprechen für die wirklich gelungene Präsentation eines kompletten Workflows.

So das war nun der erste Tag der Devoxx und wir freuen uns schon auf Tag 2...

Kanban: Agile und lean

Kanban in Action - so lautet der Titel eines dreistündigen interaktiven Vortrages auf der Devoxx 2009. Olav Maassen motivierte auf anschauliche Weise die Ideen und Konzepte dieser agilen Methodik.
Sehr faszinierend waren die eingebauten Übungen, bei denen man typisches Verhalten an sich selber beobachten konnte - die teils negativen Aspekte versucht Kanban hierbei zu vermeiden oder zumindest abzumildern.

Weiterlesen »

SwingDemo Projekt

In Ergänzung zum Talklet "Swing and you're winning" der JUG Münster vom 03.11.2009 finden alle Interessierten hier die Applikation als Java Webstart Version. Der Talk soll die Möglichkeiten vermitteln, welche Swing zur Verfügung stellt vor allem im Hinblick auf sog. "custom components".
Für die SwingDemo wird auf jeden Fall Java 6 benötigt. jws_launch.gif SwingDemo

Desweiteren stehen Euch hier die kompletten Quellen als Netbeans Projekt zum Download zur Verfügung.

Es soll noch ein Workshop zu dem Talk folgen, bei welchem dann mit den bestehenden Quellen ein wenig rumgespielt werden soll. Der Termin hierzu wird noch auf http://www.jug-muenster.de bekannt gegeben.

Viel Spaß beim coden...