« April 2007 | Main | June 2007 »

May 28, 2007

Tip of the day - Native look and feel

Windows look and feel is activated by adding the "-native" argument to the exe file. There is a CMD script in /system that will launch your application in Windows mode. All Darkstar applications support this.

May 27, 2007

Writing Darkstar applications in Python

You don't have to use Java in order to create Darkstar applications. Here is a simple project I wrote in Python - py_dsi.zip.

Darkstar application written in Python

makefile
hello.jfc - Install Fabric if you want to create the JXML file.
hello.jxml

Doing layout in Fabric

<layout class="java.awt.BorderLayout" xmlns:t="teppefall">
<component class="javax.swing.JScrollPane" constraint="Center" id="scroll">
<property name="viewportView" type="Component">
<component class="javax.swing.JList" id="list">
<!--<property name="background" value="#0000ff" type="color"/>-->
<property name="cellRenderer" type="Object" value="com.teppefall.ds.layout.jxml.MediaListRenderer"/>
<property name="listData" type="Vector">
<vector>
<item>StreamingServerOne</item>
<item>StreamingServerTwo</item>
</vector>
</property>
</component>
</property>
</component>
<component class="javax.swing.JPanel" constraint="East">
<!--<property name="background" value="#ff0000" type="color"/>-->
<layout class="com.teppefall.ds.layout.jxml.AssemblyBoxLayout$VBox" link="true">
<component class="javax.swing.JButton" text="Add..." id="add"/>
<rigid value="0,6"/>
<component class="javax.swing.JButton" text="Edit..." enabled="false" id="edit"/>
<rigid value="0,6"/>
<component class="javax.swing.JButton" text="Remove..." enabled="false" id="remove"/>
<rigid value="0,6"/>
<component class="javax.swing.JButton" text="Close" id="close"/>
</layout>
</component>
<layout class="java.awt.BorderLayout" constraint="South">
<component class="javax.swing.JPanel" constraint="West">
<component class="javax.swing.JButton" text="Help" id="help"/>
</component>
<component class="javax.swing.JPanel" constraint="East">
<!--<property name="background" value="#00ff00" type="color"/>-->
<component class="javax.swing.JButton" text="Watch" id="watch">
<property name="defaultCapable" value="true" type="boolean"/>
</component>
</component>
</layout>
<listener type="selected" source="list" button="remove"/>
<listener type="selected" source="list" button="edit"/>
</layout>

hello.py


# hello.py
# Darkstar demo based on Python
from java.io import *
from java.awt import *
from java.beans import *
from com.teppefall.ds import *
from com.teppefall.ds.console import *
class JythonImporter:
def decode(self, xml):
decoder = XMLDecoder(BufferedInputStream(FileInputStream(xml)))
assembly = decoder.readObject()
return assembly
class Hello(Application):
jxml = "hello.jxml"
def __init__(self, args):
Application.__init__(self, "Servers", "Teppefall", "http://localhost", args, Dimension(416,235))
assembly = JythonImporter().decode(self.jxml)
if not assembly:
self.getApplicationFrame().getContentPane().add(Label("Not found: " + self.jxml))
else:
self.getApplicationFrame().getContentPane().add(assembly.getPanel())
list = assembly.getComponentById("list")
add = assembly.getComponentById("add")
edit = assembly.getComponentById("edit")
remove = assembly.getComponentById("remove")
help = assembly.getComponentById("help")
watch = assembly.getComponentById("watch")
edit.setEnabled(1)
remove.setEnabled(1)
self.showApplication()
if __name__ == '__main__':
import sys
##Application.launch(Hello.__class__) # broken under Jython
Hello(sys.argv)

May 26, 2007

Adobe Apollo + Flex

Here is a simple Adobe Apollo application that was created using the Adobe Flex Builder. The email form is just a test of Actionscript model validation and does not send an email. HelloAir.air (requires the Apollo runtime) Flash plug-in version (runs in the web browser)

The Flex Builder is pleasant to use and very powerful. Since it is based on Eclipse the learning curve was zero. You can get a free version of Flex and just run with that, but most professionals will probably just buy the IDE. My biggest problem with Flex is getting the layout correct and that all the "fancy" effects might result in some horrible user experiences if the developer uses them all over. Effects might even become the new blink tag if it goes too far.

I am also seeing a lot of scroll panes inside scroll panes on the web. Might be a sign that Adobe need to push some better documentation to its developers or that Adobe's layout code needs some work. The image browser example used in this application sometimes refuses to use 100% of the available (parent component) width. Maybe it's a bug. Inconsistent behaviour (behavior) in Flex layout is my biggest concern. In JFC/Swing inconsistency usually means that you have done something wrong or that you have messed with minimumSize, preferredSize and maximumSize. In Flex I guess it means that I am not talented in Actionscripting.

The Apollo SDK also feels a bit lightweight for something coming out of Adobe. Apollo/Flex is very powerful indeed, but the SDK does not reflect this. Third party applications are currently in crash-o-rama spectacular mode since about 60% of non-Adobe demo applications throw exceptions. It is alpha after all.

Adobe Apollo demo
Adobe Apollo demo
Adobe Apollo demo
Adobe Apollo demo
Adobe Apollo demo
Adobe Apollo demo

Using Darkstar 2D in a CAPTCHA system

Darkstar 2D, the system that powers Surface, can also be used in web applications. Here is a simple example in the form of a visual barrier. Darkstar 2D also supports rendering over Java RMI if you need to be able to read Photoshop PSD files on a Mac from a Linux server. The RMI code takes forever to initialize but is quite snappy when operational.

This example is running on a Linux box and uses -Djava.awt.headless=true since it has no GUI system installed.

visualbarrier

May 24, 2007

Source code example from the Darkstar SDK

ColorAction.java
ColorIcon.java
PaintAction.java
Subpixel.java
SubpixelRenderer.java

Install Subpixel

Subpixel

May 22, 2007

Edit this page

Press this link if you have Java 6.

Install Alter

The application might hang due to a thread/UI/IO problem. This is labs.teppefall.com after all. It is probably a race condition. I changed the threading code last week and it bit me in the ass.

May 21, 2007

Microsoft Popfly

My positive personality thinks Microsoft Popfly is interesting and progressive. A fancy version of Yahoo Pipes with a side of Vista Gadgets. My realistic personality thinks this might cause an avalanche of invalid HTML and Javascript with metric tons of vendor lock-in. If Microsoft does not validate the code produced by Popfly users this could be seen as an attempt to kill off Firefox and to create the anticipated Microsoft WWW. A project spearheaded by FrontPage, IIS and Word HTML export.

I hope my positive personality is correct though. We need more interesting stuff online. I am bored.

Another Photoshop mock-up

Has anyone implemented a multibutton like this ? Mac OS X use them in tabs and they are common in tools like Dreamweaver.

Multi button Photoshop mock-up

May 20, 2007

Java FX

There has been a lot of broo-ha about Sun's new Java FX platform. Personally I see Java FX as an attempt to move forward on the mobile platform and to replace Java ME with a more powerful Java SE stack, but a lot of people see this as a Flash/Flex/WPF competitor and therefore po-po it as such. Maybe the people at Sun didn't get or read the memo. Or maybe the memo raised an ArrayIndexOutOfBoundsException when reading it backwards. Who knows.

