Skip to main content

Form Title and Background Transparency

4 replies [Last post]
bardubitzki
Offline
Joined: 2003-11-02
Points: 0

Hi there,

the following code works as expected:

<br />
mainForm = new Form();<br />
mainForm.setLayout(new BorderLayout());<br />
Label title = mainForm.getTitleComponent();<br />
try {<br />
      Resources r = Resources.open("/BlueTheme.res");<br />
      title.setIcon(r.getImage("title"));<br />
} catch (IOException ex) {<br />
      ex.printStackTrace();<br />
}<br />
mainForm.getTitleStyle().setBgTransparency(0);<br />
...<br />

But if I extend the Form class like

<br />
public class Login extends Form implements ActionListener {<br />
...<br />
public Login(UIController controller) {<br />
        super();<br />
        this.controller = controller;<br />
        setLayout(new BorderLayout());<br />
        getStyle().setBgTransparency(0);<br />
        Label title = getTitleComponent();<br />
        title.getStyle().setBgTransparency(0);<br />
        try {<br />
            Resources r = Resources.open("/BlueTheme.res");<br />
            title.setIcon(r.getImage("title"));<br />
        } catch (IOException ex) {<br />
            ex.printStackTrace();<br />
        }<br />
        getTitleStyle().setBgTransparency(0);<br />
...<br />

the titlebars background is not transparent, but has always the bgcolor specified in the themes
.conf file.

What do I wrong?

Thanks,
Stephan

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi Stephan,
I don't think the problem is related to the code you posted, this
works for me (notice I set the title bgImage to null since it will
ignore opacity settings):
[Picture 12.png]

class Login extends Form {
public Login() {
super();
setLayout(new BorderLayout());
getStyle().setBgTransparency(0);
Label title = getTitleComponent();
title.getStyle().setBgTransparency(0);
title.getStyle().setBgImage(null);
try {
//Resources r = Resources.open("/
BlueTheme.res");
title.setIcon(Image.createImage("/
smily.png"));
//title.setIcon(r.getImage("title"));
} catch (IOException ex) {
ex.printStackTrace();
}
getTitleStyle().setBgTransparency(0);
}
}

Form mainForm = new Login();
mainForm.setLayout(new BorderLayout());
mainForm.show();

On Jun 18, 2008, at 7:04 AM, lwuit-users@mobileandembedded.org wrote:

> Hi there,
>
> the following code works as expected:
>
> [code]
> mainForm = new Form();
> mainForm.setLayout(new BorderLayout());
> Label title = mainForm.getTitleComponent();
> try {
> Resources r = Resources.open("/BlueTheme.res");
> title.setIcon(r.getImage("title"));
> } catch (IOException ex) {
> ex.printStackTrace();
> }
> mainForm.getTitleStyle().setBgTransparency(0);
> ...
> [/code]
> But if I extend the Form class like
>
> [code]
> public class Login extends Form implements ActionListener {
> ...
> public Login(UIController controller) {
> super();
> this.controller = controller;
> setLayout(new BorderLayout());
> getStyle().setBgTransparency(0);
> Label title = getTitleComponent();
> title.getStyle().setBgTransparency(0);
> try {
> Resources r = Resources.open("/BlueTheme.res");
> title.setIcon(r.getImage("title"));
> } catch (IOException ex) {
> ex.printStackTrace();
> }
> getTitleStyle().setBgTransparency(0);
> ...
> [/code]
> the titlebars background is not transparent, but has always the
> bgcolor specified in the themes
> .conf file.
>
> What do I wrong?
>
> Thanks,
> Stephan
> [Message sent by forum member 'bardubitzki' (bardubitzki)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280916
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Stephan Bardubitzki

Hi Shai;

title.getStyle().setBgImage(null);

doesn't makes any difference. I have no idea what else could be wrong.

So looks my .conf file:

bgColor= 6464ff
fgColor= ffff96
bgSelectionColor= 55557d
fgSelectionColor= 0f2d55
font= Bitmap{SansSerif}
padding = 3, 3, 3, 3
Form.bgImage=background
Menu.bgImage=background
SoftButton.bgColor= ffff96
SoftButton.bgImage=menubar
SoftButton.bgSelectionColor= ffff96
SoftButton.fgColor= ffff96
SoftButton.fgSelectionColor= ffff96
SoftButton.font = System{FACE_MONOSPACE; STYLE_BOLD ; SIZE_MEIDUM}
TabbedPane.fgSelectionColor= ffffff
DialogTitle.bgImage=menubar
Dialog.bgImage=background

Thanks,
Stephan

On Wed, 2008-06-18 at 07:27 +0300, Shai Almog wrote:

> Hi Stephan,
> I don't think the problem is related to the code you posted, this
> works for me (notice I set the title bgImage to null since it will
> ignore opacity settings):
>
> --------------------------------
> Spam/Virus scanning by CanIt Pro
>
> For more information see
> http://www.kgbinternet.com/SpamFilter.htm
>
> To control your spam filter, log in at
> http://filter.kgbinternet.com
> class Login extends Form {
> public Login() {
> super();
> setLayout(new BorderLayout());
> getStyle().setBgTransparency(0);
> Label title = getTitleComponent();
> title.getStyle().setBgTransparency(0);
> title.getStyle().setBgImage(null);
> try {
> //Resources r = Resources.open("/
> BlueTheme.res");
> title.setIcon(Image.createImage("/
> smily.png"));
> //title.setIcon(r.getImage("title"));
> } catch (IOException ex) {
> ex.printStackTrace();
> }
> getTitleStyle().setBgTransparency(0);
> }
> }
>
> Form mainForm = new Login();
> mainForm.setLayout(new BorderLayout());
> mainForm.show();
>
>
> On Jun 18, 2008, at 7:04 AM, lwuit-users@mobileandembedded.org wrote:
>
> > Hi there,
> >
> > the following code works as expected:
> >
> > [code]
> > mainForm = new Form();
> > mainForm.setLayout(new BorderLayout());
> > Label title = mainForm.getTitleComponent();
> > try {
> > Resources r = Resources.open("/BlueTheme.res");
> > title.setIcon(r.getImage("title"));
> > } catch (IOException ex) {
> > ex.printStackTrace();
> > }
> > mainForm.getTitleStyle().setBgTransparency(0);
> > ...
> > [/code]
> > But if I extend the Form class like
> >
> > [code]
> > public class Login extends Form implements ActionListener {
> > ...
> > public Login(UIController controller) {
> > super();
> > this.controller = controller;
> > setLayout(new BorderLayout());
> > getStyle().setBgTransparency(0);
> > Label title = getTitleComponent();
> > title.getStyle().setBgTransparency(0);
> > try {
> > Resources r = Resources.open("/BlueTheme.res");
> > title.setIcon(r.getImage("title"));
> > } catch (IOException ex) {
> > ex.printStackTrace();
> > }
> > getTitleStyle().setBgTransparency(0);
> > ...
> > [/code]
> > the titlebars background is not transparent, but has always the
> > bgcolor specified in the themes
> > .conf file.
> >
> > What do I wrong?
> >
> > Thanks,
> > Stephan
> > [Message sent by forum member 'bardubitzki' (bardubitzki)]
> >
> > http://forums.java.net/jive/thread.jspa?messageID=280916
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> > For additional commands, e-mail: users-help@lwuit.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
[att1.html]

Shai Almog

Hi Stephan,
the setBgImage(null) was meant for my look and feel I didn't think it
would make a difference in your side.
I don't see a problem with your conf file, what I am suggesting is
that the problem is elsewhere... Your code contains additional
portions (e.g. UIController), try to isolate what is causing the
problem in a reproducible way.

Thanks,
Shai.

> Hi Shai;
>
> title.getStyle().setBgImage(null);
>
> doesn't makes any difference. I have no idea what else could be wrong.
>
> So looks my .conf file:
>
> bgColor= 6464ff
> fgColor= ffff96
> bgSelectionColor= 55557d
> fgSelectionColor= 0f2d55
> font= Bitmap{SansSerif}
> padding = 3, 3, 3, 3
> Form.bgImage=background
> Menu.bgImage=background
> SoftButton.bgColor= ffff96
> SoftButton.bgImage=menubar
> SoftButton.bgSelectionColor= ffff96
> SoftButton.fgColor= ffff96
> SoftButton.fgSelectionColor= ffff96
> SoftButton.font = System{FACE_MONOSPACE; STYLE_BOLD ; SIZE_MEIDUM}
> TabbedPane.fgSelectionColor= ffffff
> DialogTitle.bgImage=menubar
> Dialog.bgImage=background
>
> Thanks,
> Stephan
>
> On Wed, 2008-06-18 at 07:27 +0300, Shai Almog wrote:
>>
>> Hi Stephan,
>> I don't think the problem is related to the code you posted, this
>> works for me (notice I set the title bgImage to null since it will
>> ignore opacity settings):
>>
>> --------------------------------
>> Spam/Virus scanning by CanIt Pro
>>
>> For more information see
>> http://www.kgbinternet.com/SpamFilter.htm
>>
>> To control your spam filter, log in at
>> http://filter.kgbinternet.com
>> class Login extends Form {
>> public Login() {
>> super();
>> setLayout(new BorderLayout());
>> getStyle().setBgTransparency(0);
>> Label title = getTitleComponent();
>> title.getStyle().setBgTransparency(0);
>> title.getStyle().setBgImage(null);
>> try {
>> //Resources r = Resources.open("/
>> BlueTheme.res");
>> title.setIcon(Image.createImage("/
>> smily.png"));
>> //title.setIcon(r.getImage("title"));
>> } catch (IOException ex) {
>> ex.printStackTrace();
>> }
>> getTitleStyle().setBgTransparency(0);
>> }
>> }
>>
>> Form mainForm = new Login();
>> mainForm.setLayout(new BorderLayout());
>> mainForm.show();
>>
>>
>> On Jun 18, 2008, at 7:04 AM, lwuit-users@mobileandembedded.org wrote:
>>
>> > Hi there,
>> >
>> > the following code works as expected:
>> >
>> > [code]
>> > mainForm = new Form();
>> > mainForm.setLayout(new BorderLayout());
>> > Label title = mainForm.getTitleComponent();
>> > try {
>> > Resources r = Resources.open("/BlueTheme.res");
>> > title.setIcon(r.getImage("title"));
>> > } catch (IOException ex) {
>> > ex.printStackTrace();
>> > }
>> > mainForm.getTitleStyle().setBgTransparency(0);
>> > ...
>> > [/code]
>> > But if I extend the Form class like
>> >
>> > [code]
>> > public class Login extends Form implements ActionListener {
>> > ...
>> > public Login(UIController controller) {
>> > super();
>> > this.controller = controller;
>> > setLayout(new BorderLayout());
>> > getStyle().setBgTransparency(0);
>> > Label title = getTitleComponent();
>> > title.getStyle().setBgTransparency(0);
>> > try {
>> > Resources r = Resources.open("/BlueTheme.res");
>> > title.setIcon(r.getImage("title"));
>> > } catch (IOException ex) {
>> > ex.printStackTrace();
>> > }
>> > getTitleStyle().setBgTransparency(0);
>> > ...
>> > [/code]
>> > the titlebars background is not transparent, but has always the
>> > bgcolor specified in the themes
>> > .conf file.
>> >
>> > What do I wrong?
>> >
>> > Thanks,
>> > Stephan
>> > [Message sent by forum member 'bardubitzki' (bardubitzki)]
>> >
>> > http://forums.java.net/jive/thread.jspa?messageID=280916
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>> > For additional commands, e-mail: users-help@lwuit.dev.java.net
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>> For additional commands, e-mail: users-help@lwuit.dev.java.net

[att1.html]

Stephan Bardubitzki

Hi Shai,

calling refreshTheme() before manipulating the titlebars label solved
the problem.

Thanks,
Stephan

On Wed, 2008-06-18 at 08:26 +0300, Shai Almog wrote:
> Hi Stephan,
> the setBgImage(null) was meant for my look and feel I didn't think it
> would make a difference in your side.
> I don't see a problem with your conf file, what I am suggesting is
> that the problem is elsewhere... Your code contains additional
> portions (e.g. UIController), try to isolate what is causing the
> problem in a reproducible way.
>
>
> Thanks,
> Shai.
>
>
> > Hi Shai;
> >
> > title.getStyle().setBgImage(null);
> >
> > doesn't makes any difference. I have no idea what else could be
> > wrong.
> >
> > So looks my .conf file:
> >
> > bgColor= 6464ff
> > fgColor= ffff96
> > bgSelectionColor= 55557d
> > fgSelectionColor= 0f2d55
> > font= Bitmap{SansSerif}
> > padding = 3, 3, 3, 3
> > Form.bgImage=background
> > Menu.bgImage=background
> > SoftButton.bgColor= ffff96
> > SoftButton.bgImage=menubar
> > SoftButton.bgSelectionColor= ffff96
> > SoftButton.fgColor= ffff96
> > SoftButton.fgSelectionColor= ffff96
> > SoftButton.font = System{FACE_MONOSPACE; STYLE_BOLD ; SIZE_MEIDUM}
> > TabbedPane.fgSelectionColor= ffffff
> > DialogTitle.bgImage=menubar
> > Dialog.bgImage=background
> >
> > Thanks,
> > Stephan
> >
> > On Wed, 2008-06-18 at 07:27 +0300, Shai Almog wrote:
> >
> > > Hi Stephan,
> > > I don't think the problem is related to the code you posted, this
> > > works for me (notice I set the title bgImage to null since it will
> > > ignore opacity settings):
> > >
> > > --------------------------------
> > > Spam/Virus scanning by CanIt Pro
> > >
> > > For more information see
> > > http://www.kgbinternet.com/SpamFilter.htm
> > >
> > > To control your spam filter, log in at
> > > http://filter.kgbinternet.com
> > > class Login extends Form {
> > > public Login() {
> > > super();
> > > setLayout(new BorderLayout());
> > > getStyle().setBgTransparency(0);
> > > Label title = getTitleComponent();
> > > title.getStyle().setBgTransparency(0);
> > > title.getStyle().setBgImage(null);
> > > try {
> > > //Resources r = Resources.open("/
> > > BlueTheme.res");
> > > title.setIcon(Image.createImage("/
> > > smily.png"));
> > > //title.setIcon(r.getImage("title"));
> > > } catch (IOException ex) {
> > > ex.printStackTrace();
> > > }
> > > getTitleStyle().setBgTransparency(0);
> > > }
> > > }
> > >
> > > Form mainForm = new Login();
> > > mainForm.setLayout(new BorderLayout());
> > > mainForm.show();
> > >
> > >
> > > On Jun 18, 2008, at 7:04 AM, lwuit-users@mobileandembedded.org wrote:
> > >
> > > > Hi there,
> > > >
> > > > the following code works as expected:
> > > >
> > > > [code]
> > > > mainForm = new Form();
> > > > mainForm.setLayout(new BorderLayout());
> > > > Label title = mainForm.getTitleComponent();
> > > > try {
> > > > Resources r = Resources.open("/BlueTheme.res");
> > > > title.setIcon(r.getImage("title"));
> > > > } catch (IOException ex) {
> > > > ex.printStackTrace();
> > > > }
> > > > mainForm.getTitleStyle().setBgTransparency(0);
> > > > ...
> > > > [/code]
> > > > But if I extend the Form class like
> > > >
> > > > [code]
> > > > public class Login extends Form implements ActionListener {
> > > > ...
> > > > public Login(UIController controller) {
> > > > super();
> > > > this.controller = controller;
> > > > setLayout(new BorderLayout());
> > > > getStyle().setBgTransparency(0);
> > > > Label title = getTitleComponent();
> > > > title.getStyle().setBgTransparency(0);
> > > > try {
> > > > Resources r = Resources.open("/BlueTheme.res");
> > > > title.setIcon(r.getImage("title"));
> > > > } catch (IOException ex) {
> > > > ex.printStackTrace();
> > > > }
> > > > getTitleStyle().setBgTransparency(0);
> > > > ...
> > > > [/code]
> > > > the titlebars background is not transparent, but has always the
> > > > bgcolor specified in the themes
> > > > .conf file.
> > > >
> > > > What do I wrong?
> > > >
> > > > Thanks,
> > > > Stephan
> > > > [Message sent by forum member 'bardubitzki' (bardubitzki)]
> > > >
> > > > http://forums.java.net/jive/thread.jspa?messageID=280916
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> > > > For additional commands, e-mail: users-help@lwuit.dev.java.net
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> > > For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
> --------------------------------
>
>
> Spam/Virus scanning by CanIt Pro
>
> For more information see http://www.kgbinternet.com/SpamFilter.htm
>
> To control your spam filter, log in at http://filter.kgbinternet.com
>
[att1.html]