This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding Components to Internal Frames ????

 
suhail sarwar
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic