Using JTabbedPane from Mustang with 1.5 JRE

B

bruces1

Hi all,

I would like to use one particular class from Mustang in my app:
JTabbedPane. The latest version allows custom components to be added to
the tabs themselves.

I found a thread in the JBuilder group
(http://groups.google.com/group/borl...292b6f5e109/63e00e6dd9b59a40#63e00e6dd9b59a40)
That pointed me in the right direction. I imported the JTabbedPane
source into my project and compiled my app, which includes a call to
one of the new methods of the Mustang version,
JTabbedPane.setTabComponentAt().

The resulting class file is output in the same place as the rest of my
classes, and packaged into a .jar file .

However, at runtime, with the jar file in the classpath, Java seems to
use the 1.5 version of JTabbedPane from the JRE:

java.lang.NoSuchMethodError:
javax.swing.JTabbedPane.setTabComponentAt(ILjava/awt/Component;)V

Does this sound correct? If so, how can I "override" the 1.5 version
with the Mustang version when running the app?

I have posted a similar question in the JBuilder group last week, but
over the weekend I figured it's more of a general Java question.

Thank you,


Bruce Sutherland.
 
V

Venkatesh

I'm guessing that an older version of jvm is running ....

Generally, the following variables should be set properly: PATH,
JAVA_HOME and CLASSPATH. (If more than one version of java is installed
in ur machine, then make sure that the PATH variable has the
directories of latest version of java at the beggining)

If u r running ur JVM from command prompt, Just try "java -version" and
see if proper version of JVM is running.

The exception you are getting is because of incompatible class version.

-Venkatesh
 
B

bruces1

Thanks for the reply Venkatesh.

I don't think I explained clearly enough. I do want to use the 1.5 JRE,
with the exception of JTabbedPane (and the several inner classes
belonging to it) from Mustang.

Bruce.
 
T

Thomas Weidenfeller

I don't think I explained clearly enough. I do want to use the 1.5 JRE,
with the exception of JTabbedPane (and the several inner classes
belonging to it) from Mustang.

I am not a lawyer but I would be surprised if the Mustang or the 1.5
license allows this at all. Before starting with the technical bits you
might want to study both licenses intensively.

/Thomas
 
B

bruces1

This is a good point Thomas.

Can anybody suggest an LGPLed or BSD licensed class that will give me
tabbed panes with close buttons? Preferably an implementation that
allows you to add components the tabs, similar to the Mustang
JTabbedPane.

Closeable tabs exist in JBuilder and Azureus to name two apps that I
know of. I'm pretty sure JBuilder doesn't use Mustang.

I found some hacks that extend JTabbedPane, none of which I
particularly like. For example, one modifies the paint function to
paint the close button, but then you can't add a MouseListener to do
things like change the colour when the mouse hovers over it. Another
problem with this method is that when you click the "close button", the
tabbed pane displays the tab content before closing it.

Thanks.

Bruce.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top