title: Sliding Drawer animation on a JToggle selected state in Java?
body: <p>I am trying to make a program in which, On Selecting JToggleButton shows a Sliding Drawer animated Panel and on deselecting it Hides it.</p>
  
  <p>I want something like this on Clicking Toggle Button,</p>
  
  <p>| Toggle button|---->|Panel|<br>
  Slides the Panel like a drawer</p>
  
  <p>and on Deselecting Toggle Button</p>
  
  <p>|Toggle Button|&lt;-----|Hides panel|</p>
  
  <p>I am able to create a new panel on Selecting a JToggle Button but i am confused with creating the animation.</p>
  
  <pre><code>myToggleButton.addItemListener(new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
              if(ev.getStateChange()==ItemEvent.SELECTED){
  
                  myPanel.add(slidingPanel,BorderLayout.CENTER); 
                  myPanel.revalidate();
                  myPanel.repaint();
  
              } else if(ev.getStateChange()==ItemEvent.DESELECTED){
  
                  myPanel.remove(slidingPanel);
                  myPanel.revalidate();
                  myPanel.repaint();
                  }
              }
          }); 
  </code></pre>
  
  <p>How can i achieve sliding Drawer animation for a panel on a ToggleButton click and then hiding the panel .</p>