I created a GUI with one JButton in it but it just shows a blurry button.
Here you see what I mean.
This is the code of my main class:
Gui gui = new Gui();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setSize(300, 300);
gui.setVisible(true);
Code of gui class:
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import java.awt.FlowLayout;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Gui extends JFrame {
public Gui() {
super("testing buttons");
getContentPane().setLayout(new FlowLayout());
JButton btnClickMe = new JButton("Click me");
getContentPane().add(btnClickMe);
}
}
Does anyone know how to fix this?