How to create JFreeChart control with JavaBuilders?

288 Views Asked by At

How can I create a JFreeChart control in YAML, using JavaBuilder?

My current form YAML follows:

JFrame(name=frame, title=frame.title, size=packed, defaultCloseOperation=exitOnClose):
    - JLabel(name=sortLabel, text=label.sorttext)
    - JComboBox(name=sortComboBox, editable=false)
    - JScrollPane(name=listScrollpane, vScrollBar=always, hScrollBar=never):
        JList(name=batteryList)
    - JButton(name=exitButton, text=button.exit, onAction=[$confirm,cancel])
    - JPanel(name=graphPanel)
    - MigLayout: |
        [[fill]]
        []                  [grow]           [grow]
        sortLabel           sortComboBox     graphPanel
        listScrollpane+2
        exitButton

I tried both JFreeChart or ChartPanel in place of JPanel(name=graphPanel), but I keep getting this error during debugging: "JFreeChart is not a recognized alias."

I verified jcommon-1.0.16.jar and jfreechart-1.0.13.jar have been added to the project libraries (in NetBeans.)

Does anyone know where I'm going wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

I assume you are using javabuilders. This library seems to be related to swing development. Hence it has defined YAML aliases for all swing classes. The JFreeChart class wont have an alias as it isn't a swing class.

There is a section on extending the javabuilders engine in this PDF. The following line looks helpful

SwingJavaBuilder.getConfig().addType("CustomClassAlias",MyCustomClass.class);

Sorry I can't be more specific, but I haven't really used javabuilders before.