예제 #1
0
  /**
   * Adds a tab.
   *
   * @param card the tab content.
   * @param name the tab name.
   */
  public void addTab(final WComponent card, final String name) {
    WContainer titledCard = new WContainer();
    WText title = new WText("<b>[" + name + "]:</b><br/>");
    title.setEncodeText(false);
    titledCard.add(title);
    titledCard.add(card);

    deck.add(titledCard);

    final TabButton button = new TabButton(name, titledCard);

    button.setAction(
        new Action() {
          public void execute(final ActionEvent event) {
            deck.makeVisible(button.getAssociatedCard());
          }
        });

    btnPanel.add(button);
  }
 /**
  * Simply render the string that was passed to the constructor.
  *
  * @param renderContext
  */
 @Override
 protected void paintComponent(final RenderContext renderContext) {
   ((WebXmlRenderContext) renderContext).getWriter().print(content);
   super.paintComponent(renderContext);
 }