Hi, I'm trying to make an Options screen for the game that I'm writing. I know how I want it to look, but I don't know how to add Tabs, or move the buttons that control the options around...

Below is a link to a picture of what i want it to look like.


If anyone know how to do this, or knows it Sun has a tutorial on it, it would be great if you let me know =]

Yes, use a JTabbedPane. Tutorial here. And you create buttons using the JButton class. If you have to move the buttons around, you might want to look into different Layout Managers, some are better than others as far as giving you control over where things are placed.

Okay, I got the Tabs working, and I got some test options in, and they work fine =)

Also, I'm going to add a few JTextFields to retrieve key data from the user (ie, which key carries out which command). So, would I just add a KeyListener to each of the JTextField and retrieve the key that way? or would it be better to make a JOptionPane that has a message, which is brought by pressing a button and add a KeyListener to the JOptionPane? I think that the JOptionPane is a better idea, but involves a lot more clicking, and I wouldn't have to worry about multiple keys being pressed and the user getting confused....

I don't know very much about KeyListeners, sorry. But I'd do whatever is the most clear to the user (as far as what you're asking them to do) first, and whatever involves the least clicking is secondary.

This article has been dead for over six months. Start a new discussion instead.