How to disable component of TopToolBar?

Hi everybody,

I would like to delete the “Add contact” button of the TopToolBar…

I tried to get it with this code but it does not work :

JToolBar toptoolbar = SparkManager.getMainWindow().getTopToolBar();   for( int l = 0; l < toptoolbar.getComponentCount(); l++) {
  System.out.println(l + " Components : " + toptoolbar.getComponent(l));
  }

Could you help me please ?

Hi,

Nobody has idea ?

Can you confirm me that container of shortcuts ( “Add a contact”, “Make a conference” ) is Toptoolbar ?

Thanks !

It was not TopToolBar…

for( int l = 0; l < SparkManager.getMainWindow().getContentPane().getComponentCount(); l++) {   Component c = SparkManager.getMainWindow().getContentPane().getComponent(l);
  if ( c instanceof JPanel) {
  JPanel panel = (JPanel) c;    for( int k = 0; k < panel.getComponentCount(); k++) {
  Component c1 = panel.getComponent(k);
    if ( c1 instanceof org.jivesoftware.spark.Workspace)  {
    org.jivesoftware.spark.Workspace w = (org.jivesoftware.spark.Workspace) c1;
    for( int m = 0; m < w.getComponentCount(); m++) {
    Component c2 = w.getComponent(m);       if ( c2 instanceof org.jivesoftware.spark.ui.CommandPanel ) {
      org.jivesoftware.spark.ui.CommandPanel cmdpanel = (org.jivesoftware.spark.ui.CommandPanel) c2;
      for( int n = 0; n < 1; n++) {
      Component c3 = cmdpanel.getComponent(n);
         if ( c3 instanceof org.jivesoftware.spark.component.RolloverButton) {
         org.jivesoftware.spark.component.RolloverButton btn = (org.jivesoftware.spark.component.RolloverButton) c3;          btn.setEnabled(false);
         }
      }
      }
    }
    } }
  }
  }