package project;
import javax.swing.*;
class login {
JFrame loginf;
JLabel loginimg;
public void start() {
loginf = new JFrame();
loginf.setSize(1280,720);
loginf.setLayout(null);
loginf.setUndecorated(true);
loginf.setLocation(120,60);
loginimg = new JLabel(new ImageIcon("E:\\well\\Login with image1.jpg"));
loginimg.setBounds(0,0,1280,720);
loginf.add(loginimg);
loginf.setVisible(true);
}
}
public class LoginPage {
public static void main(String[] args) {
login lp = new login();
lp.start();
}
}
Asked
Active
Viewed 33 times
0

maloomeister
- 2,461
- 1
- 12
- 21
-
If your image has to expand to fill the space it will pixelate. Make sure your image is bigger than the space to be filled. – Gilbert Le Blanc Aug 18 '21 at 10:34
-
Why would you want to put up an image that *looks like* a login form btw? – g00se Aug 18 '21 at 10:57
-
Your platform is scaling the application so the image is getting pixelated. Check out: https://stackoverflow.com/questions/65742162/how-to-fix-the-blurry-image-when-i-run-my-java-swing-project/65742492#65742492 for a couple of options. Also, don't use a null layout and setBounds(). Swing was designed to be used with layout managers. – camickr Aug 18 '21 at 13:36