May, 2010

Learn Painters in LWUIT



The Painter interface

Painter defines the fundamental interface for all objects that are meant to draw backgrounds or to render on a glass pane. This interface declares only one method-public void paint(Graphics g, Rectangle rect)-for drawing inside the bounding rectangle (specifed by rect) of a component. The library provides a class that implements Painter and is used as a default background painter for widgets and containers. This is the BackgroundPainter class that has (you guessed it) just the one method paint, which either paints the background image if one has been assigned or fills in the bounding rectangle of the component with the color set in its style.

When we want to paint a background ourselves, we can write our own class that implements Painter, and set it as the background painter for the relevant component. The DemoPainter MIDlet, discussed in the next section, shows how this is done.

The DemoPainter application

This application creates a combo box and uses a theme to set the style for the various elements that are displayed. When the application is compiled without setting a custom background painter, the combo box looks as shown in the following screenshot:

The MIDlet code has the following statement commented out in the MIDlet. When uncommented, this statement sets an instance of ComboBgPainter as the background painter for the combo box.

combobox.getStyle().setBgPainter(new ComboBgPainter(0x4b338c));

The class responsible for drawing the background is ComboBgPainter, which implements Painter. The constructor for this class takes the color to be used for background painting as its only parameter. The paint method determines the coordinates of the top-left corner of the rectangle to be painted and its dimensions. The rectangle is then flled using the color that was set through the constructor.

class ComboBgPainter implements Painter
{

private int bgcolor;

public ComboBgPainter(int bgcolor)

{

this.bgcolor = bgcolor;

}

public void paint(Graphics g, Rectangle rect)

{

g.setColor(bgcolor);

int x = rect.getX();

int y = rect.getY();

int wd = rect.getSize().getWidth();

int ht = rect.getSize().getHeight();

g.fillRect(x, y, wd, ht);

}
}

Drawing a multi-layered background

In actual practice, there is hardly any point in using a custom painter just to paint a background color, because the setBgColor method of Style will usually do the job. Themes too can be used for setting background colors. However, painters are very useful when intricate background patterns need to be drawn, and especially if multiple layers are involved. PainterChain, described in the next section, is a class designed for handling such requirements.

The PainterChain class

It is possible to use more than one painter to render different layers of a background. Such a set of painters can be chained together through the PainterChain class. The only constructor of this class has the form public PainterChain(Painter[] chain) where the parameter chain is an array of painters. The contents of chain will be called sequentially during the painting of a background, starting from the element at index 0 to the last one.

There are two methods of the PainterChain class that provide support for adding painters to the array underlying the chain. A new painter can be added either to the top (the prependPainter method) or at the end (the addPainter method) of the array. The array itself can be accessed through the getChain method.

PainterChain implements Painter so that the setBgPainter method can be used to set a PainterChain as well as a lone painter, which means the paint method also is present here. The function of paint in PainterChain is to call the paint methods of the painter array elements one by one starting at index 0.

The DemoPainterChain application that comes up next shows how a chain of painters can be used to draw the multiple layers of a background.

Tags: , ,
Posted in Computers And Technology No Comments »

Best Online Games

Internet is source of many things. You can access a lot of information on internet. Entertainment is also a part of internet. Internet provides you a lot of ways that can entertain you in different ways. Games are among those entertaining features that are provided by the internet. These games are a source of fun for people belonging to every age group. However, some websites have also classified the games in some groups. These groups may relate to the elders and some of the groups are specified for the kids. Games are also divided according to their theme. Some games are called action games while others are arcade games, sport games, cards and so on. One thing is sure that whatever the game you will play will amuse you. These games are never boring and time passes like birds laying these online games.
Online games are of best quality. They offer best resolution to the players. The graphics that are available in online games are absolutely perfect and give the player a chance to enjoy the game to its best. The online games websites hire a number of creative programmers that design many new games daily. These games can be played online for free. The income of the website is generated through the advertisement. Many new dimensions have been brought to online gaming. You can enjoy a great sound in addition to a perfect picture quality. Another new feature that has been brought in the field of online gaming is the multiplayer games. Using this feature, you can compete with your friend who is sitting far away from you on the other computer. This feature has given these games a sense of reality. The competition is no more within you and the computer. Now you have to beat an original player. Thus, this feature has really added a charm in online games.
There are a large number of games that are really popular among youngsters. Free games are there for people that do not want to spent money on entertainment. In addition to these games, games for kids are also there. Kids have a lot of interest in arcade games. Keeping in view this trend, websites have separated out this section especially for kids. Fun games are also there on online gaming websites. These games do not need much concentration and are just there to relax your mind. These games are very useful for minimizing the mental stress. Among online games, we can see flash games as well as other games. These games are easy to load and take less time for their operation.
Playing online games on internet is a good hobby. It can give you comfort and can also teach you a lot of things through fun games. These games are very important for kids. They teach them in a different manner. If you never played online games then you should visit an online gaming website and should enjoy any game of your interest. You will feel very pleasant playing these games.

Tags: , ,
Posted in Online Games No Comments »

Delicious Wedding Cupcake Towers

If the traditional wedding cake just is not your style, there is a wonderful alternative. The cupcake tower has become a very popular wedding dessert, and it is sure to delight your guests. Here are some ideas about how to plan for the most charming and delicious wedding cupcakes towers ever!

There are many things that are great about having a cupcake tower instead of a standard wedding cake. The most important one is that everyone loves cupcakes. Cupcakes also give you the freedom to mix and match different flavors very easily, which will make your guests even happier. Plus, cupcakes are more lighthearted and fun than a formal cake, which makes them a terrific dessert for a casual wedding.

When you are having cupcakes, you will be able to choose a variety of flavors. Certainly, you should plan on having plenty of the classic yellow butter and chocolate cupcakes on hand.

From there, why not think about including one or two interesting seasonal flavors? A lemon cake is lively and refreshing for spring; at a summer wedding, a light-as-air angel food cupcake would be wonderful; fall brides can serve up a warm and cozy pumpkin spice cupcake; for a winter wedding, a gingerbread cupcake will get everyone in the holiday spirit. There are even more cupcake varieties available. Red velvet is popular with Southern brides, and brides can also consider some other delicious fruit flavored cakes like strawberry, banana, or even key lime.

Frosting is the next step, and the key is to have lots of it. These are not the puny little cupcakes with a smear of canned frosting that you took to school on your birthday in the fifth grade. Oh no; wedding cupcakes should definitely be scrumptious and decadent.

To that end, be sure that your cupcakes have a tasty frosting mountain on top of the cake. Vanilla, chocolate, and white chocolate are the most popular frosting flavors, but you can also dabble in some of the specialty varieties like rich cream cheese frosting or a light whipped cream topping.

Your cupcakes should be as beautifully decorated as the rest of your wedding, and there are infinite possibilities. If you choose a vanilla frosting, it can be custom colored to match your wedding colors. From there, you will want to think about choosing a special adornment for the top of each cupcake. As with wedding cakes, flowers are a favorite choice for cupcake decorations. You can choose from fresh flowers (dainty pansies look especially nice), classic buttercream flowers, or handmade sugar flowers (the most costly of the three). A whimsical alternative to flowers is butterflies or ladybugs.

Many brides like to have their wedding dessert coordinate with their bridal attire and jewelry. If you are a pearl bridal jewelry kind of gal, then cupcakes decorated with a pert little frosting bow with a tiny white frosting pearl in the center would be adorable. Brides who prefer the glitz and sparkle of crystal bridal jewelry will love the effect of having a shimmer powder dusted over each cupcake. Other popular choices for the wedding cupcake toppings include monograms, hearts, and beach themed accents like starfish.

Once you have settled on your finished cupcake design, all you need to do is decide how you would like them to be displayed. If you are a crafter, making your own cupcake tower is a fairly easy project involving not much more than some Styrofoam circles and decorative trim (look at a site like Martha Stewart Weddings for detailed instructions). Another lovely way to display beautiful wedding cupcakes is to collect an assortment of white or silver vintage tiered stands and place the cupcakes on them on each reception table. The fun thing about this is that the cupcakes on their gorgeous stands can double as the centerpieces.

Cupcakes are definitely here to stay as an alternative to wedding cakes. More and more couples are deciding that they are just too fun to resist. So if you are looking for a wedding dessert that is festive and that your guests will love, give a cupcake tower a try.

