Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Applet drawing shapes in applet
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


manju
drawing shapes in applet
1 Answer(s)      6 years and 5 months ago
Posted in : Applet



Advertisement
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/


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
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
Advertisements
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
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
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
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  Write an applet to display a string in an applet. String should be passed as a parameter to an applet
Applet
Applet  Give the class hierarchy of an Applet class
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  how to run an applet on a web browser
applet
applet  What is the immediate superclass of the Applet class
Applet
Applet  Write a ava applet that sets blue color foreground and yellow color background at the start of an applet
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
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
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
Applet
Applet  Write a short note on applet life cycle
Applet
Applet  Draw the class hierarchy of an Applet class. Also explain how to set background and forground colors in java
Finding shapes in digital photos - java
Finding shapes in digital photos - java  Hello, I need some hints/tips regarding some project I'm doing. The project is about finding shapes... this information to separate the main different coloured shapes in the photo
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
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
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
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
Drawing Graphs - Java3D
Drawing Graphs  how to draw graphs using certain parameters  Hi Friend, To draw a graph using JfreeChart library, please visit the following link: http://www.roseindia.net/chartgraphs/index.shtml Here you
scrolling a drawing..... - Swing AWT
scrolling a drawing.....  I am using a canvas along with other components like JTable over a frame the drawing which i am going to show over canvas is dynamic and hence there is no fixed size, that's why i need to make
drawing out of bounds
drawing out of bounds  How to throw an exception when a rectangle goes out of the boundaries of a JFrame. The program is asking to draw a triangle, and resize it. If the triagle size goes out of the JFrame throw an execption. I
How to convert a picture to drawing, convert a picture to drawing, picture to drawing
How to convert a picture to drawing       Learn here a simple processing to make a color picture to drawing, we have tried here to take simple step to learn easily for the beginners
 

 

 

DMCA.com