Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2005

Tip: Looking for answers? Try searching our database.

JLabel only display on last line

Thread view: 
dragonriver@gmail.com - 16 Feb 2005 05:39 GMT
Hi,
 I'm new to Java gui and don't know how to fix this problem.  The
problem is that jLabel18 only display on the last line.  Based on the
code, it should be on every line.  Thank you for your time.

Regards,
Henry

for ( int i=0; i<systemValues.size(); i++ )
{
String sval = (String)systemValues.get(i);
if (sval.length() > 0)
{
 try
 {
   for ( int ii=0; ii<reqValues.size(); ii++ )
   {
     if ( typedata == DataTypeConstants.dtSingleList)
     {
       Vector vvalues = getValuesVector(rval);
       JComboBox xx = new JComboBox(vvalues);

       panel2.add(new JLabel(l), new GridBagConstraints(0,
start,1,1,0.0,0.0,GridBagConstraints.WEST,GridBagConstraints.NONE, new
Insets(5, 5, 0, 0), 26, 1));

    panel2.add(xx, new GridBagConstraints(1, start, 1, 1,
0.0,0.0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,
5, 0, 0), 26, 1));

    panel2.add(jLabel18, new GridBagConstraints(2, start, 1,
1,0.0,0.0,GridBagConstraints.WEST, GridBagConstraints.NONE, new
Insets(5, 5, 0, 0), 26, 1));
    start++;
     }
     else
     {
       JTextField xx = new JTextField();
    textToSave.add(xx);
    textToSaveID.add(String.valueOf(rval));
    String l = getAttributeName(rval);

    panel2.add(new JLabel(l), new GridBagConstraints(0, start,1,
1,0.0,0.0,GridBagConstraints.WEST, GridBagConstraints.NONE, new
Insets(5, 5, 0, 0), 26, 1));

    panel2.add(xx, new GridBagConstraints(1, start, 1, 1,
0.0,0.0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,
5, 0, 0), 26, 1));

    panel2.add(jLabel18, new GridBagConstraints(2, start, 1, 1, 0.0,
0.0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5,
0, 0), 26, 1));
     }
    start++;
}
                                }
                                }
                            }
John McGrath - 16 Feb 2005 06:47 GMT
> The problem is that jLabel18 only display on the last line.  Based
> on the code, it should be on every line.

A component cannot be added to the GUI multiple times.  You will need to
create a new instance for each placement.

Signature

Regards,

John McGrath

dragonriver@gmail.com - 22 Feb 2005 23:31 GMT
I applied your suggestion and it works.  Thank you for your help.

Regards,
Henry


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.