I need to remove this code
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package GUI;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.event.DefaultMouseListener;
import com.simsilica.lemur.event.FocusMouseListener;
import com.simsilica.lemur.event.MouseEventControl;
import com.simsilica.lemur.style.ElementId;
/**
*
* @author
*/
public class myButton extends Button {
public myButton( String s ) {
super(s, true, new ElementId(ELEMENT_ID), null);
addControl(new MouseEventControl(FocusMouseListener.INSTANCE, new ButtonMouseHandler()));
}
public myButton( String s, String style ) {
super(s, true, new ElementId(ELEMENT_ID), style);
addControl(new MouseEventControl(FocusMouseListener.INSTANCE, new ButtonMouseHandler()));
}
public myButton( String s, ElementId elementId ) {
super(s, true, elementId, null);
addControl(new MouseEventControl(FocusMouseListener.INSTANCE, new ButtonMouseHandler()));
}
public myButton( String s, ElementId elementId, String style ) {
super(s, true, elementId, style);
addControl(new MouseEventControl(FocusMouseListener.INSTANCE, new ButtonMouseHandler()));
}
protected class ButtonMouseHandler extends DefaultMouseListener {
@Override
public void mouseButtonEvent(MouseButtonEvent event, Spatial target, Spatial capture) {
// Do our own better handling of 'click' now
// super.mouseButtonEvent(event, target, capture);
if (!isEnabled())
return;
if (event.isPressed()) {
setPressed(event.isPressed());
System.err.println(event.isPressed());
} else if (isPressed()) {
// Only run the up processing if we were already pressed
// This also handles the case where we weren't enabled before
// but are now, etc.
if (target == capture) {
// Then we are still over the button and we should run the
// click
runClick();
}
// If we run the up without checking properly then we
// potentially get up events with no down event. This messes
// up listeners that are (correctly) expecting an up for every
// down and no ups without downs.
// So, any time the capture is us then we will run, else not
if (capture == myButton.this) {
setPressed(false);
}
}
}
}
}
I tried to do that but it didn’t work.
Should I just copy the entire button code and then just delete this code?
What are the ways to modify this portion of code without using invasive programming?