Flash is a success because it has a tool (Flash), a content pipeline (Photoshop, Illustrator, After Affects), server objects, a vector engine and video codec's that runs almost everywhere. Flash is more common on the desktop than Java. Java on the other hand is on almost every cellphone and since cellphones are soon becoming desktop “replacements” (Apple iPhone, Sony Ericsson P1i, Nokia E90) this is an interesting place to be. Whether Java FX is for the desktop or for mobile devices is currently unknown (to me anyway) but it reminds me of Macromedia old “Flash Mobile” speak about building the application once and deploying everywhere and in everyone's pants. “Is that Java FX you got in your pocket or are you just happy to see me ?” Well, Macromedia bored me to tears with all their “HTML is dead” nonsense so maybe I have a higher bullshit tolerance than most industry bloggers. I don't feel like mocking Java FX because Sun's propaganda department still live in 1999. Although it is telling that Sun new “cool” technology is the work of one dude on his spare time (?). Imagine what Sun would have said if two or maybe three people had worked on this. You would have to invent new words to describe it.

Java FX came out just after Microsoft Silverlight. Some say this is the “evidence” that Sun is lagging behind Adobe and Microsoft. Well, if they are, they are adressing the wrong problems. Silverlight has less support for UI widgets than Java FX. Silverlight is C# logic, 2D vectors and video in a plugin in the same way Flash is. Java FX has no video (Quicktime for Java is very brittle) and has no vector format. Java 2D is high DPI compatible and all that, but I only know of one guy who has done any work moving vectors into Java 2D and I think 24-25 people are aware of this and none of them are content and artwork producers.

The 3D stuff available in WPF could possibly be done in JOGL (I am guessing) and it will even run as an Applet. No-one would actually create such an Applet visualizer (The Applet Loader is slower than Lucent's old Inferno platform and less stable) but it is nice to see that Sun engineers are no longer requiring grant { AllPermission } to every marginally interesting functionality. The XSLT team at Sun forgot to check Applet support before releasing 1.4.1 and because of that Fabric is 120 lines longer than it needs to be.

Anyway, Java FX is mildly interesting to me. My biggest gripe ? Well, the Java FX pad is a bad Swing application. Just like every other Swing application coming out of Sun. Sun made JFC Swing.. and yet no one at that company is able to put together a good looking Swing application. Not one.

Average Joe is not impressed. Average Joe downloads Silverlight and Apollo instead. The final irony ? Silverlight and Apollo has no/limited Linux support. But since Linux people discuss license agreements until the end of time, Mozilla XUL might take over that. Just look at Joost.

Surface, Fabric, Darkstar and Park updated

Get it while it's fresh. 250kb of source code examples are included in Darkstar in the form of Subpixel, Massive and Cases. I would like to stress that the code is very old (2003) and that is has a lot of wierd coding practices in it. I don't think you will get hired by showing it as example work :)

Teppefall Cases

Install Cases

These are the Darkstar example applications that are now available as source code.

Teppefall Cases

Install Cases

Teppefall Massive

Install Cases

Teppefall Subpixel

Install Cases

May 16, 2007

Photoshop mock-up

Intelligent forms should make the JFC experience more inviting. Subtle hints are more user friendly than "ERROR ERROR" after move, click, move, click, move, click, click, etc. The inspiration comes from the Web 2.0 movement, but the concept is very old. Very 1999 I guess.

This is just a Photoshop mock-up by myself, but according to some trusted sources we might see this functionality very soon.

Form hints Photoshop mock-up

May 14, 2007

Huge update - Fabric/Surface/Darkstar

Tons of polish. Windows versions should be awesome.
Mac versions might have some problems :( Shutdown logic might be borked more than before.

Fabric 2.3

Surface 2.4

May 11, 2007

Darkstar Apollo/MXML compiler

I wrote a Apollo/Flex compiler this week that compiles into 100% Java. Just a toy.. it implements like 1,5 percent of Flex and has no Actionscript or SWF support.

Darkstar Apollo/MXML compiler example

You can transcode SWF to Java FX, Actionscript can be mapped to Java.. but that still means no video, no mp4 and no video capture support. There is no point.. People use Flash BECAUSE it supports these things.. not because it is in XML.

Darkstar Apollo/MXML compiler example

Darkstar Apollo/MXML compiler example

Next generation Teppefall software

Coming soon to Teppefall Link.