Skip to content
Advertisement

Tag: jlabel

Java – How do I get an image to display?

I have spent a really long time trying to find a way to display an image in a Java program (I’m trying to learn how to make a 2D Java game) an nothing that I’ve tried works. I’m using Eclipse Mars and the latest of everything else. Here is my code: Please, just tell me how to correct the code

How can I remove border on JLabel?

So I am trying to start a graphics program, where I have a JFrame that holds multiple JPanels. The JPanels need to combine to create 1 image, however when I run my program I see borders around the images. I cannot quite distinguish if the border is caused by the JLabel that holds the image or if it is because

Resize a picture to fit a JLabel

I’m trying to make a picture fit a JLabel. I wish to reduce the picture dimensions to something more appropriate for my Swing JPanel. I tried with setPreferredSize but it doesn’t work. I’m wondering if there is a simple way to do it? Should I scale the image for this purpose? Answer Outline Here are the steps to follow. Read

Advertisement