Main

April 29, 2010

Swing XML layout with no dependencies

This article is a continuation of my article about how to start a Swing application. You must download the Teppefall Layout tool to create the correct XML. If you do not want to use this tool (trial is free), you can also use the XSLT files found in the "transformers" folder instead.

This will only work if you remove the Teppefall API's from the JXML. JXML is simply short for Java XML, which is a standard object serialization format in the JRE. The ViewImporter.test method should be called on the Event Dispatch Thread (EDT). In other words, on the Application.create method in the previous article.

Continue reading "Swing XML layout with no dependencies" »

April 20, 2010

You should almost never extend JFrame in Java Swing

JFrame is one of the heaviest objects in Java Swing (JFC). Just because you extend JApplet this does not automatically mean that your should extend JFrame as well. Because do you see any start, stop or getParameter methods in JFrame ? No, because it is a window frame and not a browser plug-in. Your code should extend JPanel, JComponent and Canvas. Because then you can use the component inside a JFrame, JWindow and JApplet.

So stop creating example code that extends JFrame. This is terrible advice and is mostly a result of developers who want to ignore the event dispatch thread. Because Swing object creation must be done on the EDT but Sun sort of forgot to tell people about it. If you do not believe me then try running Substance 5 in an applet. The JApplet.createRootPane method is on the wrong thread. The fix is to extend the createRootPane method and call super.createRootPane inside a EventQueue.invokeAndWait (click "Extreme mode"). So even Sun developers themselves do not fully understand the EDT. There is a lot of legacy API nonsense clouding the issue.

Personally I use two patterns to start a Swing application. The Application pattern and the Component View pattern. Set the LAF using swing.defaultlaf or a preceding UIManager.setLookAndFeel call wrapped in EventQueue.invokeAndWait. The Component View pattern is for main based test methods in components while the Application pattern is for large monolithic structures.

PS
Right click on the media player and add http://app.teppefall.com/t.flv.

Continue reading "You should almost never extend JFrame in Java Swing" »

January 16, 2010

64bit support is coming

Supporting 64bit is not very important when most of your code is in Java. But Teppefall does have around 300kb of C++ that needs to be ported. And the process is something like this.


  • Install crazy big Windows SDK and Visual Studio on Windows 7.

  • Realize that the Windows documentation is wrong when it comes to "vcvarsall.bat amd64".

  • Dig around for a while.

  • Find the correct BAT based configuration files and drag them into the application menu.

  • Create custom makefiles.

  • Scratch your head as Microsoft uses the suffix "32" in paths and library names everywhere.

  • More mind numbingly boring rewriting of makefiles.

  • Everything compiles, but Winsock related code is broken. Might be configuration. Might be worse.

  • Realize that 64bit JRE writes a registry JVM value that points to a non-existent file. My fault ?

  • But the code supports that, so just use TEPPEFALL_JVM variable.

  • Success!


Itanium support is probably not happening. The compiler can't find "Windows.h" under the IPF configuration and that's kind of a problem unless I want to dynamically load every method. 64bit Windows 7 also seems to crash some plug-in based systems. They keep changing the security model and developers are behind all the time for some reason. Although, the same problem exists on 64bit Linux. Which is stranger since 64bit compiler support is just a GCC parameter away.

December 10, 2009

Sun is missing out on a huge opportunity

Teppefall Media Player (85).png

By being hell bent on "finishing" JavaFX instead of augmenting Swing Sun has more or less destroyed their credibility as a desktop platform company. The reality is that Swing plus a scene graph, accelerated layers and a new media framework is more valuable than the entire JavaFX ecosystem. Adobe, Microsoft, Apple, Opera, Mozilla and Google all believe that XML is the future of layout and yet Sun believes a non-standard syntax based on Lisp and JSON is the way to go. And the fact that C#, Actionscript, Dalvik and Javascript are all Java clones seems to indicate that Java is just fine as a user interface language. Adobe even exports twine animation code as XML and vectors as SVG. I sit here working in Adobe Creative Suite and wonder what Sun is thinking.

