JTextPane in JToggleButton, ignore mouse events?
Hi guys
I am in a strange situation: there is a JToggleButton with a JTextPane as a child component. If I click on the JTextPane, the relative button's events don't go in action (because he understands that i want to click on the JTextPane, which i'd like to set "unclickable"). How could i开发者_Python百科 solve this? :)You can just do something like this
aJToggleButton tButton=new aJToggleButton();//contains JTextPane
tButton.getTextPane().addActionListener(this);
public void actionPerformed(ActionEvent e)
{
((aJToggleButton )((JTextPane)e.getSource()).getParent()).setSelected(true);
}
Anyway, it would be more helpful to see the component docs... Still I guess, the snippet touches the conception
Good luck
精彩评论