Question: How can I create a 2 color border like this around an image?

Like this: 

![](https://i.stack.imgur.com/WknEE.jpg)

This is for an HTML website. What CSS should I use? Thanks in advance :)

Answer: 
Don't use console input with a GUI based applications. User input should be gained by using one or more of the available UI controls.

Painting in Swing can occur for any number of reasons, many of which you don't control, this means that when ever Swing wants to update your UI, it will call paint, meaning you are constantly being asked to provide a new word

Also, you are blocking the paint process, this means until you paint method exits, it's unlikely that anything will be painted

Start by taking a look at [How to create a GUI with Swing](http://docs.oracle.com/javase/tutorial/uiswing/) and, when you understand that, [Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/)
Because you put everything inside the paint function, it will be called again if the applet repaints. So you will notice if you don't resize the applet or do anything else that would cause it to repaint, then it will not have that double output. You can fix this by creating the applet from a main that contains the hangman text logic.

As for how to tell how many steps it took, you should have an extra counter initialized to 0 outside of the nested for loops and inside the inner nested for loop you should increment it. Since you break when the correct word is found, that counter will have the number of attempts.