Hi,

I would like to set the background color for the Viewport of an ULCScrollPane. It seems to me, that this is not possible without a client extension. Please find an example below. As I do not have a getter/setter for the viewport (just the viewportview, which is my table), I have no chance of setting it directly on the server side. I have a workaround (below below) in my own client extension but I guess this should be fixed elsewhere. Could you please have a look at it and tell me if this is an ULC issue or whether I missed something.

Kind regards
Jens

EXAMPLE CODE

public class ScrollPaneTestPlainULC extends AbstractApplication
{
   public void start()
   {
       ULCRootPane rootPane;
       ULCTable table;
       ULCScrollPane sc;
rootPane=createRootPane(); table = new ULCTable(getModel(), new String[]{"Name", "Initial", "Sirname"}); table.setAutoResizeMode(ULCTable.AUTO_RESIZE_OFF); //table now is smaller than the viewport
       table.setBackground(Color.white);
       sc = new ULCScrollPane(table);
       sc.setBackground(Color.white);

       rootPane.getContentPane().add(sc);
       rootPane.getRootPane().setVisible(true);
   }

   private ULCRootPane createRootPane()
   {
       ULCFrame frame = new ULCFrame();
       frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
       return frame;
   }

   private Object[][] getModel()
   {
       return new String[][]{
           {"Bruno", "T.", "Bear"},
           {"Bruno", "T.", "Bear"},
           {"Bruno", "T.", "Bear"},
           {"Bruno", "T.", "Bear"},
           {"Bruno", "T.", "Bear"},
       };
   }


   public static void main(String[] args)
   {
       DevelopmentRunner.setApplicationClass(ScrollPaneTestPlainULC.class);
       DevelopmentRunner.run();
   }


}


WORKAROUND


public class UIAScrollPane extends UIScrollPane
{

   public void setBackgroundColor(Color color)
   {
       super.setBackgroundColor(color);
       getBasicScrollPane().getViewport().setBackground(color);
   }


   protected void postInitializeState()
   {
       super.postInitializeState();
getBasicScrollPane().getViewport().setBackground(getBasicScrollPane().getBackground());
   }
}



_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to