Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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.add(list)
frame.add(button)
frame.setSize(400, 400)
frame.setLayout(null)
frame.setVisible(true)

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

0 votes


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,024

Question asked: Nov 23 '22, 5:07 a.m.

Question was seen: 370 times

Last updated: Nov 23 '22, 5:07 a.m.

Confirmation Cancel Confirm