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.
Archive for May, 2010
Learn Painters in LWUIT May 30th, 2010
WordPress Backup Techniques May 30th, 2010
WordPress is currently generating headlines in the online community as it is constantly increasing in its worldwide popularity and user base. A WordPress blog can be encountered everywhere in contrast to the outdated & basic html sites that are now an unusual sight; not surprisingly since we’re now in the era of web 2.0 sites. The era may have changed but the threats of the internet are still around. About ten years ago a single backup is good enough for your html website. Since html websites has no database capabilities, there’ll be no change at all with the website files anything thus a single backup is enough. But right now web 2.0 sites are all database driven meaning it is ever evolving. To put it accurately, a two week old backup of your WordPress site is already considered out of date; as a single WordPress site can gather hundreds of posts a day.
Hence, it could be great if we have a website backup solution for our WordPress website. What we need is a backup option either online or offline, and if possible something that can be scheduled for a regular backup.
The following options are available for your WordPress Backup:
Online backup approach Allows you to create online backups by availing the service from hosting providers. This involves storing your website files into an external webpage of their choice. The merit of this is that you can have a total website backup, though you might have limited access to it depending on your terms with your web host provider.
Plug-in option generally uses plug-in capability of the wordpress. The plug-ins can be scheduled and have diverse coverage, benefits and limitations.
WordPress database backup (WP-DB-Backup) is a plug-in that will enables you to copy your database for backup. It supports joomla, wordpress and various other kinds of web 2.0 sites that can be scheduled for a routine backup.
WordPress Backup (BTE) This plug-in allows you to backup your directory, themes, plug-ins and tools in a single zip file. Unfortunately the plugin still lacks in the department of creating database backups.
WP-DBManager – Lets you to do database maintenance tasks, and some other clever capability such as drop or empty tables etc. Again this works with scheduling but covers the database only.
All of the backup files coming from the plug-ins are saved as compressed archives. Being a single compressed file allows it to be easily transferred to your hard disks or pen drives for several backups.
The backup will then be sent to you online through your email account. If you are using a Gmail account then you have up to 20 megabytes of storage for each backup file. Thus a website with a larger database has to find other options to backup as the plug-in backup option is limited to 20 MB.
cPanel approach can support large backup files as well as a full website backup. A significant strength of a cPanel backup approach is that it supports full website backup in contrast to plug-ins which encompasses only specific files.
To backup via cPanel, first get FTP software such as filezilla, Ipswitch WS_FTP etc.
Next Log into your cPanel account
Open Phpadmin then go to your WordPress website files
Click on the Export Tab then choose to add/drop table
Check the option to Complete Inserts
after that click the save as file check box
Disable compression unless your database is very large
Carry on hitting the backup button
Choose whatever backup that suits your need. Whatever backup option you choose is fine It is the practice of having a backup for your websites that matters most. Believe me, possessing a fail-safe backup guarantees a great web business operation safe from any failures.
Payday Loan – An Overview May 30th, 2010
Payday loan can be used as the immediate option to meet your emergency cash requirement. Payday loan is the easily available short term loan, which is popular in various other names such as cash advance and check loans. The immediate availability of payday loan will be a boon at many times. The payday loans were easy to avail from the earlier times and it was considered as one of its most remarkable feature. However, with the introduction of online payday loan companies, the process has become a very easy task and an eligible borrower can get their money within no time. The loan processing time and approval time are significantly lowered with the help of developments in the information technology. Payday loan overview narrates about the possibilities of gaining a payday loan.
Payday loan is available from many lenders. The conditions for applying for the payday loan seem to be very lenient and most of the criteria are affordable for any working person. The payday loan is structured to be a very short pattern, maximum up to the next payday. When the loan is approved, the amount will be credited into your checking account and you do not have to involve any tensions about the loan amount. The collateral security of the payday loan is a postdated check, which has to be cleared on the payday. The check must carry the tenure amount and the particular finance charges and the lender will directly send the check for clearance. The easy clearance is an added advantage, which avoids the hassles in the repayment and debt clearance.
Payday loan is appreciated by many people since it does not involve any intensive credit checking. The bad credit people can also be able to avail payday loan, irrespective of their credit. For the approval of the payday loan, the borrower must be of 18 years age and must be employed for the last 6 months, with a minimum income of $1000. Some of the payday loan lenders are lenient about the regulations and provide relaxation for employment to 3 months and monthly salary of $800. The payday loan seems to be the shortest loan period and it varies depending on 14 days to 30 days, according to the payday duration. In most cases, if you are dealing with the same lender, they may gradually provide more credit. The borrower must also posses a valid credit checking account to make the transaction easier.
Getting into payday loan must not be a recommended practice as the interest rates of the payday loan is very high. The APR rate of the payday loan is projected to be around 390 to 780% of the traditional loan. The payday loan has to be closed within a month, on the payday rate. However, most of the payday loan lenders provide roll over for the payday loan as the borrower will not be able to the repay the amount in time. In roll over the interest rate of the payday loan will be accumulated into the loan amount and it can be repaid in monthly repayments. However, the interest rate of the roll over payday loan will not be affordable for every person.
Payday loan can be reviewed as an emergency loan, but availing the payday loan has to be done carefully.
Diamonds For Sale – Basic Ideas On The best way to Determine If A Diamond Is Real Or Fake May 30th, 2010
Diamonds for sale on the web enables males and ladies around the world to search among many hundreds of styles and designs inside the comfort of their own homes or workplaces. A person can come across numerous sites offering tons of info along with great photos of diamond jewelry piecies plus marvel through a great deal of interesting finds whenever you’re in search of that excellent diamond ring.
Internet marketing and promotion made the diamond stone even more well-liked and wanted by most people who are planning to purchase diamonds for sale. You’ll find a lot of causes why this particular priceless gemstone is considered the very best surprise a man can give to his special and beloved lady. Due to the introduction of online shops, diamond jewelleries have become the preferred choice for engagement rings, anniversary and wedding rings. Its unparalleled character as well as the price it commands somehow translates to the true love you have for your companion.
A lot more often than not, guys are too sluggish to shop around heading from one jewelry shop to another in search for that flawlessly designed diamond ring. Searching diamonds for sale on the internet is a lot simpler plus a time saving approach. These online jewelry stores are really hassle-free to utilize. Being client oriented a site visitor and potential clients are provided the full facts and information regarding their selected diamond rings. Most sites display their goods by means of images. Every single photograph shows product features and dimensions helping to make it simpler to decide on and choose the ring that suits your own and your partner’s preference. Furthermore, online shopping can also save you cash as most of these stores can provide their diamonds for sale at lower prices because they do not pay for room rentals. These online internet sites can even showcase a lot of varieties a lot more than a regular jewelry shop. The very best aspect is you’ll be able to spend far more time exploring at every single photo allowing you a lot more time to examine and decide on what you believe is the best piece from plenty of options offered.
Once you shop for diamond for sale online essentially the most essential thing to do would be to request for a certification granted by a well known diamond grading and experienced appraisers. Almost all appraisers rely on a standardized grading method for diamond stones. Even if you’re being granted with a certificate of authenticity coming from the jeweler it still isn’t an assurance that you have purchased a genuine diamond.
Study on a few beneficial ideas on the way to know if a diamond is real or a replica:
• Search for the refractive qualities. A genuine diamond throws off sparks when light goes by through it simply because diamonds have a high refractive index.
• With regard to loose diamonds, you could try putting it upside down on a newspaper or any kind of surface, in the event that you’ll be able to view the bottom then simply, it is not a real diamond.
• A real diamonds’ reflection must be grayish in color certainly not the rainbow reflections that a lot of people believe.
• A legitimate diamond shouldn’t possess an orange flash whenever checked under a microscope.
• A diamond displays blue fluorescence whenever placed under UV light. Should you see this color in that case feel safe that what you bought is really a real one.
Using Victoria?s Secret Coupon Codes May 30th, 2010
Victoria’s Secret is one of America’s most popular and biggest retailers of stylish women’s clothing, super-hot swimwear, sexy intimate lingerie and sleepwear, designer shoes, boots, beauty products, and must-have accessories. Victoria’s Secret has long been an icon of quality that offers a wide variety of products that each woman on earth will surely love. Their popularity skyrocketed over the years through selling online and through their globally recognized mail-order catalogs wherein shipping of products can be available on the next day to your own doorsteps thru overnight shipping.
Being one of the leading brands for women’s apparel and accessories in our market today, the luxury of possessing Victoria’s Secret products frequently comes at a price not everyone can handle. However, this perception has been changed thanks to Victoria’s Secret coupon codes! Really good news for savvy shoppers out there! Since so many individuals are struggling to keep their allocated budget and bills in accordance with each other, making use of coupon codes allow us to conserve a lot of cash each year without compromising the quality of products that we are buying and using.
Now, it is understandable why many people can’t wait to get as much Victoria’s coupon codes as possible just so they can get more discounts for the vast array of quality products that are being offered. It is like getting more without spending much! Just practical shopping!
Victoria’s Secret coupon codes are not that hard to find. They can be found within several online websites however the real challenge is finding totally free coupon codes that have not yet expired. If you are interested to get a hold of these coupon codes, you need to consider many things first just to be sure you are actually getting the right code so that you will not be wasting your time and efforts for hoaxes. First thing you may do is actually subscribe a totally free newsletter directly from Victoria’s Secret official website. These newsletters will provide you with the latest coupon codes, promotions and sale discounts that can make shopping better, easier, less expensive, and practical.
If you intend to get Victoria’s coupon codes from other websites, then make it sure that they are reliable and reputable. You can make use of Google, Yahoo, and Bing search engines to search for genuine and versatile Victoria’s coupon codes. However, one must be patient enough to search such coupon codes because sometimes these are just offered in limited period of time only. Also, do check their site reviews and feedbacks just to make sure they are not scammers and will only provide you with authentic Victoria’s coupon codes.
Victoria’s Secret coupon codes are also available in newspapers, printed advertisements and other internet printables however sometimes it can be very difficult to tell if a coupon in this format is legitimate or fake. Now, here are some tips that can help you deal such situation. First, obtain coupons from reputable sources only. Next, pay attention to the appearance of the coupon itself. Bar codes in particular should have a normal pattern, no smudges or signs of tampering. Also specifically pay attention to the words on the coupon, there should be no spelling errors.
The coupon should also indicate the expiration date and remittance address. If the coupon failed to follow the above mentioned observations then you must be cautious because that coupon could be a fake. Be cautious also for coupons in PDF and JPG formats. Only receive such coupons if they are directly from the manufacturer. Next, be cautious with coupons that you receive in your personal email that do not come from a company, manufacturer or store but from friends that shared it to you. These coupons are only meant to be used once and only by the person who received the first email. You can also check if a certain coupon have been found or known to be fraudulent through some legitimate websites that have a list or database of counterfeit coupons already identified.
Indeed, Victoria’s Secrets coupon codes definitely have brought convenience and practicality to many shoppers who want to spend less but enjoy much great deals and discounts of products only from the quality brand, Victoria’s Secret.
