hi everyone, got a coupla questions, if you can answer them
I was just wondering if there is an option, when using a JList, to make the listbox a little bit wider, so that the items in the listbox can have a little bit of "breathing space". At the moment, all I seem to be able to get to work, is putting spaces around the actual items, before I put them into the list box. Surely theres a better way of doing it!!
And the second question.... when a user clicks the X to close a frame, I'm giving them the option to cancel the action if they made a mistake. I'm using a dialog box to do this. I've been fiddling with Dialog.YES_OPTION and Dialog.NO_OPTION to determine what the user wants before closing the frame but it doesn't seem to be working. It keeps giving me an error about boolean and int types. code is
I looked into your first question a little bit. Thought that by using a custom ListCellRenderer you could somehow specify the margin between the text and the border of a JLabel, but looking at the API I am not sure this is even possible.
As far as your 2nd problem, the code below does what you expect.