Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package testbackground;
- import java.awt.EventQueue;
- import java.awt.FlowLayout;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- public class TestBackground extends JFrame {
- public TestBackground() {
- setTitle("TestBackground");
- setSize(800, 600);
- setResizable(false);
- JLabel contentPane = new JLabel(new ImageIcon("background.jpg"));
- setContentPane( contentPane );
- JPanel panel = new JPanel();
- panel.add(new JButton("Prueba"));
- panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
- add(panel);
- setLayout(new FlowLayout());
- setLocationRelativeTo(null);
- setDefaultCloseOperation(EXIT_ON_CLOSE);
- }
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- TestBackground app = new TestBackground();
- app.setVisible(true);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement