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
zahidalinaqvi
Posts: 445
Registered: ‎10-14-2008
My Device: Blackberry Bold 9000
Accepted Solution

Set Color with RGB

Hello,

I have rgb of a color now i want to set that as g.setColor(?);

 

what is the syntax to set rgb.

 

RGB = 196, 31, 45

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks & Regards
Zahid Naqvi | Senior Software Engineer
Developer
mantaker
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Set Color with RGB

You have to calculate it to int and pass it over to the setColor() method..

 

Take a look in to this to calculate it ..

 

http://www.shodor.org/stella2java/rgbint.html

 

For yours it is coming like - 12853037

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
zahidalinaqvi
Posts: 445
Registered: ‎10-14-2008
My Device: Blackberry Bold 9000

Re: Set Color with RGB

hi mantaker, still i didnt get the solution of my previous problem.

my application using httpconnection and its working fine with wifi connection (on device). getting data from the servlet. i want to use with GPRS EDGE. I tried it the whole last day. but its not working. even i got the apn name, username and password. but its not working iwth GPRS. I deploy NetworkDiagnosticPublic application on device even its also not working with WAP. and not getting response. only working with wifi. Here is my code. n my application wifi connecting successfully but i want to do with GPRS Edge code is

 

    connThread.get("http://w30gcliwn.30daytrial.webappcabaret.com/Zain_Servlet/second?f1="
                            + NameTextField.editField.getText()
                            + "&m2="
                            + AreaTextField.editField.getText()
                            + "&l2="
                            //+ LastTextField.editField.getText());//NOT WORKING
                            //+ LastTextField.editField.getText() + ";deviceside=true;ConnectionUID=" + getWap2TransportUid());//NOT WORKING
                            + LastTextField.editField.getText() + ";deviceside=true");//NOT WORKING
                            //+ LastTextField.editField.getText() + ";interface=wifi");// WORKING
                            //+ LastTextField.editField.getText() + ";deviceside=true;apn=internet;" +
                            //"TunnelAuthUsername=internet;TunnelAuthPassword=internet");//NOT WORKING

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks & Regards
Zahid Naqvi | Senior Software Engineer
Developer
mantaker
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Set Color with RGB

I think this thread's problem is solved.. Can you make this thread solved?

 

Well, We gave a lots of hints that solves your problem.. Still you don't get them.. Please go thru the thread by peter_strange carefully..

 

I can finally tell you this.. First try with no deviceside parameters, no connection uids, no interface parameters etc.. Just URL ..  Then set your APN info in Options->Advanced Options->TCP/IP and then finally APN info..

 

Try with a small URL, maybe http://www.google.com/ alone..

 

Cheers.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Developer
yyzTim
Posts: 304
Registered: ‎04-30-2008
My Device: Not Specified

Re: Set Color with RGB

The colour calculator was the answer to what I was just wondering.  Good timing - Thanks!

Developer
austinfrance
Posts: 65
Registered: ‎01-05-2010
My Device: Not Specified

Re: Set Color with RGB

(R<<16)+(G<<8)+B

 

int color = (195<<16)+(31<<8)+45;