ActionListener for JLabel
问题 I want to learn how to write an ActionListener for JLabel . I want to make a label that open a new frame for user when user clicks the label. Maybe MouseListener can work but I do not know how to make it. 回答1: I recommend using a JTextField rather than a JLabel for this use. Being based on a component designed to be focusable, it allows an ActionListener and looks and feels more like an HTML link. E.G. That is how it appears when the mouse is hovering over the first link. LinkLabel /* License