Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

drawing shapes in applet

Ads

 
 

Share on Google+Share on Google+

manju
drawing shapes in applet
1 Answer(s)      9 years ago
Posted in : Applet
Ads
View Answers

May 31, 2008 at 4:50 PM


Hi manju,

This is cube example

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.applet.Applet;


public class CubeExample extends Applet {
Stroke drawingStroke = new BasicStroke(4);
CubicCurve2D cubic= new CubicCurve2D.Double(40,150, 40, 05, 300, 350, 300, 180);


public void paint (Graphics g){
Graphics2D ga = (Graphics2D)g;
g.setColor (Color.green);
ga.setStroke(drawingStroke);
ga.draw(cubic);

}
}

<HTML>
<BODY>
<div align = "center">
<APPLET CODE = "CubeExample.class" WIDTH = "500" HEIGHT = "400"></APPLET>
</div>
</BODY>
</HTML>


--------------------------------

Square in circle

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.applet.Applet;

public class CircleExample extends Applet {

public void paint (Graphics g){
Graphics2D ga = (Graphics2D)g;
Shape square = new Rectangle2D.Double(100, 100,50, 50);
g.setColor (Color.red);
g.fillOval (100,100,50,50);
ga.draw(square);

}
}

<HTML>
<BODY>
<div align = "center">
<APPLET CODE = "CircleExample.class" WIDTH = "500" HEIGHT = "400"></APPLET>
</div>
</BODY>
</HTML>

---------------------------------------------------

Read for more information.

http://www.roseindia.net/java/

Ads









Related Tutorials/Questions & Answers:
drawing shapes in applet - Applet
drawing shapes in applet  hi, i need a single applet prgm which... java.applet.Applet; public class CubeExample extends Applet { Stroke... Applet { public void paint (Graphics g){ Graphics2D ga = (Graphics2D)g
An Applet program for Drawing picture & graph - Applet
An Applet program for Drawing picture & graph  How can I write an Applet program for drawing picture and graph having various colours and tools provided
Advertisements
Write a Java applet to draw cylinder and pentagon shapes.
Write a Java applet to draw cylinder and pentagon shapes.  Write a Java applet to draw cylinder and pentagon shapes
Applet program for drawing picture and graph - Applet
Applet program for drawing picture and graph  Please send me the program(code) of drawing picture and graph in Applet.  Hi Friend.../applet/ http://www.roseindia.net/tutorial/java/swing/createHumanFace.html Hope
Java - Drawing Shapes Example in java
Java - Drawing Shapes Example in java       Introduction Applet is a program to run... but it is a network level program. The Applet class is a super class 
Java - Drawing Shapes Example using color in java
Java - Drawing Shapes Example using color in java  ... will show you how to draw the different types of colorful shapes. This example show the different types of colorful shapes like line, circle and the rectangle. It also
display shapes
display shapes  Hi, I would like to see geometric shapes like square, triangle, circle, rectangle as my outputs. Also, those figures shouldn't overlap while they get displayed. Please help me
Applet
Applet  Write an applet to display a string in an applet. String should be passed as a parameter to an applet
applet
applet  What is the immediate superclass of the Applet class
Applet
Applet  how to run an applet on a web browser
applet
applet  Explain different stages in the lifecycle of an applet with figure.   Stages of Applet: Life cycle of an Applet: init(): This method is called to initialized an applet start(): This method is called after
Applet
Applet  Give the class hierarchy of an Applet class
Applet
Applet  Write a ava applet that sets blue color foreground and yellow color background at the start of an applet
java program of different shapes
java program of different shapes  pls help me to get the code of a java program of different shapes using menu
Applet
Applet  Explain the start() and stop() methods of applet life cycle.   Start and Start method of Applet Life Cycle Start () method: The start method of an applet is called after the initialization method init
Applet
Applet  Write a short note on applet life cycle
Applet
Applet  I have a java applet that has a button. On clicking the button it should disappear and another applet should appear. How to write this code???? Also in login applet after successful login it should display admin applet
Java Shapes Bouncing App
Java Shapes Bouncing App  hi guys, im trying to implement... JApplet and contains a panel where * shapes move around on the screen. Also... main(String[] args) { A1 applet = new A1(); JFrame frame = new
Applet
Applet  Draw the class hierarchy of an Applet class. Also explain how to set background and forground colors in java
applet
applet  what is applet in java   An applet is a small program that can be sent along with a Web page to a user. Java applets can perform... the following link: Applet Tutorials
Applet
Applet  Write a Java applet that drwas a line between 2 points. The co-ordinates of 2 points should be passed as parametrs from html file. The color of the line should be red
applet
applet  applet to open new tab not working.here's my code import java.applet.*; import java.awt.*; import java.net.*; import java.awt.event.*; public class NewURL extends Applet implements ActionListener{ public void init
How many types of drawing objects are available in drawing toolbar
How many types of drawing objects are available in drawing toolbar  How many types of drawing objects are available in drawing toolbar
applet printing
applet printing  i am making a frame in which i am calling three applets gridwise and in each applet i am drawing some graph so while printing whole frame i am able to print all 3 applets together on one page but in each applet i
Java code - Applet
Java code  I want java applet code for drawing an indian flag
applet - Applet
.  Hi Friend, Try the following code: 1)Create an applet... extends Applet{ public void paint(Graphics g){ g.drawString("Welcome in Java Applet.",40,20); } } 2) Call this applet with html code
What is Applet? - Applet
What is Applet?  What is Applet?  Hi,Here is a little information about Applet.An applet is a little application. Prior to the World Wide Web, the built-in writing and drawing programs that came with Windows were
Applet - Applet
Applet  what is the concept of applet? what is different between the applet concept and HTML? what is mean by swing?  Hi friend, Applet Applet is java program that can be embedded into HTML pages. Java applets
Drawing Graphs - Swing AWT
Drawing Graphs  hi i am doing a small project in java swings . there is a database table having two columns A,B i want to plot a graph to that values in database the graph must be interactive graph
Drawing with Color in Java
class is used to drawing different-different type of shapes). This method draws... Drawing with Color in Java       In this section, you will see how to draw colorful shapes in java