Towards the end of a previous post I’ve exposed my thought of a wxWidgets plugin for NetBeans, more specifically, a plugin for C++ wxWidgets. If you have followed the tutorial through, you’ve probably realized how difficult it is to set up wxWidgets to be used on Windows using NetBeans. Even after the environment is completely configured, you still lack the power of tools like Matisse to prototype your frames. For now, a simple tool will address this problem: it’s called wxMatisse. wxMatisse is a tool that uses windows created by Matisse to create equivalent windows in C++ wxWidgets. The use case is simple: on a window created by Matisse, you select a context menu: “Create wxWidgets window…”. You then decide if you want to use event tables or Connect(), and if you want to use separate header and cpp files, for example. It’s basically a Swing to wxWidgets translator, but it does not translate Swing code; instead, it reads the windows’ properties and child members to create the wxWidgets equivalent. The samples below demonstrate the pre-alpha capabilities of the translator:

Window created by Matisse (Java)

Window created by Matisse

Window created by wxMatisse (C++)


Code created by Matisse

public class MatisseTest extends javax.swing.JFrame {    

/** Creates new form MatisseTest */
public MatisseTest() {

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents() {//GEN-BEGIN:initComponents
    button2 = new javax.swing.JButton();
    button1 = new javax.swing.JButton();
    panel1 = new javax.swing.JPanel();
    button3 = new javax.swing.JButton();
    panel2 = new javax.swing.JPanel();

    button2.setLabel("Right button");
    button2.setBounds(210, 310, 130, 30);
    button1.setLabel("Left button");
    button1.setBounds(50, 310, 130, 30);
    panel1.setBackground(new java.awt.Color(204, 102, 255));
    button3.setLabel("North button");
    button3.setBounds(20, 20, 250, 60);
    panel2.setBackground(new java.awt.Color(255, 255, 0));
    panel2.setBounds(20, 100, 250, 130);
    panel1.setBounds(50, 40, 290, 250);

    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width-410)/2, (screenSize.height-403)/2, 410, 403);

// Variables declaration - do not modify//GEN-BEGIN:variables

    private javax.swing.JButton button1;
    private javax.swing.JButton button2;
    private javax.swing.JButton button3;
    private javax.swing.JPanel panel1;
    private javax.swing.JPanel panel2;

// End of variables declaration//GEN-END:variables

Code created by wxMatisse

// File created by wxMatisse


#include <wx/frame.h>
#include <wx/button.h>
#include <wx/panel.h>

class MatisseTest : public wxFrame { 


	MatisseTest(const wxString &title);


	wxPanel *wxpanel2;

	wxPanel *wxpanel1;

	wxButton *wxbutton1;

	wxButton *wxbutton2;

	wxButton *wxbutton3;

	void initComponents();

	enum {


#endif 	 /* _MATISSETEST_H */

// File created by wxMatisse

#include "matisse.h"

MatisseTest::MatisseTest(const wxString &title) : wxFrame((wxFrame*) NULL, wxID_ANY, title) {

void MatisseTest::initComponents() {
	wxbutton1 = new wxButton(this, WXBUTTON1, _T("Right button"), wxPoint(210, 310), wxSize(130, 30));
	wxbutton2 = new wxButton(this, WXBUTTON2, _T("Left button"), wxPoint(50, 310), wxSize(130, 30));
	wxpanel1 = new wxPanel(this, WXPANEL1, wxPoint(50, 40), wxSize(290, 250));
	wxpanel1->SetBackgroundColour(wxColour(204, 102, 255));
	wxbutton3 = new wxButton(wxpanel1, WXBUTTON3, _T("North button"), wxPoint(20, 20), wxSize(250, 60));
	wxpanel2 = new wxPanel(wxpanel1, WXPANEL2, wxPoint(20, 100), wxSize(250, 130));
	wxpanel2->SetBackgroundColour(wxColour(255, 255, 0));

There are still many things to do until I release version 0.1, of course. For now, only null layout is supported. Support for other layout managers will be added in the future. The goal is to be able to translate all windows created by Matisse as long as they use the supported layout managers. As expected, there will be no support for widgets that wxWidgets offers for an operating system exclusively. Unlike Matisse, you will have total freedom to modify the generated code, as there is no coming back from it. The windows that wxMatisse translates need not be created by Matisse: as this translator uses the properties of the window rather than code, it does not rely on any code convention. As long as the code compiles and runs, the code can be a complete mess that wxMatisse will still work. wxMatisse will be useful for migration projects where code needs to be translated from Java to C++. I will open the wxMatisse project on as soon as the project support all the basic widgets in null layout. If you want to collaborate, or if you know anything about NetBeans programming and want to give a hand, you’re more than welcome to join the project!

This entry was posted by on Sunday, May 25th, 2008 at 9:00 pm and is filed under C++, Java. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Introducing wxMatisse”

  1. […] Dalton Filho has an interesting project that allows saving Swing windows created by Matisse (NetBeans UI designer) as equivalent wxWidgets […]


Leave a Reply