Binding elements to SwiXML in JRuby

I am trying to recreate SwiXML examples in JRuby. But the objects
created in JRuby never seem to be visible to SwiXML. Here is an example.

The Java code from the SwiXML example is as follows:

public class ActionTest {
// Create an Action as a member variable
public Action quit = new AbstractAction() {
public void actionPerformed(ActionEvent evt) {
public ActionTest() throws Exception {
// set the Action’s name
quit.putValue(Action.NAME, “Quit”);
// build the GUI
new SwingEngine(this).render(“ActionTest.xml”)
public static void main(String[] args) throws Exception {
new ActionTest();

I have created some JRuby code to correspond to this, but it seems as if
the @quit member is never seen. Also tried referencing other named
elements (not in this example):

require ‘java’
require ‘java/swixml.jar’
require ‘java/jdom.jar’

include_class ‘javax.swing.AbstractAction’
include_class ‘javax.swing.Action’
include_class ‘javax.swing.JButton’

class MyAction < AbstractAction
def actionPerformed(ae)
exit # puts “Clicked”

class Main < Object # Java::JavaLang::Object
def initialize
@quit =
@quit.putValue(Action.NAME, “Quit”)
@f =“sample.xml”)
@se =

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs