Swing JComboBox problem.

I’m currently making a certain program. I have a JComboBox setup. Here is the code.


dropdown=new JComboBox<SpriteSheet>();

So I create a that box with spritesheet as its generic type or component or how the **** that’s called.

This is how I put objects to it.

dropdown.addItem(sheet);

The problem that causes me is this.

I think you understand what I want to do.

I would like to set like some kind of listener or something that would display the name of the object as I wish, not the actual object id or how is that called.

So it would look something like this:


dropdown.setTitleListener(new TitleListener() {
	public String getTitle(SpriteSheet sheet) {
		return "title";
	}
});

This is just pseudo-code and it doesn’t exist. I think you know what I want to achieve. I don’t even know how to name it…