graphics java applet

By admin  

graphics java applet
java applet code problem?

i need to get the following output in the applet
1
12
123
1234
12345

and the code i am using is….(it would be gr8 if u point out the error)

import java.applet.Applet;
import java.awt.*;
public class f extends Applet
{
public void init()
{
}
public void paint(Graphics g)
{
int i,j,k=10,a=10;
for(i=1; i<=5; i++)
{
for(j=1; j<=i; j++);
{
for(k=10; k<=(j*10); k++)
{
g.drawString("1",a,k);
}
}
k=20;
a=a+20;
}
}
}
//

Too many loops.
You want one loop for the rows.
for (i=1;j<=5;i++)
and one loop for the columns
for (j=1;j<=i;j++)
now
g.drawString("1",a,k);
But this will put the number always in the same place.
So you need to adjust a and k
Adjust a based on i and adjust k based on j
so
a=10*i;
k=10*j;
g.drawString("1",a,k);
but you are only printing "1" now.
You have the number to print. It is j. But j is an int and must be converted to a string.
So
g.drawString(Integer.toString(j),a,k);

Have fun.

graphics java appletgraphics java applet
graphics java applet

The Web Design Myths

If your site has been around for a while, you’d probably have been visited by the “Web Design Police” (people who have a lot of time on their hands). In fact, depending on your site, you might have been visited by different branches of these people, both advocating opposite policies. I recently received an email from one of my visitors who had apparently been “helped” by some of these people, and thought that an article on two of the myths of web design is appropriate.
1. The Myth of “Content is King, No Animation/Sound/Java/etc”
The adage that “Content is King” applies to all websites, and I am not disputing that. It is also true that when you add sound, animation, Java applets and lots of graphics, your web page takes a long time to load, and some of your visitors may not bother to wait for it to load; they’ll just go away.
However, putting those two together does not actually mean that all pages with animation, sound and applets are necessarily bad. The trick is to know when they’re appropriate and to make the download speed as fast as it is reasonably possible under the circumstances. I will mention a few ways of reducing your graphics and animation file sizes later in this article.
When is it appropriate? Sometimes applets are needed for some sort of processing – for example, the Sesame Street website has a Java applet that shows Elmo (a Sesame Street character) dancing, and the child using it can use the mouse pointer to “tickle” Elmo and he’ll respond according to where he is tickled. The applet takes forever to load on a 56K modem, but you cannot say that it is out of place: the site caters to young children who are there to play. In this case, the applet is an appropriate solution. Likewise, animation and sound might be appropriate for sites that feature online comics, online gaming, etc.
In fact, if yours is a website that sells website design services, that is, you want people to pay you to design their website, it is in your interest not to make your site too plain. Many potential customers see your site as an example of what their site can become. There’s no point claiming “Content is King” at this time – they won’t be around long enough to hear your claim. Such sites need a certain amount of colour, graphics, etc, although of course making it take too long to load would also be a deterrent to your potential clients.
Like all things, how you design your site depends on your topic and your target audience. Keep that cardinal rule in mind and you’ll be fine.
2. The Myth of “Good Web Design is in the Graphics”
On the other end of the scale are the people who believe a good website must have much colour, graphics, animation and sound. You might meet them, for example, in the form of newcomers or pundits who either do not have much real world web experience or who only surf on T1 connections.
My first encounter with such people came in the form of an old friend who exhibited his personal website proudly to me. At the centre of his home page was a large animated graphic that was a few hundred kilobytes in size. That graphic had little function on that page – it did not provide any informative value: it was neither a logo, nor was it a photo of himself, or an image map, or anything at all. It was purely decorative. At that time (many years ago), I was using a 14.4K modem and that page took ages to load.
Now don’t get me wrong. Decorative graphics on a page are fine. They make a page more pleasant to look at, and hence more likely to be read. But you should at least make them as small as possible. While I’m hesitant to give a hard and fast rule about how big such graphics should be, a decorative graphic that is a few hundred kilobytes in size is definitely too big to be tolerated.
3. Some Page Design Tips
If your concern is that your page should look good without being too slow to load, here are a few commonly used tricks that you may want to consider:
Do not put too much text in one big block. Separate them out into paragraph and put white space between paragraphs. This makes your text look more readable.
Like colored pages? That’s okay, but in general, if the readability of your text is important to you, a white background with black text works best.
If you must have a colored background, make sure you try out your page by viewing it in resolutions like 256 colors to see whether the page looks alright. A colored page that looks fine on your 32 bit color resolution system may have dithering that makes your text difficult to read on lesser settings.
If you check the websites of big companies (Microsoft, Yahoo, etc), you will find that they still prefer a white background with black text for their main text. These companies probably have more resources for testing the usability of their website than you have, so it may not be wise to scoff at their design too quickly.

