programs

programs

View Answers

September 21, 2008 at 7:48 PM


You clarify which techlogy we want?
Applet swing or java2d

use this other wise specify technologies


import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
public class DrawCircle extends Applet {

public void paint(Graphics g){
g.setColor(Color.red);
g.fillOval(50, 120, 50, 50);
}
}

Thanks
Rajanikant

September 21, 2008 at 8:21 PM

You can use this also

This program based on Java2D

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;

import javax.swing.JApplet;
public class DrawCircle extends JApplet {
final static BasicStroke stroke = new BasicStroke(2.0f);
public void paint(Graphics g){
setBackground(Color.lightGray);
Graphics2D g2 = (Graphics2D)g;
g2.setPaint(Color.yellow);
g2.setStroke(stroke);
g2.fill(new Ellipse2D.Double(50,50,80,80));
}
}

Thanks
Rajanikant

September 22, 2008 at 11:39 AM

Hi,


import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;

public class CircleTest extends JApplet
implements ActionListener {
JPanel InputPanel;
JLabel Tag;
JTextField field;
CircleCanvas Drawing;

public CircleTest() {
LayoutManager Layout;
Container Pane;

Layout = new FlowLayout ();
InputPanel = new JPanel ();
Tag = new JLabel ();
field = new JTextField ();
Drawing = new CircleCanvas ();
Pane = getContentPane ();

InputPanel.setLayout (Layout);
Tag.setText ("Diameter ");
Tag.setHorizontalAlignment (JLabel.RIGHT);
field.setColumns (8);
field.setText("10");
field.setHorizontalAlignment (JTextField.RIGHT);
field.addActionListener (this);
InputPanel.add(Tag);
InputPanel.add(field);
Pane.add (InputPanel, BorderLayout.NORTH);
Pane.add (Drawing, BorderLayout.CENTER);
}

public void actionPerformed (ActionEvent e) {
int Diameter;
String Text;

Text = field.getText();
Diameter = Integer.parseInt(Text);
Drawing.setDiameter(Diameter);
Drawing.repaint();
}
}

class CircleCanvas extends Canvas {
int Diameter;

public CircleCanvas () {
setBackground (Color.pink);
}

public void setDiameter(int Value) {
Diameter = Value;
repaint ();
}

public void paint (Graphics g) {
Graphics2D g2;
Ellipse2D Circle;
int Width;
int Height;
g2 = (Graphics2D) g;
g2.setColor (Color.red);
Width = getWidth ();
Height = getHeight ();
Circle = new Ellipse2D.Double
((double) ((Width - Diameter) / 2),
(double) ((Height - Diameter) / 2),
(double) Diameter, (double)Diameter);
g2.fill (Circle);
}

}

September 22, 2008 at 11:42 AM

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

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

Visit for more information :

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


Thanks

Amardeep









