NetBeans App to Applet Conversion

In an earlier blog, I explored the possibility of moving code from one NetBeans project to another. To cut a long story short, it was pretty much a case of dragging source files and classes from one project and dropping them into another. This experiment was with two projects of the same type (both applications), but I was hoping I could try the same technique dragging code and objects from a desktop application to a web application. And again to make a long story short, I couldn't make it work.

NetBeans is very clever the way it helps you set things out on a form (or jframe, as they call it) with everything nicely lined up and the right size. It is also very clever the way it writes a lot of code, all with the right syntax. Against this, I find that if you want to do anything beyond plain vanilla, the help files are singularly unhelpful, and the tutorials seem simply to replicate the help files. I also find it annoying that I am locked out of code in NetBeans, and to make it worse, if I open a NetBeans source code file with a simple text editor like Notepad, everything is jumbled up together, and frankly, unreadable.

I therefore searched the web for a simple Java Editor. I wanted something that would display a source file nicely, without being as big, cumbersome and restrictive as NetBeans. Number 2 on a Google search was jEdit, which calls itself a programmers test editor. This was exactly what I was looking for. It was free (why pay for something which does less than NetBeans, which is free?), and easy to download and install. And it read my source files beautifully.

Meanwhile, as a belt and braces long shot, I posted a question in the Java Tutorial forum asking about App to Applet migration in NetBeans. I got an excellent reply, which explained that I had to create an Applet in my package, and lift the objects one by one from my App. Putting the applet in the existing package was a particularly clever suggestion, because it enabled me to copy not only regular objects like text boxes, but also the custom object which stores my variables.

The post also provided a link to a NetBeans documentation article, which explained how then to integrate the Applet into a web application. Specifically it enabled me to post it on my (privately hosted) web test page. It might have taken me a hundred years to find that article, and it was very nice to be pointed straight at it.

Comments

Popular posts from this blog

A few notes on JavaScript

Forum Comments on Java Applets

Creating a Custom Swing Component