Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Swin/Awt Code Question

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Swin/Awt Code Question

    Hi,can someplease explain "this" line and how it affects the rest of the code



    	public question()
     	{
                          */code/*	
     
                          contentPanel = new JPanel(new GridLayout(0,4));
    	this.add(contentPanel);//can someplease explain this line and how it affects the rest of the code
    Last edited by Pulse_Irl; October 30th, 2010 at 11:03 AM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,262
    Thanks
    176
    Thanked 821 Times in 764 Posts
    Blog Entries
    5

    Default Re: Swin/Awt Code Question

    The way this question is phrased, 'this' could be anything, thus add is not defined so the question lacks context to answer definitively. Presuming 'this' is an instance of a class that extends Container, see
    Container (Java Platform SE 6)
    and
    Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

Similar Threads

  1. [SOLVED] "possible loss of precision", except not, code doesn't work, simple question
    By Perd1t1on in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 24th, 2010, 07:11 PM