Related Tutorials/Questions & Answers:
programs
programs  give some programs on control statementds
Programs in java
Programs in java  Hi, What are the best programs in java for a beginner? Thanks
Advertisements
php programs
php programs  10 programs on varibles
java programs
java programs  Why word "static" is used in java programs
Java Programs
Java Programs  Hi, What is Java Programs? How to develop application for business in Java technology? Is there any tool to help Java programmer in development of Java Programs? Thanks
php programs
php programs  I need 15 programs on arithmetic operators with comments. Please help me
java programs
java programs  Explain types of Java programs. Also explain how to compile and run them.   Types of Java Programs: Standalone Applications Web Applications Enterprise Applications Console Application Web services
programs in java
programs in java  . I need an application for managing an educational institute. That application should provide the details of Students Courses Faculty Fee details etc.., pl z guide me how to write these programe
java programs
java programs  i need help in understanding the whole concept of the 13 java programs that i hav...here r de programs.. int i,j,m,n; m=Integer.parseInt(args [0]); n=Integer.parseInt(args [1]); System.out.print
programs
programs
c++ programs
c++ programs  i want the syntax for the following programs according to c++ pattern. 1.sum of multiples of an integer upto 10 2.2/4+4/6+6/8+8/10+.....n/n+2 3.1!/1+2!/2+3!/3+4!/4+...n!/n i just want the main logic as i m nt
java programs
java programs  A union B, transpose of matric, denomination of a given number i need java programs for this category?   Hi Friend, Transpose of matrix: import java.util.*; public class Transpose { public
JSF Sample Programs
JSF Sample Programs  I need a JSF sample programs
how to execuite java programs???
how to execuite java programs???  I have jdk 1.6 installed in my pc.i want to execuite java programs in ms-dos for applet and without using applet.please tell me
how to execuite java programs???
how to execuite java programs???  I have jdk 1.6 installed in my pc.i want to execuite java programs in ms-dos for applet and without using applet.please tell me
Explain types of java programs
Explain types of java programs  Explain types of java programs   Types of Java Programs: Standalone Applications Web Applications Enterprise Applications Console Application Web services
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
Installing programs over a network
Installing programs over a network  Hi, i want to write a java program that will allow me to install programs from a server to a client machine. Any help will be appreciated. Thanks
RUNNING EJB PROGRAMS
RUNNING EJB PROGRAMS  how to run ejb programs using weblogic in windowsxp
how to compile programs??????????
how to compile programs??????????  "javac" is not recognised as a file name. why??????????   Have you set your path name and class name correctly? Anyways have a look at the following link: Install Java
advantage of stored programs
advantage of stored programs  Which of the following is an advantage of stored programs? a) Reliability b)Reduction in operation costs c) The computers becoming general purpose D) All of the above E) None of these  
user define exception programs
user define exception programs  user define exception programs   Please visit the following links: http://www.roseindia.net/java/java-exception/user-defined-exception.shtml http://www.roseindia.net/java/exceptions
j2ee example programs
j2ee example programs   can any one tell me how to develop and execute ---------- j2ee entity beans (cmp,bmp) example,message driven bean example ,webservices example in weblogic server with (netbeans or eclipse
data science programs ranking
data science programs ranking  Hi, I am beginner in Data Science... science programs ranking Try to provide me good examples or tutorials links so that I can learn the topic "data science programs ranking". Also tell me
masters programs for data science
masters programs for data science  Hi, I am beginner in Data Science...: masters programs for data science Try to provide me good examples or tutorials links so that I can learn the topic "masters programs for data science"
phd programs in artificial intelligence
phd programs in artificial intelligence  Hi, I am beginner in Data...: phd programs in artificial intelligence Try to provide me good examples or tutorials links so that I can learn the topic "phd programs in artificial
masters programs in artificial intelligence
masters programs in artificial intelligence  Hi, I am beginner... to learn: masters programs in artificial intelligence Try to provide me good examples or tutorials links so that I can learn the topic "masters programs
machine learning programs in python
machine learning programs in python  Hi, I am beginner in Data...: machine learning programs in python Try to provide me good examples or tutorials links so that I can learn the topic "machine learning programs
15 Php programs on logical operators
15 Php programs on logical operators  I need 15 example programs for logical operators. Please help me out
Java programs - Java Beginners
Java programs  Hello Please write the following programs for me using GUI.Thanks You. 1. Write a java program that reads the first name, last name, hours worked and hourly rate for an employee. Then print the name
ModuleNotFoundError: No module named 'programs-integrator'
ModuleNotFoundError: No module named 'programs-integrator'  Hi, My... named 'programs-integrator' How to remove the ModuleNotFoundError: No module named 'programs-integrator' error? Thanks   Hi
data science masters programs
data science masters programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science masters programs Try to provide me good examples or tutorials links so
top data science programs
top data science programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: top data science programs Try to provide me good examples or tutorials links so that I can
data analytics masters programs
data analytics masters programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data analytics masters programs Try to provide me good examples or tutorials links so
online data science programs
online data science programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: online data science programs Try to provide me good examples or tutorials links so that I
big data programs
big data programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: big data programs Try to provide me good examples or tutorials links so that I can learn the topic
data science undergraduate programs
data science undergraduate programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science undergraduate programs Try to provide me good examples or tutorials
analytics masters programs
analytics masters programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: analytics masters programs Try to provide me good examples or tutorials links so that I can
big data graduate programs
big data graduate programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: big data graduate programs Try to provide me good examples or tutorials links so that I can
best analytics masters programs
best analytics masters programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: best analytics masters programs Try to provide me good examples or tutorials links so
top analytics masters programs
top analytics masters programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: top analytics masters programs Try to provide me good examples or tutorials links so
accredited data science programs
accredited data science programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: accredited data science programs Try to provide me good examples or tutorials links
data science summer programs
data science summer programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science summer programs Try to provide me good examples or tutorials links so that I
ai certificate programs
ai certificate programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ai certificate programs Try to provide me good examples or tutorials links so that I can learn
best ai phd programs
best ai phd programs  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: best ai phd programs Try to provide me good examples or tutorials links so that I can learn

Ads