Results 1 to 2 of 2
Thread: incompatible types error..
- 05-18-2012, 08:09 AM #1
Member
- Join Date
- Jul 2010
- Posts
- 38
- Rep Power
- 0
incompatible types error..
Hi Friends.
XML Code:public int findMenuCheckBox( String s ) { int match = -1; for( int i = 0; i < windowMenu.getItemCount(); ++i ) { mi = windowMenu.getItem( i ); if( mi instanceof JCheckBoxMenuItem ) { if( ((JCheckBoxMenuItem)mi).getText().equals( s ) ) { match = i; break; } } } return( match ); }
I m getting this error
Java Code:incompatible types found : javax.swing.JMenuItem required: javax.swing.JCheckBoxMenuItem mi = windowMenu.getItem( i ); ^ 1 error
- 05-18-2012, 05:47 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,638
- Rep Power
- 12
Re: incompatible types error..
Assuming windowMenu is a JMenu, see the API for getItem - it returns a JMenuItem, not a JCheckBoxMenuItem. And for future reference, if you want help sooner you should be a lot more specific about the context of your post (case in point: I'm guessing that windowMenu is a JMenu - you made NO mention of its data type)
Similar Threads
-
incompatible types
By angelicatomnob in forum New To JavaReplies: 3Last Post: 01-17-2012, 04:25 PM -
incompatible types!!
By sneha343 in forum New To JavaReplies: 7Last Post: 12-01-2011, 12:49 AM -
incompatible types error
By magic in forum New To JavaReplies: 3Last Post: 06-02-2010, 05:58 PM -
> Operator cannot be applied error and return incompatible types error
By corney_16 in forum New To JavaReplies: 1Last Post: 03-10-2010, 02:53 PM -
Error: incompatible types, found: int required: boolean
By silvia in forum New To JavaReplies: 6Last Post: 10-08-2008, 09:09 AM
Bookmarks