Thursday 11 July 2019

java - Is there a way to add an Image to a jPanel?

I am trying to make a chess game. I have an image of a chessboard and images of pieces. All I want to do is have the chess pieces on top of the chessboard. I tried using a container control such as a jPanel but I couldn't find a way to add an image to a jPanel. Next I tried to put a jLabel on top of another jLabel. Obviously, that did not help either as jLabel is not a Container control so the jLabel kept going below the 'chess board' label. Is there any other way to do this?



I am coding in netbeans.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...