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 4 of 4

Thread: Java GUI help

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java GUI help

    Hi

    Could anyone tell me what GUI components can i use to display student details in a grid cell? Lets say i wanted to put like

    First name: studentName
    Last name: studentLastName
    DOB: studentDOB

    So these three details to be placed in one grid cell and in another grid cell the same details just for different student and so on for a total of 8 students. The grid view is 2 rows and 4 columns. By the way i am taking the student info from a model already implemented.

    Could you help me with this?

    Appreciate any help. Thanks


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,149
    Thanks
    48
    Thanked 2,158 Times in 2,131 Posts

    Default Re: Java GUI help

    Have you looked at the Tutorial?
    Go to this site and Find GUI
    The Really Big Index

    There are several layout managers that build a grid. Their class names begin with Grid

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java GUI help

    Looks like you need to use a GridLayout. It's the easiest layout to use if you want a grid. To display the text, you can use JLabels or JTextAreas. I recommend JLabels as they are easier and look nicer for what you are trying to do here. Just add them one by one to your JPanel and the layout will align them correctly for you.

  4. #4
    Member
    Join Date
    Aug 2011
    Posts
    48
    My Mood
    Fine
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: Java GUI help

    Hello needJavaHelp,

    I think using JTable is best approach. The table will have 3 columns and 8 rows which correspond to 3 fields and 8 students.

    immutable objects
    Last edited by ha.minh.nam; December 4th, 2011 at 06:25 PM.

Tags for this Thread