Continue reading "Sun is missing out on a huge opportunity" »

September 21, 2009

Comparing Swing with WPF one more time

Here are two similar screenshots. Sun uses a pretty brutal video scaling algorithm and this is a better screenshot than the one below this post.

Sun seems to be in a coma, so I'm only working on the WPF version.

Teppefall Media Player (58).png

Teppefall Media Player (WPF) (7).png

April 24, 2008

Mixing FX and Layout

I am not sure if people are aware of this, but you can run Teppefall FX scripts within Teppefall Layout.

scheme.jfc - Teppefall Layout (14).png

scheme.jfc - Teppefall Layout (15).png

Also, here is Colorspace in Titanium White LAF.

Colorspace.png

March 19, 2008

Writing Teppefall applications in Javascript

It was never my intention to write Teppefall applications in Javascript, but here is a simple example on how to do it. The update system, the DSR (Teppefall Runtime) launcher and some Application logic is not available at this time because of dependency problems. It is hard to use Javascript when the concept of a Class is replaced with something else. And working with all kinds of adapter logic is also pretty confusing.

If you want to run this example, just move the /network_app folder into the Teppefall SDK root folder and run Network.cmd or NetworkOSX.sh. This demo showcases plugins, the taskbar icon, layout and basic setup.

You have to download Teppefall Layout to get the original layout file used in this example.

Teppefall SDK Javascript example: network_app.zip

network.js
network_plugins.js

Teppefall Network Teppefall Network

Continue reading "Writing Teppefall applications in Javascript" »

September 11, 2007

Colorspace 1.5, Layout 3.2, FX 3.2 and Darkstar 20070905

New features:

Colorspace supports the scroll wheel. One NPE fixed. Both fixes by Luan. Decimal values are written to standard output when the decimal check box is selected. 200-500ms shaved off About dialog launch. Colorspace no longer runs under a security policy since it causes to many problems on OS X.

Darkstar applications now have focus aware menus under Titanium LAF. A feature from the stone age. Just use com.teppefall.ds.Application in the same way as before. This means that the foreground color of your menu goes dark (under Titanium) when the JFrame loses focus.

The DSR executable supports the -Xchrome parameter. This turns on the native chrome and is the same as -Dteppefall.chrome=true.

DSR can launch multiple applications at the same time. Just add a comma separator between class names. A word of warning though. Running threads might block the shutdown process, so closing down resources on application exit is paramount. Note that DSR today has a very high probability of not closing down properly.

Other issues:

If Darkstar FX is unable to create HTML and thumbnails you should try the -Xinsecure parameter. FX and Layout run under security managers and can fail if the policy file is not perfect. Strange problems when running under DSR might also be a result of the security policy.

Continue reading "Colorspace 1.5, Layout 3.2, FX 3.2 and Darkstar 20070905" »

July 13, 2007

tabindex="99"

In HTML all I have to do is write tabindex="99" if I want something to be last in a tabbed sequence. In JFC we have setFocusable(false) which works, but it is not what I want. Sure setFocusTraversalPolicy is available but who in their right mind would use it ?

Do I really have to write +100 lines of non-reusable code just to get tabindex="99" ?

tabindex="99" is currently pissing me off :) It's a stupid hack and it has been removed from my HTML. Maybe I'll change my mind tomorrow.

June 05, 2007

Java JFC links

Swing X, Substance, Curious Creature, JNA, Swing Labs, Java Desktop, Java Posse, OnJava J2SE.

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

Continue reading "Huge update - Fabric/Surface/Darkstar" »

April 30, 2007

JFC/Swing musings (repost)

I am not a JFC/Swing expert. But here are some musings about JFC/Swing development. Resposting from my personal page.

Continue reading "JFC/Swing musings (repost)" »

Next generation Teppefall software

Coming soon to Teppefall Link.