alienA2 19 Posted April 5, 2012 Report Share Posted April 5, 2012 Please see the code, background image, and the buttons which are currently outside the background image. I would like to find out how to add the buttons inside the the background. tools used: notepadd++ and command prompt. Thanks creation1.zip Quote Link to post Share on other sites
smiles 7 Posted April 16, 2012 Report Share Posted April 16, 2012 Maybe u fixed it already import javax.swing.JFrame;import javax.swing.ImageIcon;import javax.swing.JLabel;import java.awt.Container;import javax.swing.JTextField;import javax.swing.JButton;import java.awt.FlowLayout; class ShowPicture{public static void main(String args[]) {JFrame frame;Container contentPane;JTextField textfield;JButton button;FlowLayout layout;String sorry; frame = new JFrame();frame.setTitle("Coffee Table"); ImageIcon icon = new ImageIcon("background.png");JLabel label = new JLabel(icon); /****************************/frame.setContentPane(label);contentPane = frame.getContentPane();/****************************/ textfield = new JTextField("Type your text here.");sorry = "This button is temporarily out of order.";button = new JButton(sorry); contentPane.add(textfield);contentPane.add(button);layout = new FlowLayout();contentPane.setLayout(layout); /****************************///contentPane.add(label);/****************************/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setVisible(true);}} Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.