我有一个光标设置为等待的 JDesktopPane。稍后我将在桌面窗格中添加一个 JInternalFrame 并将其设置为可见。但是光标似乎没有变为等待。为什么父母的光标不应用于孩子?
import java.awt.Cursor;
import java.beans.PropertyVetoException;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
public class Test {
public static void main(String[] args) throws PropertyVetoException {
JFrame frame = new JFrame();
frame.setSize(400, 400);
JDesktopPane pane = new JDesktopPane();
pane.setCursor(new Cursor(Cursor.WAIT_CURSOR));
frame.getContentPane().add(pane);
frame.setVisible(true);
JInternalFrame iFrame = new JInternalFrame("MyFrame");
iFrame.setMaximizable(true);
iFrame.setResizable(true);
iFrame.setSize(200, 200);
pane.add(iFrame);
iFrame.setVisible(true);
iFrame.moveToFront();
iFrame.setSelected(true);
}
}