2

I'd like to have the effect of one of two panels visible at given time in the same place on the screen. Perhaps I could use the DeckPanel but then in the designer I wouldn't be able to edit the hidden one. Maybe you could recommend a technique?

I've found a solution which works but is not pretty IMHO. Ie. in the code I insert the panel which I want to be visible and remove the panel which I don't want to be visible (from the containing panel).

Firkraag
  • 57
  • 7

3 Answers3

0

Just put both panel within another panel and then set their visibility.

Panel mainPanel = new Panel();
Panel subPanel1 = new Panel();
Panel subPanel2 = new Panel();

mainPanel.add(subPanel1);
mainPanel.add(subPanel2);

subPanel1.setVisible(true);
subPanel2.setVisible(false);

And then when you want to see panel 2 you just do this:

subPanel1.setVisible(false);
subPanel2.setVisible(true);
enrybo
  • 1,787
  • 1
  • 12
  • 20
0

If you want to do this the "right" way, I'd suggest looking into the MVP pattern that GWT team in is suggesting for maintaining large-ish GWT application.

Take a look at possible implementations: mvp4g or gwt-platform. They will take care for you of switching views, as well as maintaining history (the back/forward buttons will work as they should) and many more.

Igor Klimer
  • 15,321
  • 3
  • 47
  • 57
0

You can go for Tablayoutpanel Need not to maintain your own code .

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307