By default when you add items in Android’s action bar, the icon will not be shown if it will be shown as overflow.

To make sure an icon appears beside the menu item label like this:


Add a sub menu tag within the item tag like this:

Since this menu item in the action bar is forced to become overflow permanently (appear as icon all the time), I extracted the PNG file ic_action_overflow from the Android menu icon pack and set it to this menu item.

This is it. The XML code above should display the way as the image posted above.

If you want your JDialog not to be resizable, coders tend to think that setResizable(false) should do the trick. True. But it is common for developers to mistakenly think that this is enough to do the trick.

If you click on a JDialog‘s icon, you will see that the window options are still available. There is no solution to this. You either have to set the icon to null or live with it if you want the icon to appear.

If you call setFocusableWindowState(false), it will work. However, events are blocked so you cannot click on it, type on it or do anything on the dialog window.

If you want to disable only Minimize and Maximize, first call setVisible(true), then invoke setResizable(false). If the sequence is the opposite, both these options are enabled so in order for it to work, these two methods have to be called in order.

As for the Size menu option, there is still no clear cut way to disable this single menu item. But considering that you just called setResizable(false), then the best option for you is to just call setFocusableWindowState(false).

There really is no clear cut solution unless you do not mind hiding the icon, then that should work.

Related Posts Plugin for WordPress, Blogger...