
How can you get a HashMap to Display Text onto a Text Field that is defined and Set up to JPanel on a different Class
static class public static Map <String, ActionListener> listener = new HashMap <String, ActionListener>(); static { listener.put("CONNECT", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)
{
ConnectButtonActionPerformed( e );
}
});
public static void ConnectButtonActionPerformed( ActionEvent evt ) {
try
{
results = Queries.getAllPeople();
numberOfEntries = results.size();
if ( numberOfEntries != 0 )
{
currentEntryIndex = 0;
currentEntry = results.get( currentEntryIndex );
textField_ID.setText("" + currentEntry.getsID() );
}
Main Class textField_ID = new JTextField(); panelUser.add(textField_ID) textField_ID.setColumns(10);
ConnectButton.addActionListener(StaticMap.listener.get("CONNECT"));
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.