It's all about the answers!

Ask a question

How do I add an ActionListener to a button in RPE Javascript?

Anne Smorthit (11) | asked Nov 23, 5:07 a.m.

I display a list of items at run-time and want the user to be able to select multiple items.

The following code gives the error: invalid property id (src1#31)

var button = new java.awt.Button("Select")
button.setBounds(200, 150, 80, 30)

var list = new javax.swing.JList(Doc_List.toArray())
list.setBounds(0, 0, 175, 400)
var frame = new javax.swing.JFrame()

button.addActionListener(new java.awt.event.ActionListener() {
public actionPerformed(ActionEvent e) {                                      <- Line 31
_st_DisplayAttribute = list.getSelectedItems()
frame.setSize(400, 400)

When the user clicks on the button, I want the selected items saved in the variable _st_DisplayAttributes and the window to close.

Be the first one to answer this question!

Register or to post your answer.