http://www.thedesignbuild.com
http://www.webdesign.reprintarticlesite.com

About the Author

About java method, paint(Graphics g)?

in Java applet, I want to draw 30 parallel lines in the screen.So I writed the below:
class MyApplet extends Applet{
int x0[]=new int[30];
int y0[]=new int[30];
int x1[]=new int[30];
int y1[]=new int[30];
……………………. //omit the assigning value statements
public void paint(Graphics g){
int i=0;
for(;i<30,i++){
g.drawLine(x0[i], y0[i], x1[i], y1[i]);
}
}
}
.....

But in its running, why this program seems to go into a dead-cycle, or dead locked..anyway, it just can not draw the lines and I must close the appletviewer in the windows console!!!
I don't know why and it seems no mistake in my program, could anyone help to resovle this matter??Thanks!

you must have wrongly initialized the arrays
first try to draw a single line and then correct the code

java applet tutorial #1


iHome iP43LVC Dual Alarm Clock Radio for your iPod/iPhone with Pillow Shaker (Blue)


iHome iP43LVC Dual Alarm Clock Radio for your iPod/iPhone with Pillow Shaker (Blue)


$75.95


Sla 12v 18ahupg 85977/d5745 sealed lead acid batteries (12v; 18 ah; ub12180). Specs: used in ups backup systems, spotlights, flashlights, exit lighting & other equipment; 12v; 18 ah; ub12180. Refurb: n. Returnable: y. Warranty: one year…….

Dual Alrm Clck Rad Iphone/ipod Purple Charge Play Or Wake


Dual Alrm Clck Rad Iphone/ipod Purple Charge Play Or Wake


$91.77


iHome IP43UV Desktop Clock Radio IP43UV Clocks…

Alex Super Baking set - 18 Piece Metal and Plastic Set


Alex Super Baking set – 18 Piece Metal and Plastic Set


$16.99


Measure, mix, prep, and bake some imaginary treats| This 18-piece set features a loaf pan, bear pan, heart pan, mixing bowl, rolling pin, whisk, measuring spoons and cup, pastry wheel, 2 star cookie cutters, 2 heart cookie cutter, and an oven mitt. Bon Appetit|…

Passion of the Christ: Songs (Original Songs Inspired by the Film)


Passion of the Christ: Songs (Original Songs Inspired by the Film)


$7.00



Egyptian Hieroglyphs Made Easy


Egyptian Hieroglyphs Made Easy


$26.50


Learning and understanding of the ancient Egyptian hieroglyphic language. The hieroglyphic script was the longest lived and earliest form of the Egyptian language. Its use was limited primarily to religious and monumental inscriptions, whereas a more cursive script called hieratic was preferred for administrative and epistolary purposes. Hieroglyphic Egyptian employs pictures of objects, each with…

Promised Land [CD-ROM]


Promised Land [CD-ROM]



Queensryche’s follow-up to the double-platinum Empire is something of an acquired taste, but it’s well worth the effort. There’s considerable variety here; the heavy progressive-rock of “I Am I” and the ballad “Bridge” were hit singles, but there’s also the funk-inflected “Disconnected”, the edgy, spooky “Lady Jane”, and the piano-and-vocals “Someone Else?”. The title track is probably the stronge…


Modern Floral Bird - Vinyl Wall Decals Murals Stickers Art Graphic - 46H x29W - by üBer Decals


Modern Floral Bird – Vinyl Wall Decals Murals Stickers Art Graphic – 46H x29W – by üBer Decals



Better than wallpaper, wall stickers are a perfect way to decorate your room and express yourself. They are a fun, easy and removable decor solution. These stickers are pre-cut and will only take you several minutes to apply on any surface – walls, doors, windows, and more. Each of our designs come with easy instructions to follow. This is an original design from uBer Decals. All other sellers are…


Yoga Girl - Vinyl Wall Decals Murals Stickers Art Graphic - 25H x 35W - by üBer Decals


Yoga Girl – Vinyl Wall Decals Murals Stickers Art Graphic – 25H x 35W – by üBer Decals



Better than wallpaper, wall stickers are a perfect way to decorate your room and express yourself. They are a fun, easy and removable decor solution. These stickers are pre-cut and will only take you several minutes to apply on any surface – walls, doors, windows, and more. Each of our designs come with easy instructions to follow. This is an original design from uBer Decals. All other sellers are…


