I am having some difficulty with the display of a a bunch of panels.

I need a specific layout and am adding a HorizontalPanel with two
Labels on it to a VerticalPanel, named x, with a Label on top and the
HorizontalPanel on the bottom and then adding the VerticalPanel, named
x, to another HorizontalPanel, three times with just different text in
the top Label on VerticalPanel x. Now I have set the size so they fill
100% of the space available. For some reason though the Label with the
different text alters the sizes of the VerticalPanel x's.

Is this normal, how do I make them all the same size?

This is a confusing question so I added the source to what I am doing.

Thanks for any help provided.

        private VerticalPanel createClasses(int numOfClasses) {

                VerticalPanel classesVPanel = new VerticalPanel();
                classesVPanel.setWidth("100%");
                for (int i = 0; i < numOfClasses; ++i) {

                        classesVPanel.add(createClassPanel("Class "
                                        + Integer.toString(i + 1), 75, 34, 62));
                }

                return classesVPanel;
        }

        private VerticalPanel createEssayPanel(int percentMarked) {

                HorizontalPanel classHPanel = new HorizontalPanel();
                classHPanel.setWidth("100%");

                if (percentMarked != 0) {

                        Label marked = new Label("a");
                        marked.setStyleName("markedLabel");
                        marked.setWidth("100%");
                        classHPanel.add(marked);
                        classHPanel.setCellWidth(marked, 
Integer.toString(percentMarked)
                                        + "%");
                }

                if (percentMarked != 100) {

                        Label waiting = new Label("a");
                        waiting.setStyleName("unmarkedLabel");
                        waiting.setWidth("100%");
                        classHPanel.add(waiting);
                        int percentWaiting = 100 - percentMarked;
                        classHPanel.setCellWidth(waiting, 
Integer.toString(percentWaiting)
                                        + "%");
                }

                VerticalPanel classVPanel = new VerticalPanel();
                classVPanel.setWidth("100%");

                classVPanel.setBorderWidth(1);

                Label essayLabel = new Label("Essay");
                essayLabel.setStyleName("classLabel");
                classVPanel.add(essayLabel);
                classVPanel.add(classHPanel);

                return classVPanel;
        }

        private VerticalPanel createPeerPanel(int percentFinished) {

                HorizontalPanel classHPanel = new HorizontalPanel();
                classHPanel.setWidth("100%");

                if (percentFinished != 0) {

                        Label marked = new Label("a");
                        marked.setStyleName("markedLabel");
                        marked.setWidth("100%");
                        classHPanel.add(marked);
                        classHPanel.setCellWidth(marked, 
Integer.toString(percentFinished)
                                        + "%");
                }

                if (percentFinished != 100) {

                        Label waiting = new Label("a");
                        waiting.setStyleName("unmarkedLabel");
                        waiting.setWidth("100%");
                        classHPanel.add(waiting);
                        int percentWaiting = 100 - percentFinished;
                        classHPanel.setCellWidth(waiting, 
Integer.toString(percentWaiting)
                                        + "%");
                }

                VerticalPanel classVPanel = new VerticalPanel();
                classVPanel.setWidth("100%");

                classVPanel.setBorderWidth(1);

                Label essayLabel = new Label("Peer ");
                essayLabel.setStyleName("classLabel");
                classVPanel.add(essayLabel);
                classVPanel.add(classHPanel);

                return classVPanel;
        }

        private VerticalPanel createAssignmentPanel(int percentFinished) {

                HorizontalPanel classHPanel = new HorizontalPanel();
                classHPanel.setWidth("100%");

                if (percentFinished != 0) {

                        Label marked = new Label("a");
                        marked.setStyleName("markedLabel");
                        marked.setWidth("100%");
                        classHPanel.add(marked);
                        classHPanel.setCellWidth(marked, 
Integer.toString(percentFinished)
                                        + "%");
                }

                if (percentFinished != 100) {

                        Label waiting = new Label("a");
                        waiting.setStyleName("unmarkedLabel");
                        waiting.setWidth("100%");
                        classHPanel.add(waiting);
                        int percentWaiting = 100 - percentFinished;
                        classHPanel.setCellWidth(waiting, 
Integer.toString(percentWaiting)
                                        + "%");
                }

                VerticalPanel classVPanel = new VerticalPanel();
                classVPanel.setWidth("100%");

                classVPanel.setBorderWidth(1);

                Label essayLabel = new Label("Assn.");
                essayLabel.setStyleName("classLabel");
                classVPanel.add(essayLabel);
                classVPanel.add(classHPanel);

                return classVPanel;
        }

        private VerticalPanel createClassPanel(String className, int
essayMarked,
                        int peerFinished, int assnFinished) {

                HorizontalPanel classHPanel = new HorizontalPanel();
                classHPanel.setWidth("100%");
                classHPanel.setSpacing(2);

                VerticalPanel essayPanel = createEssayPanel(essayMarked);
                essayPanel.setWidth("100%");

                VerticalPanel peerPanel = createPeerPanel(peerFinished);
                peerPanel.setWidth("100%");

                VerticalPanel assignmentPanel = 
createAssignmentPanel(assnFinished);
                assignmentPanel.setWidth("100%");

                classHPanel.add(essayPanel);
                classHPanel.add(peerPanel);
                classHPanel.add(assignmentPanel);

                VerticalPanel classVPanel = new VerticalPanel();
                classVPanel.setWidth("100%");
                Label classNameLabel = new Label(className);
                classNameLabel.setStyleName("classLabel");
                classVPanel.add(classNameLabel);
                classVPanel.add(classHPanel);

                return classVPanel;
        }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to