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
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified
Accepted Solution

Problem in removing the Title Border

I have used setTile(Field) in my application.

 

But There always appearing a defaut border in the title.

 

Is it possible to remove the border of the title or anything custom that will work like title??

 

I am not finding anything.. I am looking for some suggestion or help.

 

My Code is as Below:

 

BitmapField titleField = getTitleBitmapField();
this.setTitle(titleField );

public static BitmapField getTitleBitmapField()
{    
        int marginX = (Display.getWidth() - titleImage.getWidth() ) / 2 ;
        Bitmap titleBackgroundImage =  Bitmap.getBitmapResource("topBannerBack.png");
        Graphics graphics = new Graphics(titleBackgroundImage);
        graphics.drawBitmap(0, 0, Display.getWidth() , titleBackgroundImage.getHeight(), titleBackgroundImage, 0, 0);
        graphics.drawBitmap(marginX, 0, Display.getWidth() , titleBackgroundImage.getHeight(), titleImage, 0, 0);
        BitmapField titleField = new BitmapField(titleBackgroundImage);
        return titleField;
}

 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Problem in removing the Title Border

Check this Thread, it may help you.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=18606&query.id=16...


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Problem in removing the Title Border

Thanks for your quick reply.

 

But unfortunately your given thread contains another link that is showing some error like "error in establishing database connection.

 

So I am still looking for the solution or atleast some suggestions about the border issue. 

 

 

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problem in removing the Title Border

the link links to a post by jonathan fisher on his old blog:
http://www.jonathanhfisher.co.uk/b2/?p=19code

you can try to overwrite applyTheme.
or you can just use two verticalfieldmanagers to simulate the setTitle behaviour.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Problem in removing the Title Border

Thanks a lot.

Its really helped.

My probelm solved.

 

Bikas

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Problem in removing the Title Border

 

There is another problem with this custom title bar. When I tried to add lot of buttons in the screen in another vertical manager. When we scroll the buttons the title bar also scrolled and hide behind the screen. How to make the title bar fixed or make it act like original title bar. I have already tried with two vertical field manager. In first one I added the title bar and in second one I have added buttons. But it is not working.

 

 

Here is part of the code:

 

titleBar = new TitleBar(); titleBar.isHeaderTitleDisplay( false ); String strLabel = screenManager.previousScreenNameForTitle; titleBar.setTitleString(strLabel); VerticalFieldManager verticalManager1 = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_VERTICAL_SCROLL); verticalManager1.add(titleBar); this.add(verticalManager1); verticalManager = new VerticalFieldManager(Manager.HORIZONTAL_SCROLL | Manager.VERTICAL_SCROLL) { public void paint(Graphics graphics) { graphics.setBackgroundColor(0x00000000); graphics.clear(); super.paint(graphics); } protected void sublayout( int maxWidth, int maxHeight ) { int displayWidth = Display.getWidth(); int displayHeight = Display.getHeight() /*- titleBar.getPreferredHeight()*/; super.sublayout( displayWidth, displayHeight); setExtent( displayWidth, displayHeight); } }; verticalManager.invalidate(); //LabelField displayLabel = CommonElements.getDisplayLabel("NAVIGATE TO"); int screenHeight = Display.getHeight() - (titleBar.getPreferredHeight()); int buttonHeight = ( screenHeight / 8 ) - 1; if (buttonHeight > 30) { buttonHeight = 30; } CustomButtonField navigateButton = new CustomButtonField(EncodedImage.getEncodedImageResource("navigateTo.png"), "navigate to", true); navigateButton.setChangeListener(this); navigateButton.setHeight( buttonHeight ); //navigateButton.setMargin(10, 10, 2, 2); CustomButtonField addressButton = new CustomButtonField(EncodedImage.getEncodedImageResource("address.png"), "address", true); addressButton.setChangeListener(this); addressButton.setHeight( buttonHeight ); //addressButton.setMargin(10, 10, 0, 2 ); CustomButtonField placeOfBusinessButton = new CustomButtonField( EncodedImage.getEncodedImageResource("place.png"), "place/business", true); placeOfBusinessButton.setChangeListener(this); placeOfBusinessButton.setHeight( buttonHeight ); //placeOfBusinessButton.setMargin(10, 10, 0, 2 ); CustomButtonField whereIamButton = new CustomButtonField( EncodedImage.getEncodedImageResource("locateMe.png"), "where I am", true); whereIamButton.setChangeListener(this); whereIamButton.setHeight( buttonHeight ); whereIamButton.setFocusable(false); whereIamButton.setFontColorNormal( Color.GRAY ); //whereIamButton.setBackgroundColorNormal( 0x00000000 ); //whereIamButton.setMargin(10, 10, 0, 2 ); CustomButtonField recentLocationsButton = new CustomButtonField( EncodedImage.getEncodedImageResource("recentLocations.png"), "recent locations", true); recentLocationsButton.setChangeListener(this); recentLocationsButton.setHeight( buttonHeight ); //recentLocationsButton.setMargin(10, 10, 0, 2 ); CustomButtonField myLocationsButton = new CustomButtonField( EncodedImage.getEncodedImageResource("myLocations.png"), "my locations",true); myLocationsButton.setChangeListener(this); myLocationsButton.setHeight( buttonHeight ); //myLocationsButton.setMargin(10, 10, 0, 2 ); CustomButtonField fromMapButton = new CustomButtonField( EncodedImage.getEncodedImageResource("fromMap.png"), "from Map",true); fromMapButton.setChangeListener(this); fromMapButton.setHeight( buttonHeight ); //fromMapButton.setMargin(10, 10, 0, 2 ); CustomButtonField mapBookReferenceButton = new CustomButtonField( EncodedImage.getEncodedImageResource("mapbookReference.png"), "map book reference", true); mapBookReferenceButton.setChangeListener(this); mapBookReferenceButton.setHeight( buttonHeight ); //mapBookReferenceButton.setMargin(10, 10, 0, 2 ); CustomButtonField enterCoordinateButton = new CustomButtonField( EncodedImage.getEncodedImageResource("coordinates.png"), "enter coordinate", true); enterCoordinateButton.setChangeListener(this); enterCoordinateButton.setHeight( buttonHeight ); //enterCoordinateButton.setMargin(10, 10, 0, 2 ); //add(displayLabel); verticalManager.add(addressButton); verticalManager.add(placeOfBusinessButton); verticalManager.add(whereIamButton); verticalManager.add(recentLocationsButton); verticalManager.add(myLocationsButton); verticalManager.add(fromMapButton); verticalManager.add(mapBookReferenceButton); verticalManager.add(enterCoordinateButton); this.add(verticalManager);

 

Thanks

 

 

Developer
Posts: 170
Registered: ‎01-17-2009
My Device: 9630

Re: Problem in removing the Title Border

[ Edited ]

public HomeScreen() {

super(Manager.NO_VERTICAL_SCROLL);

add(new LabelField("Title"));

VerticalFieldManager list = new VerticalFieldManager(Manager.VERTICAL_SCROLL);

list.add(new LabelField("Body text and stuff"));

add(list);

}

Edit: Note the super(Manager.NO_VERTICAL_SCROLL); line
Message Edited by gregzav on 03-01-2009 11:50 AM