View Single Post
  #1 (permalink)  
Old 11-09-2007, 01:11 AM
ibanez270dx ibanez270dx is offline
Member
 
Join Date: Nov 2007
Location: Bay Area, CA
Posts: 13
ibanez270dx is on a distinguished road
Problem with JPanel
Hi everybody,
I'm really new to Java and I'm making the GUI portion of an applet... Everything works and looks fine, except when I try to put the componants into a JPanel container... I've searched all over the web for help on it, but to no avail. If anyone can tell me where and what my error is, it would be greatly appreciated! My code is as follows:

Code:
import java.awt.*; import java.applet.*; import javax.swing.*; import java.awt.Container; public class gui5 extends Applet { public JLabel tailnum_Label; public JButton tailnum_okButton; public JTextField tailnum_TextField; public void tailnumber() { tailnum_Label = new JLabel("Please enter your Tail Number"); tailnum_okButton = new JButton(" OK "); tailnum_TextField = new JTextField("",180); JPanel tailnum = new JPanel(); tailnum.setLayout(null); tailnum.setBackground(new Color(214,223,239)); tailnum.setBorder( BorderFactory.createLineBorder( Color.BLACK ) ); tailnum_Label.setBounds(10,0,180,20); tailnum_TextField.setBounds(10,20,180,20); tailnum_okButton.setBounds(65,45,70,30); tailnum.add(tailnum_Label); tailnum.add(tailnum_okButton); tailnum.add(tailnum_TextField); } }
Thanks in advance,
- Jeff
Reply With Quote
Sponsored Links