import javax.swing.*;
import java.awt.*;
class Intro implements Runnable
{
public static void main(String[] args)
{
Intro program = new Intro();
SwingUtilities.invokeLater(program);
}
public void run()
{
JFrame inicio = new JFrame("Videogame");
inicio.setDefaultCloseOperation(inicio.EXIT_ON_CLOSE);
inicio.setSize(800,600);
inicio.setLocationByPlatform(true);
inicio.setVisible(true);
JPanel bt = new JPanel();
bt.add(new JButton("START"));
bt.add(new JButton("QUIT"));
JPanel over = new JPanel();
LayoutManager overlay = new OverlayLayout(over);
over.setLayout(overlay);
JPanel imagen = new JPanel();
ImageIcon image = new ImageIcon("image.jpg");
imagen.add(new JLabel(image));
over.add(imagen);
over.add(bt);
inicio.add(over);
}
}
I hope my code is clearer now!!
It works fine except the second (QUIT) button takes a while to load and I don't understand why... any ideas? Sorry for the bother!