The document discusses the basics of creating a simple Java applet. It explains that an applet is a Java program that runs within a web browser. To create an applet, you must import the Applet class and extend the Applet class for your own class. The paint method is used to draw graphics and takes a Graphics object as a parameter. Colors, rectangles, and other graphics can be drawn using methods like setColor, fillRect on the Graphics object.
Java Applet Basics, Important points, Life cycle of an applet, AWT, AWT HIERARCHY, Creating Frame by extending Frame class, Creating Frame by creating instance of Frame class, Java Exceptions, Java try and catch, Syntax, Example for try and catch,
This presentation introduces Java Applet and Java Graphics in detail with examples and finally using the concept of both applet and graphics code the analog clock project to depict how to use them in real life challenges and applications.
introduction to Applets, life cycle of applets, methods of applets, examples,embedding apllets in html files, compiling and running of applets with appletviewer
Java Applet Basics, Important points, Life cycle of an applet, AWT, AWT HIERARCHY, Creating Frame by extending Frame class, Creating Frame by creating instance of Frame class, Java Exceptions, Java try and catch, Syntax, Example for try and catch,
This presentation introduces Java Applet and Java Graphics in detail with examples and finally using the concept of both applet and graphics code the analog clock project to depict how to use them in real life challenges and applications.
introduction to Applets, life cycle of applets, methods of applets, examples,embedding apllets in html files, compiling and running of applets with appletviewer
applet,applet life cycle,applet class,applet parameter,creating an executable applet,designing a web page:command section,head section,body section,applet tags,Graphics programming,Drawing polygons,drawing arcs,Drawing lines and rectangles
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
2. 2
Applets and applications
An applet is a Java program that runs on a web page
Applets can be run within any modern browser
To run modern Java applets, old browsers need an up-to-date
Java plugin
appletviewer is a program that can run
An application is a Java program that runs all by itself
3. 3
Packages and classes
Java supplies a huge library of pre-written “code,”
ready for you to use in your programs
Code is organized into classes
Classes are grouped into packages
One way to use this code is to import it
You can import a single class, or all the classes in a
package
4. 4
The Applet class
To create an applet, you must import the Applet class
This class is in the java.applet package
The Applet class contains code that works with a
browser to create a display window
Capitalization matters!
applet and Applet are different names
5. 5
Importing the Applet class
Here is the directive that you need:
import java.applet.Applet;
import is a keyword
java.applet is the name of the package
A dot ( . ) separates the package from the class
Applet is the name of the class
There is a semicolon ( ; ) at the end
6. 6
The java.awt package
“awt” stands for “Abstract Window Toolkit”
The java.awt package includes classes for:
Drawing lines and shapes
Drawing letters
Setting colors
Choosing fonts
If it’s drawn on the screen, then java.awt is
probably involved!
7. 7
Importing the java.awt package
Since you may want to use many classes from the
java.awt package, simply import them all:
import java.awt.*;
The asterisk, or star (*), means “all classes”
The import directives can go in any order, but must be
the first lines in your program
8. 8
C and C++ programmers only
C and C++ have an #include directive that copies a
library function into your program
This makes your program bigger
Java’s import gives you access to the library
It does not make your program bigger
It’s OK to use lots of include directives!
9. 9
The applet so far
import java.applet.Applet;
import java.awt.*;
10. 10
Your applet class
public class Drawing extends Applet {
… }
Drawing is the name of your class
Class names should always be capitalized
extends Applet says that our Drawing is a kind of
Applet, but with added capabilities
Java’s Applet just makes an empty window
We are going to draw in that window
The only way to make an applet is to extend Applet
11. 11
The applet so far
import java.applet.Applet;
import java.awt.*;
// CIT 591 example
public class Drawing extends Applet {
…we still need to put some code in here...
}
12. 12
The paint method
Our applet is going to have a method to paint some
colored rectangles on the screen
This method must be named paint
paint needs to be told where on the screen it can draw
This will be the only parameter it needs
paint doesn’t return any result
13. 13
The paint method, part 2
public void paint(Graphics g) { … }
public says that anyone can use this method
void says that it does not return a result
A Graphics (short for “Graphics context”) is an
object that holds information about a painting
It remembers what color you are using
It remembers what font you are using
You can “paint” on it (but it doesn’t remember what you
have painted)
14. 14
The applet so far
import java.applet.Applet;
import java.awt.*;
// CIT 591 example
public class Drawing extends Applet {
public void paint(Graphics g) {
…we still need to put some code in here…
}
}
15. 15
Colors
The java.awt package defines a class named Color
There are 13 predefined colors—here are their fully-
qualified names:
For compatibility with older programs (before the naming
conventions were established), Java also allows color
names in lowercase: Color.black, Color.darkGray, etc.
Color.BLACK Color.PINK Color.GREEN
Color.DARK_GRAY Color.RED Color.CYAN
Color.GRAY Color.ORANGE Color.BLUE
Color.LIGHT_GRAY Color.YELLOW
Color.WHITE Color.MAGENTA
16. 16
New colors
Every color is a mix of red, green, and blue
You can make your own colors:
new Color( red , green , blue )
Amounts range from 0 to 255
Black is (0, 0, 0), white is (255, 255, 255)
We are mixing lights, not pigments
Yellow is red + green, or (255, 255, 0)
17. 17
Setting a color
To use a color, we tell our Graphics g what color we
want:
g.setColor(Color.RED);
g will remember this color and use it for everything
until we tell it some different color
18. 18
The paint method so far
public void paint(Graphics g) {
g.setColor(Color.BLUE);
…draw a rectangle…
g.setColor(Color.RED);
…draw another rectangle…
}
}
19. 19
Pixels
A pixel is a picture (pix) element
one pixel is one dot on your screen
there are typically 72 to 90 pixels per inch
java.awt measures everything in pixels
20. 20
Java’s coordinate system
Java uses an (x, y) coordinate system
(0, 0) is the top left corner
(50, 0) is 50 pixels to the right of (0, 0)
(0, 20) is 20 pixels down from (0, 0)
(w - 1, h - 1) is just inside the bottom right corner, where w
is the width of the window and h is its height
(0, 0)
(0, 20)
(50, 0)
(50, 20)
(w-1, h-1)
21. 21
Drawing rectangles
There are two ways to draw rectangles:
g.drawRect( left , top , width , height );
g.fillRect(left , top , width , height );
22. 22
The complete applet
import java.applet.Applet;
import java.awt.*;
// CIT 591 example
public class Drawing extends Applet {
public void paint(Graphics g) {
g.setColor(Color.BLUE);
g.fillRect(20, 20, 50, 30);
g.setColor(Color.RED);
g.fillRect(50, 30, 50, 30);
}
}
23. 23
Some more java.awt methods
g.drawLine( x1 , y1 , x2 , y2 );
g.drawOval( left , top , width , height );
g.fillOval( left , top , width , height );
g.drawRoundRect( left , top , width , height );
g.fillRoundRect( left , top , width , height );
g.drawArc( left , top , width , height ,
startAngle , arcAngle );
g.drawString( string , x , y );
24. 24
The HTML page
You can only run an applet in an HTML page
The HTML looks something like this:
<html>
<body>
<h1>DrawingApplet Applet</h1>
<applet code="DrawingApplet.class"
width="250" height="200">
</applet>
</body>
</html>
BlueJ will create this HTML for you