Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting the Parent JFrame or JDialog

843806Jan 13 2009 — edited Jan 13 2009
I am trying to get the parent JFrame or JDialog so I can change the cursor. Right now I am doing it in a stupid way by doing this:
private void changeCursorQuestion(){
		JFrame frame=(JFrame) getParent().getParent().getParent().getParent().getParent().getParent().getParent();
		Cursor cursor=new Cursor(Cursor.HAND_CURSOR);
		frame.setCursor(cursor);
		
		
	}//end changeCursorQuestion
But is there an easier and of course better way of getting the frame or jdialog that a panel is in?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 10 2009
Added on Jan 13 2009
3 comments
478 views