Tuesday, July 14, 2009

How do I add a background Image for this GUI? Pls include the background image code in the code i hv provided?

import java.awt.*;


import java.awt.event.*;


import javax.swing.*;


public class MainScreen extends JFrame implements ActionListener {


JPanel image = new JPanel(new FlowLayout() ) ;


JPanel south = new JPanel(new FlowLayout( ) ) ;


JPanel west = new JPanel (new FlowLayout() ) ;


JPanel north = new JPanel (new FlowLayout() ) ;


JButton button1;


Font font = new Font("SansSerif", Font.BOLD, 32);


JLabel playerScore ;


JLabel dealerScore ;


JLabel cardImage;


public MainScreen()


{


Container c = getContentPane();


c.setLayout (new BorderLayout() );


button1 = new JButton("R");


west.add(button1);


north.add (button1);


c.add ( north , BorderLayout.NORTH );


c.add ( south , BorderLayout.SOUTH);


setTitle("test");


setSize(500,500);


setDefaultCloseOperation(JFrame.EXIT...


setVisible(true);


}


public void actionPerformed(java.awt.event.ActionEve... e) {


}


public static void main(String args[]) {


MainScreen screen = new MainScreen();


}

How do I add a background Image for this GUI? Pls include the background image code in the code i hv provided?
http://www.java-tips.org/java-se-tips/ja...


No comments:

Post a Comment