Tags: , , ,
Posted in Cupcake Decorations No Comments »

HTC Wildfire S Contract: Best mid range smartphone available



The HTC Mobile Corporation needs no introduction in the mobile phone market. Following the release of the successful HTC Desire, the company has explored a more affordable option with the HTC Wildfire S. This smartphone will set the mid range smartphone market on fire. The HTC Wildfire S might become famous for its great functions of surfing on the net with your style.

The HTC Wildfire S is available with many attractive HTC Wildfire S Deals which include contract deals, pay as you go deals and SIM free deals. The most preferred option is the HTC Wildfire S Contract Deals as they offer many free gifts and incentives along with the handset at affordable price.

Along with the handset, the user has the chance to win expensive home appliances such as DVD players, laptops, LCD TVs, gaming consoles and incentives such as free air time, free texts, free line rental and so on.

The HTC Wildfire S is an extremely slim and lightweight device with the measurements of 101.3 x 59.4 x 12.4mm and weight of just 105g. The front of this device holds a 3.2 inch TFT capacitive touch screen which can display contents in 256K colors at 320 x 480 pixel resolution. The screen also features accelerometer and proximity sensors along with HTC Sense UI, touch sensitive controls on a Gorilla Glass display.

The HTC Wildfire S runs on the Gingerbread version of Android OS along with a 600MHz processor for faster speed of multi tasking. The user can capture all his special moments in still images and videos with a 5MP camera which comes integrated at the back of this handset. It comes with many image enhancing options such as autofocus, geo-tagging and LED flash to render it digital quality.

The user can connect with the internet at fast speed with the various connectivity options such as GPRS, EDGE, 3G and Wi-Fi. The user can also exchange files with other electronic devices with the help of Bluetooth and USB features. Various social networking sites come integrated with this handset to allow the user to stay connected with his loved ones.

The user can store a lot of data files such as music tracks, images and videos in the internal memory of 512 MB which is capable of expanding up to 32GB with the addition of cards in the micro SD slot.

Tags: , ,
Posted in Intermezzo No Comments »

Forex Webinar Forex Trading Strategies Explained

Traders buy automated Forex trading software packages and think they are going to get rich with no effort by spending just a few hundred dollars or less – it looks to good to be true and it is. These systems all wipe out equity quickly here’s why.

Get A Forex Robot That Is Capable Of Doubling Your Money Every Single Month…

Fully automated forex robot that anyone can put his hands on! See undeniable proof of automated income.. >> works fully automated while you sleep! >> Click here now >>

Everyone is writing reviews of the Forex Funnel Automatic Forex Trading Software but how many have actually tried it out and given you a full and frank review? The Forex Funnel is the latest Expert Advisor plug-in which works with MT4 Trading Platforms and on the USD/JPY market.

Forex trading live results are presented by many robots but they are sometimes not all they seem and here we will look at why you should be careful of them and how to find the minority of Forex robots which make money.

It’s a fact that most Forex trading robots lose money and the reason there mostly designed by programmers not traders who simply test and bend the system so it makes a profit on closing data going backwards knowing all the closing prices!

The automated expert advisor is a distinct feature of the popular forex robot called FAP turbo trading robot. There are numerous similar products available in the market today that are designed to help traders improve their earnings in foreign currency trading; but only the FAP turbo offers this unique component that can give you a significant edge over the rest of the traders who are not using this feature to their advantage.

The foreign exchange trade market is an exciting place to invest and speculate.

Large sums can be made in a short time although for most traders even the successful ones the reality is a little different because of the need to take account of the high risk. So how should a trader act to put themselves on the right side of the equation?

The immense potential for profit in the Foreign Exchange market has resulted in a glut of systems and services available purporting to allow ordinary people with no background in finance to make incredible amounts of money from Forex trading. Originally this support came in the form of eBooks but nowadays the emphasis has shifted away from tutorials and towards automated Forex trading systems – aka ‘Forex robots’ – which are computer programs designed to handle the difficult parts of Forex trading without need for user input or intervention.

Today’s economy has really made a lot of people very paranoid of their investments. Some are even reluctant to invest on even the smallest opportunities for them to gain profit.

Tags: , , , ,
Posted in Intermezzo No Comments »