Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

I've finally finished creating my first two JBuilder OpenTool projects. They are very simple, but time is scarce, so the development process was drawn out. Here are quick links to the two tools:

Keith Wood has written a book about the JBuilder OpenTools, appropriately named "Inside the JBuilder OpenTools API". Here is a link to his site, and here is an even more direct link to the JBuilder OpenTools code samples he has on his site.

Go to Tools | Preferences, and then when the resulting Preferences dialog shows up, choose Browser in the tree on the left hand side of the dialog, then Look & Feel. In the Look & Feel combo box on the right you can choose from the following options:

Here's a link to the Java API doc for how to set a mouse pointer/cursor shape to one of the predefined shapes. It's amazing how bad the memory gets ... here's a link to an article I wrote a long time ago about "How to turn the Java mouse cursor (pointer) into an hourglass".

 

I've been using JBuilder X Foundation a lot lately. I've had to do a lot of prototyping for a current project, and as far as I've seen JBuilder has the best JFC/Swing generating tools around, bar none. So, I ditched an attempt to start working with Eclipse and I went back to the free version of JBuilder, and I haven't been disappointed.

Here is a quick dump of JBuilder-related bookmarks I added to my personal collection last week. These are all related to Open Tools, and more recently how to build JBuilder applications using Ant.

Here's an example of how to add a JPopupMenu to a JTable. The purpose of the popup menu is to let the user right-click on contents in the table and work directly with those contents.

In the code below I've taken a real class and trimmed it down considerably for these demo purposes. I hope the code remaining is useful enough to help you implement your own JPopupMenu on a JTable, or perhaps in other components as well.

Summary: A JTabbedPane tab selection example.

Here's an example of some code where I'm detecting when a user selects a tab in a JTabbedPane. There are pretty much just three important pieces of code, and I've labeled those with comments and the numbers 1, 2, and 3.

Here is a quick example of how to set JTable column widths. I don't know if this is a perfect solution, but it is one possible solution:

Help, I need to install a Perl module, and I need to know what my Perl "include" path (library path) is?

Here's a simple way to print your Perl include path from the command line:

perl -e "print qq(@INC)"

You can just run that command from the Unix/Linux or DOS command line. The output I get from this command on my Windows PC looks like this:

C:/Perl/lib C:/Perl/site/lib .

The output I get on a nearby Linux server looks like this:

Summary: This is a brief discussion about how to debug a JBuilder OpenTool. Debugging an OpenTool is not at all like debugging normal Java code, and a special technique is required, specifically starting one instance of JBuilder from an existing JBuilder environment. These notes apply to JBuilderX, and may not work for other versions.

Here are a couple of quick tips related to the development of JBuilder OpenTool's. I just started working with the JBuilder OpenTool API this weekend, and it seems relatively easy to get a handle on.

I recently started creating a few OpenTools for JBuilder. One of the instructions you see when you first start creating an OpenTool is that you need to modify your JBuilder classpath during OpenTool development so the classpath includes the location of your OpenTool files. But, the instructions I found were for old versions of JBuilder (that were no longer valid), which leads to the question "How can I modify the JBuilder CLASSPATH to recognize the location of my custom class files?"

So, you're creating a JBuilder OpenTool (using the JBuilder OpenTool API) and you want to use a properties file to configure your OpenTool. Knowing the way OpenTools are installed within the JBuilder environment, you come to the conclusion that the best place to store that properties file is in the "/lib/ext" directory under the JBuilder installation directory. That being said, how do you access that directory from within your OpenTool?

Note: You can use the Java program below for this task, especially if you’re not using MySQL, but if you are using MySQL, you can use this query instead:

Using hypertext and hyperlinks in Java Swing applications makes them look more like web applications, and that's often a very good thing. Here's a quick example of how to add a Java HyperlinkListener to a component in Java. In this case the component I'm going to use is a JEditorPane.

Me: "I'd like the #8 (a taco, chili relleno, beans, and mexican salad) with no beans please." (Thinking to myself that this is just too much food, and since I'm trying to cut down my proportions I decide to skip the beans.)

Waiter: "Ok."

Five minutes go by ... the waiter comes back with a taco, a chili relleno, a mexican salad ... and rice. Apparently saying "no beans" means "rice".

How often are you stuck in a dualistic world like this, unable to see another option? How often do you not communicate well?

 

Java current directory FAQ: Can you share an example of how to determine the current directory in Java?

You can determine the current directory your application is started in using Java's System.getProperty() method and the user.dir property, like this:

Wow, this was a tough LaTeX problem, and it would really help if I knew a lot more about LaTeX.

My goal for a LaTeX PDF that I created recently was to get the header of my pages to look something like this:

Section Name (Chapter Name)

where "Section Name" and "Chapter Name" are left-aligned in the header of the page, and would be dynamically replaced by the actual values of the current section and chapter names, respetively.

Summary: Use the LaTeX soul package to highlight text in a LaTeX document.

Suppose you want to provide a highlight color or background color for text in a LaTeX document. A good example is when you want to highlight the background yellow, so it looks like it was highlighted with a marker, to catch a reader's attention. "How do you do this in LaTeX?" you ask.

Normally I like to answer "simple", but in this case there is a multi-step answer. It's still pretty easy, but you'll need to download a package named "soul".