Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
babakar
Posts: 766
Registered: ‎05-29-2012
My Device: see later

tablelayoutmanager highligh on row click

TableLayoutManager colFMgr = new TableLayoutManager(new int[]
   				{
   				TableLayoutManager.USE_PREFERRED_SIZE
   				}, Manager.VERTICAL_SCROLL)
   		 		{
   			 	protected boolean navigationClick(int status, int time) {
   			 		// TODO Auto-generated method stub
   			 		return true;
   			 	}
   			 	protected void drawFocus(Graphics graphics, boolean on) {
   			 			// TODO Auto-generated method stub
   			 			super.drawFocus(graphics, on);
   			 		}
   			 	protected void paint(Graphics graphics) {
   			 			// TODO Auto-generated method stub
   			 			super.paint(graphics);
   			 		}
   		 		};

   		for(int i= 0;i < GlobalValue.getTop20.size();i++) {
   			
   			Song temp = (Song)GlobalValue.getTop20.elementAt(i);
   			Bitmap images = null;
   			
   		    images=MAMClient.sizeImage(EncodedImage.createEncodedImage(temp.getAlbumCover(), 0, temp.getAlbumCover().length),110,110).getBitmap();
   			HorizontalFieldManager m = new HorizontalFieldManager(USE_ALL_WIDTH|HorizontalFieldManager.FOCUSABLE | Field.FOCUSABLE)
   			{
   				
   			};
   		    m.add(new BitmapField(images
   					,Field.FOCUSABLE));
   		    Font font = getFont().derive(Font.BOLD, 32); 
   		    VerticalFieldManager m20 = new VerticalFieldManager();  
   		    LabelField x20 = new LabelField(temp.getAlbumName());
   		    x20.setFont(font);
   		    m20.add(x20); 
   		    m20.add(new LabelField(temp.getSingerName()));
   	    	Font font2 = getFont().derive(Font.ITALIC, 32); 
   	    	
   	    	LabelField x21 = new LabelField(""+temp.getPrice())
   	    	{
   	    		public void paint(Graphics g){      
                    g.setColor(Color.GRAY);
                    g.clear();
                    super.paint(g);
               }    
   	    	};
   	    	x21.setFont(font2);
   	    	
   		    m20.add(x21);
   		    m.add(m20);
   		    colFMgr.add(m);
	   		Bitmap bitmap = new Bitmap(1, 10);
	   		BitmapField bitmapField = new  BitmapField(bitmap);
	   		colFMgr.add(bitmapField); // add vertical line to the manager/screen
	   		BitmapField bitmapField2 = new  BitmapField(bitmap);
	   		colFMgr.add(bitmapField2);
	   		BitmapField bitmapField3 = new  BitmapField(bitmap);
	   		colFMgr.add(bitmapField3);
	   		BitmapField bitmapField4 = new  BitmapField(bitmap);
	   		colFMgr.add(bitmapField4);
	   		BitmapField bitmapField5 = new  BitmapField(bitmap);
	   		colFMgr.add(bitmapField5);

 

 

 

How can I on click of the row, highlight the entire row

Trusted Contributor
avi_yach
Posts: 184
Registered: ‎11-26-2010
My Device: Not Specified

Re: tablelayoutmanager highligh on row click

Based on my understanding of your question, you can use getFieldWithFocusIndex() or getLeafFieldWithFocusIndex() to fetch the row on which the focus is and give the required effect.

 

I request you to add more detailing to your question " How can I on click of the row, highlight the entire row "  is not so understandable.

 

A Y.  

New Developer
shivam284
Posts: 108
Registered: ‎01-23-2012
My Device: torch,bold,curve,strom

Re: tablelayoutmanager highligh on row click

yes try by getLeafFieldWithFocus

Thanks & Regards,
Kumar Shivam