how to set hint text size and font in j2me using lwuit - java-me

i am applying bitmap font to textfield and its working fine but textfield hint text size is not set as per i have applied font created using resource editor.please help me here how to set text filed hint text size?
i am using this code
emailtext.setHint("Email Address");
Style styleTextfield=new Style();
styleTextfield.setFont(font_textfield);
styleTextfield.setFgColor(0x808080);
emailtext.setSelectedStyle(styleTextfield);
emailtext.setUnselectedStyle(styleTextfield);
emailtext.setPressedStyle(styleTextfield);

If you are using some .res file to customize your UI, the UIID to change the TextField's Hint text value is TextHint. Modify the font there, using the Resource editor, and you will change the TextField's hint style.

What you want is to set the font of the unselected style of the TextField to be separate from the selected and pressed style :
txtField.getUnselectedStyle().setFont(myHintFont);

Related

Change command menu background in LWUIT

Can we change Command's background color of the menu in LWUIT ?
and how can I set an icon to the "Menu" generated Command ?
thanks
I will try to explain better than the other post. You can change the style of the Menu using and UIID.
There are two ways to do that.
Easy way. Use the LWUIT Resource editor and create in the Unselected tab, and UIID called Menu. In this UIID you should configure the background color as you wish. You can change more things (like text color, size of the font, etc)
Hard way, by code. Create a Style object and set it to the Menu.

LWUIT bitmap font

I'm Developing a small application in one of the classes i'm using two buttons , I have used bitmap fonts for all the components used in application (using Resource Editor) for both English and Persian language. Now I want in result of clicking button "small font" size of all component's fonts become smaller and in result of clicking button "large font" fonts get updated to larger size.
how can I do this , I mean how can I change size of bitmap font dynamically.
thanks for your support in advance
You need to assign the "pressed" style of the button to the desired font.

I cannot center the text of a userdefined Button

I created a Button and I set its UIID to boutonPpal. I set the bgAlign attribute to ALIGN_CENTER in the resource Editor but the text of the Button is not centered at runtime !
So how to make the text centered ?
bgAlign aligns the background image of a component. Use the "Align" tab if using the latest LWUIT. If you are using 1.4 you need to actually invoke setAlign() on the component since in 1.4 alignment was not a part of the theme.

How to change font and font size in scrollable text view in xcode?

How can I change the font and font size of my text in a scrollable text view in xCode? Will this require code or can I do it only in Interface Builder?
3 years late but still might help someone :)
If you want to edit the font from storyboard:
Change the text type from Plain to Attributed.
Then you have font options, If you want more mark the text then right click and you'll have more options.

How to add custom font in .xib?

I added a custom font in info.plist.But it worked only when programmatically changed.it doesn't change when tried through interface builder by changing the object attribute section. for example i used UILabel then i choose the custom font in the attribute section but it did not change the font style.
install the "Harrowprint" font by double clicking the file and also add it in my project resource file.
thanks in advance,
Senthilkumar
There doesn't appear to be a way, but there are some attractive work arounds.
Using custom fonts in interface builder

Resources