2.5mm Hands-Free EarBud Headset + Car Kit Vehicle Plug in Adapter + Home Travel Wall Charger for ATT Nokia Mural Grouper 6750 Cell Phone


2.5mm Hands-Free EarBud Headset + Car Kit Vehicle Plug in Adapter + Home Travel Wall Charger for ATT Nokia Mural Grouper 6750 Cell Phone


$5.99


Brand new premium quality MP3 Earbud and hands-free headset for your cell / smart / PDA phone. Acoustically tuned speaker for improved sound clarity even in noisy environments. Soft covered ergonomic earpiece for comfort even over extended periods. **Phone & Ear bud features are limited to the phone’s capability and the service provider’s default settings. Please consult with your phone’s user man…

Shawn Interrupted


Shawn Interrupted


$1.99



Defending Polygamy


Defending Polygamy


$1.99



America's Funniest Home Videos: Sports Spectacular


America’s Funniest Home Videos: Sports Spectacular


$3.79


AMERICA’S FUNNIEST HOME VIDEOS:SPORT – DVD Movie…

Omaha Steaks Prime Rib Roasts


Omaha Steaks Prime Rib Roasts



Prime Rib Roasts…


KIKE CALVO photo illustrations FREAKLANCES Collection - Freaklance Fausto with bike graphic tablet and keyword - Coffee Gift Baskets - Coffee Gift Basket


KIKE CALVO photo illustrations FREAKLANCES Collection – Freaklance Fausto with bike graphic tablet and keyword – Coffee Gift Baskets – Coffee Gift Basket


$44.99


Freaklance Fausto with bike graphic tablet and keyword Coffee Gift Basket is measuring 9x9x4. Contains 15oz mug, BONUS free set of 4 coasters, biscotti and 5 blends of gourmet coffee. French Vanilla, Kenya AA, Decaf Colombian Supremo, Chocolate and Italian Roast Espresso elegantly presented in our signature black planet coffee gift box. A very nice and thoughtful gift for any occasion….

Betty Lous Organic Harmony Hippy Happy Apple Bar Case Pack 24 - 683021


Betty Lous Organic Harmony Hippy Happy Apple Bar Case Pack 24 – 683021


$116.33


1.75 oz bar. Vegan. USDA organic. Ingredients: organic apple cinnamon granola [organic oats, organic maple syrup, organic oat flour, organic crisped rice (organic brown rice, malt syrup - GF, sea salt), organic brown rice syrup, organic walnuts, organic sunflower seeds, organic expeller pressed high oleic sunflower oil, organic unsulfured dried apples, organic cinnamon, organic vanilla, sea salt],…

Pureology Hydrate Conditioner 8.5 oz.


Pureology Hydrate Conditioner 8.5 oz.


$21.95


You can feel this premium conditioner working to moisturize, detangle and lock in colour. Multiweight Protein Complex, jojoba and shea butter impart excellent lubricity and liveliness to your hair. Contains an invigorating infusion of peppermint oils….

Gecko Nasal Pad - Small, 3.25 Long


Gecko Nasal Pad – Small, 3.25 Long


$24.90


The Gecko Nasal Pad (formerly the Sleep Comfort Care Pad by Sequal) is intended for patients with Obstructive Sleep Apnea (OSA) who experience pain and discomfort on or around the bridge of their nose associated with using nasal or full face masks. The pad acts as a cushion between the patient’s face and mask, and is simply placed across the bridge of the nose under the mask. The protective polyme…

Tiger Balm Analgesic Tiger Muscle Rub


Tiger Balm Analgesic Tiger Muscle Rub




Kuzy® - AQUA BLUE Keyboard Silicone Cover Skin for Macbook / Macbook Pro 13 15 17 Aluminum Unibody


Kuzy® – AQUA BLUE Keyboard Silicone Cover Skin for Macbook / Macbook Pro 13 15 17 Aluminum Unibody


$1.00


Dress up your MacBook Pro in fashionable color, silicone protection now.
*** Will Not fit MacBook Air 11″ ***…

Kuzy - PURPLE Keyboard Silicone Cover Skin for Macbook / Macbook Pro 13 15 17 Aluminum Unibody


Kuzy – PURPLE Keyboard Silicone Cover Skin for Macbook / Macbook Pro 13 15 17 Aluminum Unibody


$2.00


Dress up your MacBook Pro in fashionable color, silicone protection now.
*** Will Not fit MacBook Air 11″ ***…

Kuzy - Circles Blue/White Keyboard Silicone Cover Skin for Macbook / Macbook Pro 13 15 17 Aluminum Unibody


Kuzy – Circles Blue/White Keyboard Silicone Cover Skin for Macbook / Macbook Pro 13 15 17 Aluminum Unibody


$2.00


Dress up your MacBook Pro in fashionable color, silicone protection now.
*** Will Not fit MacBook Air 11″ ***…

Sony ICF-C05iP Clock Radio for iPod (Black)


Sony ICF-C05iP Clock Radio for iPod (Black)


$39.95


With the Sony ICFC05iPBLK Clock Radio you can charge your iPod’s battery while you sleep. This Sony ICFC05iPBLK Clock Radio is the space-saving bedside accessory for iPod® and iPhone® users. Set the alarm to wake to the radio, iPod®, or a buzzer. The charging tray ensures both you and your iPod/iPhone® start the day with a fully charged battery. Plus, The Sony ICFC05iPBLK Clock Radio features …

Sharp LC60LE835U Quattron 60-inch 1080p 240 Hz 3D LED-LCD HDTV, Black


Sharp LC60LE835U Quattron 60-inch 1080p 240 Hz 3D LED-LCD HDTV, Black



Sharp AQUOS LC-60LE835U 60″ 3D LCD TV LC-60LE835U LCD Flat Panel TVs…


Flexees Women's Instant Slimmer Lace Trim Body Briefer #5356


Flexees Women’s Instant Slimmer Lace Trim Body Briefer #5356


$55.00


You will be in good shape once you get your hands on our Flexees® Ultimate Slimmer Body Briefer with Lace!      Offers maximum controlAll over control and supportLace adds a touch of femininitySlims and flattens the tummyTake inches off instantlyProvides full coverage in rearUltra firm controlFabric Content: Front & Back panel: 65% Nylon, 35% ElastaneFront Panel: 88% Nylon, 12% ElastaneInner…

Maidenform Lilyette® Absolute Solution Lightly Lined Bra


Maidenform Lilyette® Absolute Solution Lightly Lined Bra


$34.00


Lilyette® has designed a bra that delivers the absolute solution for a full figure woman into one pad!  Our Lilyette® Absolute Solution Lightly Lined Bra is the single bra that will supply you with modesty, lift, and shape!3 section cup each with a different benefit: Lift, Modesty and ShapingOffers full supportSoft fabricationPads are designed to leave you feeling confident and comfortableDeliv…

Maidenform Women's One Fabulous Fit T-Shirt Bra


Maidenform Women’s One Fabulous Fit T-Shirt Bra


$32.00


America’s #1 T-Shirt Bra! Our Maidenform® One Fabulous Fit® Tailored Demi Bra is your perfect everyday bra!    Supports up, down, and across the bust providing seamless uplift shaping     Soft and smooth feel     Disappears under clothesLow plunge that’s perfect under all types of clothingFabric Content Molded Cups: 83% Nylon, 17% ElastaneExclusive of decorationImported…

Alex Color A Flower Bag


Alex Color A Flower Bag


$20.86


Dazzling flowers| This fashionable bag measures 14?W x 11?H x 4?D – big enough for school books and binders. Includes 6 permanent markers in a cool pouch that can be colored, too|…

Green Toys Sand Play Set


Green Toys Sand Play Set


$11.00


Kids will ‘dig’ building castles and hunting for buried treasure with the environmentally friendly Sand Play Set from Green ToysTM. Made of recycled plastic, this classic 4-piece collection of tools consists of a bucket, sand castle mold, shovel and rake. Made in the U.S.A from recycled plastic milk containers, which helps save energy, reduces landfill waste, and lowers greenhouse gas emissions, a…

Alex Toys Draw like A Pro


Alex Toys Draw like A Pro


$34.00


A fun and easy way to draw…just turn down the lights, switch on the projector, insert a preprinted slide and trace away| Comes with 124 slides, 6 markers, 10 sheets of paper, and a flip book….

KONNET iCrado Original, Stylish Metal Charging Dock / Cradle / Stand for iPhone, iPhone 3G, 3GS and iPod (Black)


KONNET iCrado Original, Stylish Metal Charging Dock / Cradle / Stand for iPhone, iPhone 3G, 3GS and iPod (Black)



The KONNET iCrado is an easy to install cradle for your iPhone or iPod. With its unique distinctive design, it demonstrates the user’s personal style. The front is designed with a wide opening to give users the quick convenience of charging the iPhone or iPod without removing the protective case. The iCrado has a dedicated port to fit the Apple’s 30-pin USB cable to charge and sync the i…



Post a Comment

Your email is never shared. Required fields are marked *

*
*