I'm having an issue with a GUI I built. I'm trying to set different cursor changes when rolling over certain objects- i.e., hand cursor when hovering over buttons and text cursor when hovering over textfields. However, the appropriate code doesn't work. I've tried both the following codes:
classArmBtn.setCursor(new Cursor(Cursor.HAND_CURSOR));
And
classAlcBtn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
I know, however, that the reason the cursors won't change is because these objects are in panels that are nested within a JSplitPane. The JSplitPane, however, is disabled because I don't want it to be allowed to resize. Is there any way to maybe override a method and allow these cursors to change? Thanks!
The JSplitPane, however, is disabled because I don't want it to be allowed to resize.
Another way to disable resizing is to disable the divider only and remove the MouseListener from the splitpane divider:
BasicSplitPaneUI ui = (BasicSplitPaneUI)splitPane.getUI();
BasicSplitPaneDivider divider = ui.getDivider();
divider.setEnabled( false );
for (MouseListener ml: divider.getListeners(MouseListener.class))
divider.removeMouseListener( ml );
Now the cursor can be set since the component isn't disabled.