JLabels with MouseListeners
my teacher gave us an assignment to do
he gives us what he calls "starter code" and makes us use his starter code
in our own code. sounds good? the thing is one of the lines he has does not
make sense to me.
in a method that is in a class that extends mouseadapter
mouseClicked
the first line of code he has is
JLabel label = (JLabel) e.getComponent();
um... im assuming that if my code of
String x = label.getText();
would give me the string that is on the JLabel
however, i get an error instead
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException
and since i am not aloud to change his code,
i am forced to learn a way to go about getting the contents of a JLabel when i click it using his starter code.

