the Java API for C++, the unification of Gtk and Qt, Gnome and KDE
Last modified : 1999-06-14
Created : 1999-04-30
Author : Guillaume Desnoix
©1999
This document is the translation of this one. Send me email if you find any mistakes.
14-jun-99: New mailing-list dedicated to Jtk.
11-jun-99: Adding FileInputStream, FlowLayout, Menus.
8-jun-99: Adding support for Gnome, BorderLayout.
1-mai-99: Beginning of the project. Release 0.01.
Jtk is a new project whose the objective is to realize a C++ library with the following fuctionalities:
It is destinated to developpers who want to write a new graphical application in C++ or to translate an existing Java one into C++. At the end, Jtk wants to be the equivalent of classes.zip/rt.jar. The translation is obtained by Alma.
A prototype was realized in two days to verify if, at least, it's possible to do such a thing. The first results are encouraging (see the example).
The tools used for this prototype are : GTK 1.2, QT 2.0, GCC 2.7.2.3, Debian GNU/Linux. The memory management is done by the BDW Garbage Collector. The initial Java code was furnished by GNU Classpath or hand-written.
To conceive and build Jtk is a long work, that I can't (and don't want) to do it alone. It's why I'm offering you to participate. The more important needs are:
So, don't hesitate to email me, we will organize together this project, which just began yesterday !
![]() Référence (Java) | |
![]() Version GTK (C++) |
![]() Version QT (C++) |
![]() Version Gnome (C++) |
![]() Version KDE (C++) |
The C++ code was obtained by translation, using Alma:
#include "jtk_impl.hpp"
#include "essai.hpp"
static java_lang_Class Essai_class("Essai");
java_lang_Class* Essai::getClass()
{
return &Essai_class;
}
void Essai::actionPerformed(java_awt_event_ActionEvent* e)
{
if(e->getSource()==bt1)
tf1->setText(bt1->getText());
if(e->getSource()==bt2)
tf1->setText(bt2->getText());
}
void* Essai::main()
{
Essai* l=new Essai();
return l->run();
}
void* Essai::run()
{
com_sun_java_swing_ImageIcon* ii1=new com_sun_java_swing_ImageIcon("doom.xpm");
java_awt_Font* ft1=new java_awt_Font("SansSerif",0,18);
bt1=new com_sun_java_swing_JButton("Hello",ii1);
bt2=new com_sun_java_swing_JButton("World");
lb1=new com_sun_java_swing_JLabel("Guillaume",ii1);
tf1=new com_sun_java_swing_JTextField(10);
lb1->setBackground(new java_awt_Color(255l,192l,128l));
lb1->setForeground(new java_awt_Color(255l,0l,0l));
bt1->setBackground(new java_awt_Color(255l,255l,128l));
bt1->setForeground(new java_awt_Color(0l,0l,255l));
bt2->setBackground(new java_awt_Color(128l,128l,255l));
bt2->setForeground(new java_awt_Color(255l,255l,0l));
bt2->setFont(ft1);
bt1->addActionListener(this);
bt2->addActionListener(this);
com_sun_java_swing_JFrame* f=new com_sun_java_swing_JFrame();
f->add(bt1);
f->add(bt2);
f->add(lb1);
f->add(tf1);
f->setSize(400,100);
f->show();
return null;
}
The distributions 0.01 to 0.04 are available under GPL2 (GNU General Public License release 2). You can read it there.