Image

Horizontal Windowshading...

I'm writing an app that should windowshade horizontally when the user clicks a button (ie. it should collapse back so only the button shows, and then when clicked again, it should expand back to full size). When I click the button though, nothing happens. I threw some debug output in, and it's handling the click and calling the functions it's supposed to; apparently my method for collapsing the windows is flawed somehow.


  public void expand() {
    this.getContentPane().setSize((numapplets * AppletSettings.width)
                                  + AppletSettings.toggleWidth, AppletSettings.height);
    collapsed = false;
  }
  
  public void collapse() {
    this.getContentPane().setSize(AppletSettings.toggleWidth, AppletSettings.height);
    collapsed = true;
  }

  void jButtonShowHideToggle_actionPerformed(ActionEvent e) {
    System.out.println("Clicked..");
    if (collapsed) {
      this.expand();
      System.out.println("Expanding...");
    } else {
      this.collapse();
      System.out.println("Collapsing...");
    }
  }



Is there some superior way of rolling up a window?
This is for a cute little app to provide functionality like KDE's panels.