G
I have a popup menu which shows itself when I right click over a
JTextArea called taLocations. I can use the menu with the following
ActionListener. Within the same frame I have another JTextArea called
taSkills which will utilise the same popup menu.
As you will see in the code I want to identify the name of the
JTextArea that the popup menu was "hovering" over. How?
ActionListener menuListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
System.out.println("ActionListener");
System.out.println(event.getActionCommand());
System.out.println(event.getSource().getClass().getName());
System.out.println(event.getClass().getName());
if (event.getActionCommand().equalsIgnoreCase("Save"))
{
}
if
(event.getActionCommand().equalsIgnoreCase("Restore")) {
System.out.println(event.getSource());
restoreFilter("locations");
}
}
};
JTextArea called taLocations. I can use the menu with the following
ActionListener. Within the same frame I have another JTextArea called
taSkills which will utilise the same popup menu.
As you will see in the code I want to identify the name of the
JTextArea that the popup menu was "hovering" over. How?
ActionListener menuListener = new ActionListener() {
public void actionPerformed(ActionEvent event) {
System.out.println("ActionListener");
System.out.println(event.getActionCommand());
System.out.println(event.getSource().getClass().getName());
System.out.println(event.getClass().getName());
if (event.getActionCommand().equalsIgnoreCase("Save"))
{
}
if
(event.getActionCommand().equalsIgnoreCase("Restore")) {
System.out.println(event.getSource());
restoreFilter("locations");
}
}
};