×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Creating a custom HeaderBar

    I'm building a custom header bar for Nokia S40, in LWUIT.

    I've found 2 issues.

    My Form has a BorderLayout and I've added the header bar (Container) in the NORTH. This container doesm't fill the width of the Form, as the CategoryBar does. I try with BoxLayout but I get the same result. I want that my custom header bar looks like the native CategoryBar, full width and visible over the rest of the Components.

    Second issue.

    I set my app to full screen using Display.getInstance().setForceFullScreen(true); and I've lost all the back Commandsof my app. Any idea?

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Creating a custom HeaderBar

    if i remember properly i did something like this couple of months back, and i override the paint method of my custom HeaderBar component to fill the entire width, actually i never tried with layouts !! So that can be a option for you !!

  3. #3
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Creating a custom HeaderBar

    If you can share some code, it would be great

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Creating a custom HeaderBar

    Quote Originally Posted by Javier Muñoz View Post
    If you can share some code, it would be great
    Hello Javier,

    Sorry for late reply i cant share the whole class but i hope this paint method gives you some clue !!
    Code:
    public void paint(Graphics g) {
            UIManager.getInstance().getLookAndFeel().setFG(g, this);
            Style style = getStyle();
            style.setPadding(0,5,5,5);
            style.setMargin(5,5,5,5);
            Font textFont = Visual.MEDIUM_BOLD_FONT;
    
            int rectwidth = Display.getInstance().getDisplayWidth();
            int rectheight = 50;
            int x = 5;
            int y = getY();
                    
            g.setColor(Visual.HEADER_BACKGROUND_COLOR);
                    
            g.drawRect(x, y, rectwidth-20, rectheight);
            g.fillRect(x, y, rectwidth-20, rectheight);
            
            g.setColor(Visual.BACKGROUND_COLOR);
            g.setFont(textFont);
    
            int imageX = rectwidth - dittoImage.getWidth()-20 ;
            int imageY = y+5;
            
            g.drawImage(image, imageX, imageY);
            
            int strX = imageX/2;
            int strY = imageY+5;
            g.drawString("Title", strX, strY);
    
            }
    I hope you can understand the meaning of constants !!

  5. #5
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Creating a custom HeaderBar

    Thanks a lot for the help!

Similar Threads

  1. Creating custom item.
    By kamuflage661 in forum Mobile Java General
    Replies: 5
    Last Post: 2009-07-29, 11:10
  2. Creating a custom MTM account in s60
    By tbernard1 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-06-28, 14:18
  3. creating dynamic custom image
    By farhanx in forum Mobile Java General
    Replies: 1
    Last Post: 2006-11-05, 14:55
  4. Creating/Adding custom MTM
    By shashishaw in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-03-09, 12:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×