Does anyone know an easy way to extend custom AbstractAction extending class with toggle state - the custom implementation is added in a JToolbar and I need it to be shown toggled/untoggled.
Thanks in advance.
vladislav peichev wrote:Not like JCheckBox but like JToggleButton. My application uses customized AbstractAction with some additional functionality e.g. enabling or disabling depending on condition so I cannot use the standard JToggleButton. I want my AbstractAction extension to be displayed toggled/untoggled.
Of course you can use JToggleButton. In your child of AbstractAction, you'll just check the action's Selected state. That is, don't mess with the selection state yourself, let the JToggleButton manage it. Just test the state in actionPerformed and enable/disable the other controls accordingly.