SwingLabs JXMapKit and Google Maps

As promised in my last blog entry Map Application in Swing - The Easy Way in this short blog entry i would like to explain how to change the default map providers for the JXMapKit component from the SwingX-WS project.
The sample application still has the same functionality as in my first blog entry - to simply show a map in which the host cities of the Euro2008 are marked but this time using the Google Maps Tile server as provider for the map tiles. This is how the resulting application will look like:
Main Window of the Euro2008 - Host Cities Viewer with Google Maps Provider
(more…)

Add comment June 30th, 2008 Mario Hochreiter

Map Application in Swing - The Easy Way

Ever tried to visually represent geographical information in your Swing Application? Wouldn’t it be nice to have something similar to Google maps available as a Swing component. Many thanks to the guys at SwingLabs who provide such an easy way to integrate mapping into your own Swing application. I’ll try to illustrate the very basic functionality of the mapping component JXMapKit from the SwingX-WS project.
First of I’ll give you a hint how the final application will look like:
Main Window of the Euro2008 - Host Cities Viewer
The application shows the location of the host cities of the Euro 2008 in a map.
(more…)

1 comment June 16th, 2008 Mario Hochreiter

Using java.net.Authenticator for Proxy-Authentication

The company i am currently writing code for uses a proxy for outgoing network calls. The proxy requires a username and password to let you connect to the outside world. So far so good. To connect through the proxy in my Java application first i tried to set the following properties, as suggested in some forums:

  • http.proxyHost=proxyHost
  • http.proxyPort=proxyPort
  • http.proxyUserName=username
  • http.proxyPassword=pass

But this didn’t work. I always got the HTTP error 407 which means Proxy authentication required. Reading Suns documentation for the possible proxy properties to my surprise showed that http.proxyUserName and http.proxyPassword are not listed as possible properties.
(more…)

2 comments June 9th, 2008 Mario Hochreiter

HOWTO: (Re-)Set the eth mapping

Due to some network hardware modifications on my ubuntu 7.10 system i already had 6 entries of eth devices. From which only 1 is still in my computer. Now the only network card which i am using has the name “eth5″. As some programs expect the default network card as eth0 i tried to change the name for my network card from ethN to eth0.
(more…)

Add comment March 16th, 2008 Mario Hochreiter

Debugging Swing EDT Problems

I recently joined a new project, which is all about Swing GUI programing. We had a lot of weired problems that were nondeterministic. The problem was that the Swing components were accessed from multiple threads which may lead to concurrency problems, sadly Swing doesn’t enforce you neither help you to prevent this mistake.

Always remember the following rule when working with swing: Once a Swing component has been realized, all code that might affect or depend on the state of that component should be executed in the event-dispatching thread. This rule means that every access to a swing component should occur on the Event Dispatch Thread (EDT) as soon as the component has been realized.
(more…)

Add comment October 29th, 2007 Mario Hochreiter

Maven Cobertura Plugin Version 2.1 and the 100% Line and Branch Coverage Problem

Maven’s Cobertura plugin in version 2.1 introduced a very annoying bug which makes the plugin useless. The generated HTML report always shows 100% line and branch coverage. The most recommended way to avoid this problem is to use version 2.0 of the plugin (see Maven Users mailing list). But that’s not a solution for me as the maven plugin version 2.0 still uses cobertura 1.7 for report generation which lacks some nice features of the cobertura version 1.8 which is used by the maven plugin version 2.1.
(more…)

3 comments May 12th, 2007 Mario Hochreiter

HOWTO: Print to a pdf in Firefox

Recently I wanted to print a web page to a pdf file. As I am using Firefox as my default web browser in Kubuntu this does not work out of the box like in Konqueror. Following steps are necessary to print from Firefox with kprinter (which is able to print to a pdf):

  • Type about:config in the adress bar of Firefox
  • In the filter bar type: print.printer_PostScript/Default.print_command
  • Double click on the entry and enter the following value in the popup box: kprinter --stdin

From now on you will get the KPrinter dialog and be able to print to pdf, postscript, etc, and of course to the real printers.

2 comments April 6th, 2007 Mario Hochreiter

Maven 2 Proxies

Currently i am using Proximity in an enterprise environment as maven proxy and remote repository mirror. As i am not quite happy with this solution i am still searching for better solutions. My experience so far with the different maven 2 proxies:

  • Archiva: Still alpha; not much documentation, needs to be built from source wich can be a little bit tricky …
  • Proximity: Works; slightly confusing i still do not understand the intention behind the separation of metadata and storage; hard to configure, a lot of spring configuration files have to be edited and of course there is no sufficient documentation
  • m2proxy: Simple, a little bit too simple …

(more…)

Add comment March 15th, 2007 Mario Hochreiter

Maven 2 and Groovy

I am currently trying to get unit tests written in groovy running for a maven project. First i thought this would be easy going but it is definitely not. First i tried the groovy-maven-plugin version 1.0-alpha-1-SNAPSHOT from the 27th of February.
As i want to compile my groovy unit test to java byte code I just inserted following XML snippet to my parent pom.xml:
(more…)

Add comment February 28th, 2007 Mario Hochreiter

Adobe Flash Player 9 for Linux as Firefox Plugin

1. Download from Adobe the tar.gz version of the plugin. Extract the downloaded file: tar xvzf install_flash_player_9_linux.tar.gz
2. Close all running Firefox instances.
3. Locate the firefox plugins directory. Under Ubuntu 6.06 it can be found at /usr/lib/mozilla-firefox/plugins.
4. Remove any older version of the plugin: sudo rm libflashplayer.so
5. Copy the libflashplayer.so file to the Firefox plugins directory.

Add comment February 7th, 2007 Mario Hochreiter

Previous Posts


Categories

Links

Feeds