I am trying to add swing components such as textfields and buttons to an Internal frame but problem is that the compiler won't allow me to use the c.add(username) method to add a username textfield, I get a nullpointerexception. c is the Container. Does anyone know how to add a simple textfield to a internalframe.
Hi, Not exactly sure what you are doing. But it should look like this: JComponent c = (JComponent) frame.getContentPane(); c.setLayout( new BorderLayout() ); c.add( new JTextField( 10 ), BorderLayout.NORTH ); Regards, Manfred.
"sarwar" your name doesn't agree with the javaranch guidelines. please take a moment and re-regiester after reviewing the guidelines at http://www.javaranch.com/name.jsp thanks for your cooperation. - satya