1. The document discusses Java applets and compares them to standalone Java applications. It explains that applets differ in that they do not contain a main() function and instead execute within a web page, while standalone applications contain a main() function and are run using the java interpreter.
2. The key steps for running an applet are: compiling the applet code to generate a class file, creating an HTML file containing the <applet> tag to embed the class file, and testing the HTML file in a web browser or using the appletviewer tool.
3. The lifecycle of an applet involves init(), start(), paint(), stop(), and destroy() methods that control when the applet is
The document discusses applets and Swing components in Java. It begins with pre-assessment questions to test the reader's knowledge of exceptions, error classes, and try/catch blocks. It then provides solutions to the questions. The document outlines how to create applets in Java using the Applet class and various graphic methods. It also describes the different stages of an applet lifecycle, including initializing, starting, stopping, and destroying an applet. Finally, it discusses using layout managers and creating Swing components.
This document contains notes on Java basics from James Tam. It introduces Java programming concepts like input, output, branching, and looping. It also discusses the history of Java's development at Sun Microsystems and how it enables programs to run on different platforms. Finally, it provides an overview of compiling and running a simple Java program from the command line.
This document provides information about a Java training module offered by Aims Tutorial, including their contact information, address, and an introduction to Java. It discusses Java's history and features such as being object-oriented, platform independent, simple, secure, architecturally neutral, portable, robust, multi-threaded, dynamic, and high performance. It also covers types of Java applications, different Java technology editions, and compares Java to C++.
Introduction to Java Programming, Basic Structure, variables Data type, input...Mr. Akaash
This is First Lecture of java Programming which cover all basic points (ie. History and feature of java, Introduction to java, about variables data type and compilation....
This document provides an overview of the Java programming language and environment. It discusses that Java is both a programming language and platform, and describes some of Java's key characteristics like being object-oriented, platform independent, secure, robust and high performance. It also outlines the different types of applications that can be created in Java, such as standalone, web, enterprise and mobile applications. The document concludes by explaining the basic steps to compile and run a simple Java program, and some modifications that can be made to the main method.
The document provides an overview of advance Java topics including collections, multithreading, networking, AWT, Swing, JDBC, JSP, and applets. It discusses key aspects of each topic such as the collection framework providing interfaces and classes for storing and manipulating groups of data, multithreading allowing programs to perform multiple tasks simultaneously, and JDBC enabling connection between Java applications and databases. Code examples are also included to demonstrate concepts like a basic Swing program and a simple applet.
This document provides an overview of a presentation on Java fundamentals by Kunal V. Gadhi. It covers topics such as the history and features of Java, object-oriented programming concepts, Java applications and applets, multithreading, input/output and networking, MySQL, and JDBC. The document includes sections on each topic with descriptions of key concepts and code examples.
The document discusses applets and Swing components in Java. It begins with pre-assessment questions to test the reader's knowledge of exceptions, error classes, and try/catch blocks. It then provides solutions to the questions. The document outlines how to create applets in Java using the Applet class and various graphic methods. It also describes the different stages of an applet lifecycle, including initializing, starting, stopping, and destroying an applet. Finally, it discusses using layout managers and creating Swing components.
This document contains notes on Java basics from James Tam. It introduces Java programming concepts like input, output, branching, and looping. It also discusses the history of Java's development at Sun Microsystems and how it enables programs to run on different platforms. Finally, it provides an overview of compiling and running a simple Java program from the command line.
This document provides information about a Java training module offered by Aims Tutorial, including their contact information, address, and an introduction to Java. It discusses Java's history and features such as being object-oriented, platform independent, simple, secure, architecturally neutral, portable, robust, multi-threaded, dynamic, and high performance. It also covers types of Java applications, different Java technology editions, and compares Java to C++.
Introduction to Java Programming, Basic Structure, variables Data type, input...Mr. Akaash
This is First Lecture of java Programming which cover all basic points (ie. History and feature of java, Introduction to java, about variables data type and compilation....
This document provides an overview of the Java programming language and environment. It discusses that Java is both a programming language and platform, and describes some of Java's key characteristics like being object-oriented, platform independent, secure, robust and high performance. It also outlines the different types of applications that can be created in Java, such as standalone, web, enterprise and mobile applications. The document concludes by explaining the basic steps to compile and run a simple Java program, and some modifications that can be made to the main method.
The document provides an overview of advance Java topics including collections, multithreading, networking, AWT, Swing, JDBC, JSP, and applets. It discusses key aspects of each topic such as the collection framework providing interfaces and classes for storing and manipulating groups of data, multithreading allowing programs to perform multiple tasks simultaneously, and JDBC enabling connection between Java applications and databases. Code examples are also included to demonstrate concepts like a basic Swing program and a simple applet.
This document provides an overview of a presentation on Java fundamentals by Kunal V. Gadhi. It covers topics such as the history and features of Java, object-oriented programming concepts, Java applications and applets, multithreading, input/output and networking, MySQL, and JDBC. The document includes sections on each topic with descriptions of key concepts and code examples.
This document provides a history and overview of the Java programming language. It discusses:
1. James Gosling developed Java in 1991 at Sun Microsystems. The first public release was in 1995. Java is an object-oriented language similar to C and C++ but without pointers.
2. Java is widely used for desktop applications, web applications, mobile apps, embedded systems, smart cards, robotics, and games. It is popular due to being platform-independent, distributed, secure, robust, high-performance, and multithreaded.
3. The document provides examples of Java code, including "Hello World" and code demonstrating if/else statements, for loops, methods, and classes.
This document provides an overview of key concepts in the Java programming language including classes, objects, inheritance, interfaces, packages, exceptions, threads, and more. It discusses how to build standalone Java programs and applets, and covers basic syntax and structures like primitive data types, expressions, control statements, and comments. Methods, constructors, and access modifiers are also explained at a high level.
Java can be used two types of programs: applications & applets.An application is a program that runs on your computer, under the operating system of that computer.
An applets is an application designed to be transmitted over the Internet and executed by a java-compatible Web Browser. An applet is an executable program that runs inside a browser, such as Netscape or Internet Explorer.
Java is a programming language that is simple, object-oriented, and robust. It allows programs to be portable across platforms and provides automatic memory management through garbage collection. Key features of Java include its platform independence through bytecode, its object-oriented approach, networking capabilities, security features, performance through just-in-time compilation, and support for multithreading. Java code is compiled to bytecode that can run on any Java Virtual Machine, making programs highly portable.
This document provides an introduction to Java programming, covering topics such as its origins, key features like being simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, and dynamic. It also discusses how to program in Java, including the Java platform which consists of the Java Virtual Machine and Java Application Programming Interface, and different types of programs like applets, applications, and servlets.
This document provides an introduction to Java applications and applets. It discusses that Java can be used to develop both standalone applications and programs designed to run in web browsers (applets). It then covers the history and development of Java, the basic characteristics and components of Java programs, and how to create a simple Java application with classes, methods, and a main method. It also introduces applets, describing them as Java programs embedded in web pages, and covers some key applet methods like init() and paint(). Finally, it provides an example of a basic applet class that draws shapes and text and the HTML required to embed an applet in a web page.
The document discusses Java Beans, Applets, JDBC, Networking in Java, JNDI, and some key classes used in these technologies. It provides an overview of concepts like Java Beans components, properties, events, introspection, customization, persistence. It describes the lifecycle and methods of Applets. It outlines the basic steps to use JDBC like loading drivers, establishing connections, executing queries. It discusses connection-oriented and connectionless networking in Java and common network classes like Socket, ServerSocket, URL, URLConnection. It provides a high-level overview of the JNDI architecture.
This document provides an overview of using the UICatalog sample code to learn about the user interface components available in UIKit. It discusses downloading and running the UICatalog sample, and how to capture screenshots of the user interface elements to create mockups and prototypes. It also includes background information on Objective-C, UIKit, the model-view-controller (MVC) pattern, and the basic structure of an iOS application.
This document provides an introduction and overview of the Java programming language, including its history, features, and components. It discusses how Java was developed in 1995 at Sun Microsystems and introduced as a platform-independent language for general business applications and web-based internet applications. It also summarizes Java's key features like being object-oriented, compiled and interpreted, and portable, as well as its core architecture components like the Java programming language, Java Virtual Machine, and Java API.
This document provides an overview of Java including its origins from C and C++, how it achieves platform independence through bytecode compilation, and key features such as being object-oriented, garbage collected, robust, secure, extensible, and well-understood. It also discusses object-oriented programming concepts in Java like encapsulation, polymorphism through method overloading and overriding, and the importance of Java for internet applications like applets.
The document discusses key features of the Java programming language. It notes that Java is platform-neutral, meaning Java programs can be executed on any system without being tied to a particular hardware or operating system. It also mentions that Java is compiled and interpreted, object-oriented, multi-threaded, and has features like garbage collection. The document then provides an overview of the Java development environment and tools used like the Java Development Kit.
Java is a widely used programming language that is mainly used for application programming. It is platform-independent and supports features like multi-threading and documentation comments. The key aspects of a simple Java program are that it must contain a class with a main method that can be the starting point of execution. The main method has a specific signature of public static void main(String[] args). When a Java program is run, the JVM (Java Virtual Machine) loads and executes the program by performing operations like loading code, verifying code, and providing a runtime environment.
The document provides an introduction to the Java programming language. It discusses that Java was originally called Oak and developed by Sun Microsystems in 1991. It can be used to create both applications and applets. The source code is compiled into bytecode, which is then interpreted by the Java Virtual Machine (JVM) to execute programs. Key features of Java include being simple, secure, portable, object-oriented, robust, and multi-threaded. The document also covers concepts such as packages, interfaces, inheritance, method overloading/overriding, and multithreading.
This document provides an overview of the topics covered in a Core Java online training course. The course consists of 12 modules that cover Java fundamentals, OOP concepts, collections, files and I/O, threads, exceptions, JDBC and more. Each module includes topics to be covered and programming sessions to apply the concepts learned through examples and exercises.
This document provides an overview of Java basics, including:
- Java programs are portable across operating systems due to use of byte code, a standardized class library, and language specification.
- Java is secure through features like no pointer arithmetic, garbage collection, and restrictions on applets.
- Java is robust with features like bounds checking and garbage collection that prevent crashes.
- Java programs are either standalone applications or applets that run in a web browser.
- The Java compiler translates source code to byte code, which is then interpreted at runtime.
ABOUT CORE JAVA COURSE SCOPE:
JAVA based business programs perform well because constant JAVA requirements help designers to create multilevel programs with a component centered approach.
JAVA growth allows secure and top rated application growth on several systems. Many companies in India have well-qualified application technicians having skills in Java, J2EE, JSP, and J2ME, JAVA Programming Solutions help your businesses to do better. Many companies recruit fresh candidates as trainees in CORE JAVA and later on student’s knowledge will be enhanced.
PROGRAM EDGES:
Our training segments are completely designed according to current IT market.
Student will go through the coaching of OOPs concept and DBMS, RDBMS ideas as free of charge package before starting of Java Training.
We offer regular, speed up and end of the week coaching in Java training.
Our major concern is to offer java technology coaching to you so that you can be wiser and create effective programs and programs more quickly using any system – such as Oracle’s program server and web facilities software.
After finishing java training, students can easily create and set up your own real-time java program.
Study material is provided with the course which includes ideas, illustrations and real-time illustrations.
1. The document describes how to run a Java program without an IDE by compiling and executing a simple "Hello World" program from the command line.
2. It involves creating a Java file in a folder, setting the classpath to include the Java JDK bin directory, compiling the Java file with javac, and running the main method with java.
3. The document then explains how the Java Virtual Machine loads and executes the bytecode, including details on class loading, linking, and initialization.
This Contains Core Java Java Basic Notes With Examples Following Are the topics I have Included in this
1. Source Code
2. Byte Code
3. Native Code
4. Compiler
5. Interpreter
6. JIT Compiler (Just In Time Compiler)
7. JVM (Java Virtual Machine)
8. JRE (Java Runtime Environment)
9. JDK (Java Development Kit)
Java Language:-
1. Character Set
2. Data Types
3. Keywords
4. Identifiers or User Defined words
5. Variables
6. Constants
7. Literals
8. Control Statement
9. Operator
10. Array
The document provides an overview of object oriented programming with Java. It discusses the differences between C++ and Java, the fundamentals of Java programming, and tools available for Java development. Key points include:
- Java is best suited for internet applications while C++ is better for large software.
- Java supports interfaces, packages, and other features not in C++.
- The Java Development Kit (JDK) contains compilers and other tools for creating Java programs.
- Java applications are standalone programs while applets are embedded in web pages.
This document provides a history and overview of the Java programming language. It discusses:
1. James Gosling developed Java in 1991 at Sun Microsystems. The first public release was in 1995. Java is an object-oriented language similar to C and C++ but without pointers.
2. Java is widely used for desktop applications, web applications, mobile apps, embedded systems, smart cards, robotics, and games. It is popular due to being platform-independent, distributed, secure, robust, high-performance, and multithreaded.
3. The document provides examples of Java code, including "Hello World" and code demonstrating if/else statements, for loops, methods, and classes.
This document provides an overview of key concepts in the Java programming language including classes, objects, inheritance, interfaces, packages, exceptions, threads, and more. It discusses how to build standalone Java programs and applets, and covers basic syntax and structures like primitive data types, expressions, control statements, and comments. Methods, constructors, and access modifiers are also explained at a high level.
Java can be used two types of programs: applications & applets.An application is a program that runs on your computer, under the operating system of that computer.
An applets is an application designed to be transmitted over the Internet and executed by a java-compatible Web Browser. An applet is an executable program that runs inside a browser, such as Netscape or Internet Explorer.
Java is a programming language that is simple, object-oriented, and robust. It allows programs to be portable across platforms and provides automatic memory management through garbage collection. Key features of Java include its platform independence through bytecode, its object-oriented approach, networking capabilities, security features, performance through just-in-time compilation, and support for multithreading. Java code is compiled to bytecode that can run on any Java Virtual Machine, making programs highly portable.
This document provides an introduction to Java programming, covering topics such as its origins, key features like being simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, and dynamic. It also discusses how to program in Java, including the Java platform which consists of the Java Virtual Machine and Java Application Programming Interface, and different types of programs like applets, applications, and servlets.
This document provides an introduction to Java applications and applets. It discusses that Java can be used to develop both standalone applications and programs designed to run in web browsers (applets). It then covers the history and development of Java, the basic characteristics and components of Java programs, and how to create a simple Java application with classes, methods, and a main method. It also introduces applets, describing them as Java programs embedded in web pages, and covers some key applet methods like init() and paint(). Finally, it provides an example of a basic applet class that draws shapes and text and the HTML required to embed an applet in a web page.
The document discusses Java Beans, Applets, JDBC, Networking in Java, JNDI, and some key classes used in these technologies. It provides an overview of concepts like Java Beans components, properties, events, introspection, customization, persistence. It describes the lifecycle and methods of Applets. It outlines the basic steps to use JDBC like loading drivers, establishing connections, executing queries. It discusses connection-oriented and connectionless networking in Java and common network classes like Socket, ServerSocket, URL, URLConnection. It provides a high-level overview of the JNDI architecture.
This document provides an overview of using the UICatalog sample code to learn about the user interface components available in UIKit. It discusses downloading and running the UICatalog sample, and how to capture screenshots of the user interface elements to create mockups and prototypes. It also includes background information on Objective-C, UIKit, the model-view-controller (MVC) pattern, and the basic structure of an iOS application.
This document provides an introduction and overview of the Java programming language, including its history, features, and components. It discusses how Java was developed in 1995 at Sun Microsystems and introduced as a platform-independent language for general business applications and web-based internet applications. It also summarizes Java's key features like being object-oriented, compiled and interpreted, and portable, as well as its core architecture components like the Java programming language, Java Virtual Machine, and Java API.
This document provides an overview of Java including its origins from C and C++, how it achieves platform independence through bytecode compilation, and key features such as being object-oriented, garbage collected, robust, secure, extensible, and well-understood. It also discusses object-oriented programming concepts in Java like encapsulation, polymorphism through method overloading and overriding, and the importance of Java for internet applications like applets.
The document discusses key features of the Java programming language. It notes that Java is platform-neutral, meaning Java programs can be executed on any system without being tied to a particular hardware or operating system. It also mentions that Java is compiled and interpreted, object-oriented, multi-threaded, and has features like garbage collection. The document then provides an overview of the Java development environment and tools used like the Java Development Kit.
Java is a widely used programming language that is mainly used for application programming. It is platform-independent and supports features like multi-threading and documentation comments. The key aspects of a simple Java program are that it must contain a class with a main method that can be the starting point of execution. The main method has a specific signature of public static void main(String[] args). When a Java program is run, the JVM (Java Virtual Machine) loads and executes the program by performing operations like loading code, verifying code, and providing a runtime environment.
The document provides an introduction to the Java programming language. It discusses that Java was originally called Oak and developed by Sun Microsystems in 1991. It can be used to create both applications and applets. The source code is compiled into bytecode, which is then interpreted by the Java Virtual Machine (JVM) to execute programs. Key features of Java include being simple, secure, portable, object-oriented, robust, and multi-threaded. The document also covers concepts such as packages, interfaces, inheritance, method overloading/overriding, and multithreading.
This document provides an overview of the topics covered in a Core Java online training course. The course consists of 12 modules that cover Java fundamentals, OOP concepts, collections, files and I/O, threads, exceptions, JDBC and more. Each module includes topics to be covered and programming sessions to apply the concepts learned through examples and exercises.
This document provides an overview of Java basics, including:
- Java programs are portable across operating systems due to use of byte code, a standardized class library, and language specification.
- Java is secure through features like no pointer arithmetic, garbage collection, and restrictions on applets.
- Java is robust with features like bounds checking and garbage collection that prevent crashes.
- Java programs are either standalone applications or applets that run in a web browser.
- The Java compiler translates source code to byte code, which is then interpreted at runtime.
ABOUT CORE JAVA COURSE SCOPE:
JAVA based business programs perform well because constant JAVA requirements help designers to create multilevel programs with a component centered approach.
JAVA growth allows secure and top rated application growth on several systems. Many companies in India have well-qualified application technicians having skills in Java, J2EE, JSP, and J2ME, JAVA Programming Solutions help your businesses to do better. Many companies recruit fresh candidates as trainees in CORE JAVA and later on student’s knowledge will be enhanced.
PROGRAM EDGES:
Our training segments are completely designed according to current IT market.
Student will go through the coaching of OOPs concept and DBMS, RDBMS ideas as free of charge package before starting of Java Training.
We offer regular, speed up and end of the week coaching in Java training.
Our major concern is to offer java technology coaching to you so that you can be wiser and create effective programs and programs more quickly using any system – such as Oracle’s program server and web facilities software.
After finishing java training, students can easily create and set up your own real-time java program.
Study material is provided with the course which includes ideas, illustrations and real-time illustrations.
1. The document describes how to run a Java program without an IDE by compiling and executing a simple "Hello World" program from the command line.
2. It involves creating a Java file in a folder, setting the classpath to include the Java JDK bin directory, compiling the Java file with javac, and running the main method with java.
3. The document then explains how the Java Virtual Machine loads and executes the bytecode, including details on class loading, linking, and initialization.
This Contains Core Java Java Basic Notes With Examples Following Are the topics I have Included in this
1. Source Code
2. Byte Code
3. Native Code
4. Compiler
5. Interpreter
6. JIT Compiler (Just In Time Compiler)
7. JVM (Java Virtual Machine)
8. JRE (Java Runtime Environment)
9. JDK (Java Development Kit)
Java Language:-
1. Character Set
2. Data Types
3. Keywords
4. Identifiers or User Defined words
5. Variables
6. Constants
7. Literals
8. Control Statement
9. Operator
10. Array
The document provides an overview of object oriented programming with Java. It discusses the differences between C++ and Java, the fundamentals of Java programming, and tools available for Java development. Key points include:
- Java is best suited for internet applications while C++ is better for large software.
- Java supports interfaces, packages, and other features not in C++.
- The Java Development Kit (JDK) contains compilers and other tools for creating Java programs.
- Java applications are standalone programs while applets are embedded in web pages.
This document provides an overview of Module 02 - Basic Java Programming which covers basic Java programming concepts such as variables, data types, operators, classes, objects, and methods. It also discusses compiling and running Java applications from the command line and with an IDE. Hands-on labs are included to build a simple Java application with JDeveloper IDE, create a JAR file, and use JConsole to monitor a Java application.
1. The document provides step-by-step instructions for writing a simple Java program using Notepad to print the sentence "This is a simple Java program". It describes installing the Java Development Kit (JDK), setting the PATH variable, creating a class called MyJavaProgram with a main method, writing the print statement, saving and compiling the file using javac, and running the program using java.
2. The key steps are to install the JDK, set the PATH variable, create a public class with a public static void main method, write a System.out.println statement to print the sentence, save and compile the file with javac, and run the program with java.
3.
This document provides an overview of Java including its history, versions, key features, and basic programming concepts. It describes how Java was originally called Oak and later renamed to Java in 1995. It also lists the main Java versions from 1995 to 2011. Additionally, it defines Java as a platform independent language and outlines some of its common uses. The document proceeds to explain Java's main features such as being simple, object-oriented, platform independent, secure, portable, dynamic, high performance, and multithreaded. It also includes examples of a simple Java program, variables, and packages.
This document provides information on performing object-oriented analysis and design in Java technology. It outlines the basics of the Java language that should be applied, including creating executable applications, using packages, data types, operators, decision constructs, arrays, and loop constructs. It also describes the learning outcomes, methodology, and assessment approach for this competency.
This document provides an overview of Java basics, including:
- Java programs are portable across operating systems due to features like the Java language specification, portable class library, and use of bytecode instead of machine code.
- Java is secure due to lack of pointer arithmetic, garbage collection, bounds checking, and restrictions on applets.
- Java is robust with features that avoid crashes like bounds checking and exceptions.
- Java programs come in the form of standalone applications or applets, with differences in file I/O restrictions and need to handle browser lifecycle methods.
- The Java compiler produces bytecode files that are dynamically linked and executed by the Java runtime on any platform.
This document provides an overview of Java basics, including:
- Java programs are portable across operating systems due to features like the Java language specification, portable class library, and use of bytecode instead of machine code.
- Java is secure due to lack of pointer arithmetic, garbage collection, bounds checking, and restrictions on applets.
- Java is robust with features that avoid crashes like bounds checking and exceptions.
- Java programs come in the form of standalone applications or applets, with differences in file I/O restrictions and need to handle browser lifecycle methods.
- The Java compiler produces bytecode files that are dynamically loaded and linked at runtime.
Java programming presentations By Daroko blog
Do not just read java as a programmer, find projects and start making some Money, at DAROKO BLOG,WE Guide you through what you have learned in the classroom to a real business Environment, find java applications to a real business Environment, find also all IT Solutions and How you can apply them, find the best companies where you can get the IT jobs worldwide, Find java contract, Complete and start making some cash, find clients within your Country, refer and get paid when you complete the work.
Not Just a contact, at daroko Blog (www.professionalbloggertricks.com/),you are also being taught how you can apply all IT related field in real world.
Simply Google, Daroko Blog or visit (www.professionalbloggertricks.com/) to Know More about all these service now.
Do not just learn and go, apply them in real world.
Java was initially developed by Sun Microsystems in 1991 under the name Oak by James Gosling. It was renamed to Java in 1995 due to legal issues. Java is an object-oriented programming language that is platform independent, meaning Java programs can run on any system with a Java virtual machine. Key features of Java include being simple, secure, robust, portable, and having automatic memory management. Java is commonly used to build mobile and web applications.
The document is a lab manual for Java programming that includes 12 experiments. The first experiment involves creating a Java package with Stack and Queue classes that demonstrate LIFO and FIFO principles respectively using methods like push(), pop() and enqueue(), dequeue(). The second experiment involves designing a ComplexNumber class with constructors to perform addition, subtraction and multiplication of complex numbers.
This document discusses applets in Java. It defines applets as client-side Java programs that run in web browsers. The document outlines the advantages of applets, describes the lifecycle of applets, and provides examples of how to design, write, and run applet programs using HTML tags and the appletviewer tool. It also briefly introduces factory methods in Java.
- The document is a lab manual for an introductory Java programming course that provides instructions on installing Java, using an IDE, and writing simple Java programs.
- It explains how to create a "Hello World" Java program using BlueJ or JCreator IDEs, compile and run the program, and addresses common errors students may encounter.
- The document provides an example "Hello World" Java program and explains the key components of a basic Java class including the class definition, main method, and use of System.out.println to display output.
This document provides information on Java programming using applets. It discusses that Java can be used to create applications and applets, with the key difference being that applets run within a web browser. The document then covers the basics of how applets work, including their lifecycle of init(), start(), stop(), and destroy() methods. It provides an example "Hello World" applet code and discusses how to compile and run an applet using an HTML file and the appletviewer tool.
Java is a programming language and platform that is commonly used to develop desktop applications, web applications, mobile apps, and more. The document introduces Java by explaining what it is, where it is used, the types of Java applications that can be created, and how the Java compilation and execution process works at a high level. It also provides an example "Hello World" Java program to demonstrate the basic anatomy of a Java file, including classes, methods, and how the main method acts as the program entry point.
This document discusses Java applets and their life cycle. It explains that applets are subclasses of Applet that run in web browsers rather than via a main method. The life cycle of an applet involves initialization, start, paint, stop, and destroy methods. It provides an example "Hello World" applet code and explains how to compile, embed in an HTML file, and run it using an applet viewer. Finally, it contrasts applets and applications, noting that applets have limited system access for security while applications are fully trusted and run via a main method.
Java programs are portable across operating systems due to three features: 1) the standardized Java language, 2) the portable class library, and 3) translating source code to portable byte code rather than platform-specific machine code. The Java language is secure through interpreter-level checks and browser-level restrictions for applets. It is also robust through features like garbage collection and bounds checking that prevent crashes. Java programs come in two flavors - standalone applications or applets for web programming. Applets have additional restrictions and predefined lifecycle methods that are automatically invoked by web browsers.
Similar to B.Sc. III(VI Sem) Advance Java Unit2: Appet (20)
B.Sc. Sem-5
History of Java
Features of Java
Difference Between C++ and Java
Branching Statements in Java
Looping Statements in Java
Arrays in Java
Command Line Arguments in Java
The document discusses various GUI components in Java's Abstract Window Toolkit (AWT). It describes common controls like frames, labels, buttons, checkboxes, text fields, text areas, lists, and scrollbars. It also covers layout managers for arranging components, including border, grid, flow, and card layouts. The AWT provides classes and methods for creating graphical user interfaces in Java applications.
This document contains a question bank prepared by Mr. Hushare Y.V. for Advance Java (Units I, II, and III) for B.Sc. III (VI Semester) students. It includes fill in the blank and multiple choice questions covering exception handling, multithreading, applet programming, event handling, and AWT. Long answer questions require explanations of concepts like exceptions, threads, applets, event models, AWT components and layouts. The question bank is intended to test students' understanding of key topics in the Advance Java syllabus.
The document discusses PL/SQL, its advantages over SQL, and its basic structure and components. PL/SQL was developed by Oracle Corporation as a procedural extension to SQL. It allows for programming constructs like loops and conditionals. A PL/SQL block consists of a declare, begin, exception, and end section. It supports data types, variables, constants, control structures, and cursors. Cursors store the results of a SQL query and can be either implicit or explicitly defined.
The document discusses key concepts in entity-relationship (ER) modeling and the relational database model. It defines ER diagrams and their components like entities, attributes, and relationships. It describes different types of entities, attributes, relationships, and keys. It also explains how to map an ER diagram to tables in a relational database by providing rules for entities, attributes, and relationships. Finally, it discusses concepts like functional dependencies that are important for modeling relational data.
The document provides an overview of database management systems (DBMS) and their components. It discusses the traditional file-based approach to data storage and its limitations. It then describes how the database approach uses a DBMS to provide facilities for querying, security, integrity and simultaneous access. Key components of a DBMS discussed include data representation, storage structures, database architecture, data dictionary, and the role of the database administrator (DBA).
More from Assistant Professor, Shri Shivaji Science College, Amravati (7)
The debris of the ‘last major merger’ is dynamically youngSérgio Sacani
The Milky Way’s (MW) inner stellar halo contains an [Fe/H]-rich component with highly eccentric orbits, often referred to as the
‘last major merger.’ Hypotheses for the origin of this component include Gaia-Sausage/Enceladus (GSE), where the progenitor
collided with the MW proto-disc 8–11 Gyr ago, and the Virgo Radial Merger (VRM), where the progenitor collided with the
MW disc within the last 3 Gyr. These two scenarios make different predictions about observable structure in local phase space,
because the morphology of debris depends on how long it has had to phase mix. The recently identified phase-space folds in Gaia
DR3 have positive caustic velocities, making them fundamentally different than the phase-mixed chevrons found in simulations
at late times. Roughly 20 per cent of the stars in the prograde local stellar halo are associated with the observed caustics. Based
on a simple phase-mixing model, the observed number of caustics are consistent with a merger that occurred 1–2 Gyr ago.
We also compare the observed phase-space distribution to FIRE-2 Latte simulations of GSE-like mergers, using a quantitative
measurement of phase mixing (2D causticality). The observed local phase-space distribution best matches the simulated data
1–2 Gyr after collision, and certainly not later than 3 Gyr. This is further evidence that the progenitor of the ‘last major merger’
did not collide with the MW proto-disc at early times, as is thought for the GSE, but instead collided with the MW disc within
the last few Gyr, consistent with the body of work surrounding the VRM.
PPT on Direct Seeded Rice presented at the three-day 'Training and Validation Workshop on Modules of Climate Smart Agriculture (CSA) Technologies in South Asia' workshop on April 22, 2024.
Immersive Learning That Works: Research Grounding and Paths ForwardLeonel Morgado
We will metaverse into the essence of immersive learning, into its three dimensions and conceptual models. This approach encompasses elements from teaching methodologies to social involvement, through organizational concerns and technologies. Challenging the perception of learning as knowledge transfer, we introduce a 'Uses, Practices & Strategies' model operationalized by the 'Immersive Learning Brain' and ‘Immersion Cube’ frameworks. This approach offers a comprehensive guide through the intricacies of immersive educational experiences and spotlighting research frontiers, along the immersion dimensions of system, narrative, and agency. Our discourse extends to stakeholders beyond the academic sphere, addressing the interests of technologists, instructional designers, and policymakers. We span various contexts, from formal education to organizational transformation to the new horizon of an AI-pervasive society. This keynote aims to unite the iLRN community in a collaborative journey towards a future where immersive learning research and practice coalesce, paving the way for innovative educational research and practice landscapes.
The cost of acquiring information by natural selectionCarl Bergstrom
This is a short talk that I gave at the Banff International Research Station workshop on Modeling and Theory in Population Biology. The idea is to try to understand how the burden of natural selection relates to the amount of information that selection puts into the genome.
It's based on the first part of this research paper:
The cost of information acquisition by natural selection
Ryan Seamus McGee, Olivia Kosterlitz, Artem Kaznatcheev, Benjamin Kerr, Carl T. Bergstrom
bioRxiv 2022.07.02.498577; doi: https://doi.org/10.1101/2022.07.02.498577
The binding of cosmological structures by massless topological defectsSérgio Sacani
Assuming spherical symmetry and weak field, it is shown that if one solves the Poisson equation or the Einstein field
equations sourced by a topological defect, i.e. a singularity of a very specific form, the result is a localized gravitational
field capable of driving flat rotation (i.e. Keplerian circular orbits at a constant speed for all radii) of test masses on a thin
spherical shell without any underlying mass. Moreover, a large-scale structure which exploits this solution by assembling
concentrically a number of such topological defects can establish a flat stellar or galactic rotation curve, and can also deflect
light in the same manner as an equipotential (isothermal) sphere. Thus, the need for dark matter or modified gravity theory is
mitigated, at least in part.
ESA/ACT Science Coffee: Diego Blas - Gravitational wave detection with orbita...Advanced-Concepts-Team
Presentation in the Science Coffee of the Advanced Concepts Team of the European Space Agency on the 07.06.2024.
Speaker: Diego Blas (IFAE/ICREA)
Title: Gravitational wave detection with orbital motion of Moon and artificial
Abstract:
In this talk I will describe some recent ideas to find gravitational waves from supermassive black holes or of primordial origin by studying their secular effect on the orbital motion of the Moon or satellites that are laser ranged.
When I was asked to give a companion lecture in support of ‘The Philosophy of Science’ (https://shorturl.at/4pUXz) I decided not to walk through the detail of the many methodologies in order of use. Instead, I chose to employ a long standing, and ongoing, scientific development as an exemplar. And so, I chose the ever evolving story of Thermodynamics as a scientific investigation at its best.
Conducted over a period of >200 years, Thermodynamics R&D, and application, benefitted from the highest levels of professionalism, collaboration, and technical thoroughness. New layers of application, methodology, and practice were made possible by the progressive advance of technology. In turn, this has seen measurement and modelling accuracy continually improved at a micro and macro level.
Perhaps most importantly, Thermodynamics rapidly became a primary tool in the advance of applied science/engineering/technology, spanning micro-tech, to aerospace and cosmology. I can think of no better a story to illustrate the breadth of scientific methodologies and applications at their best.
The technology uses reclaimed CO₂ as the dyeing medium in a closed loop process. When pressurized, CO₂ becomes supercritical (SC-CO₂). In this state CO₂ has a very high solvent power, allowing the dye to dissolve easily.
Current Ms word generated power point presentation covers major details about the micronuclei test. It's significance and assays to conduct it. It is used to detect the micronuclei formation inside the cells of nearly every multicellular organism. It's formation takes place during chromosomal sepration at metaphase.
Authoring a personal GPT for your research and practice: How we created the Q...Leonel Morgado
Thematic analysis in qualitative research is a time-consuming and systematic task, typically done using teams. Team members must ground their activities on common understandings of the major concepts underlying the thematic analysis, and define criteria for its development. However, conceptual misunderstandings, equivocations, and lack of adherence to criteria are challenges to the quality and speed of this process. Given the distributed and uncertain nature of this process, we wondered if the tasks in thematic analysis could be supported by readily available artificial intelligence chatbots. Our early efforts point to potential benefits: not just saving time in the coding process but better adherence to criteria and grounding, by increasing triangulation between humans and artificial intelligence. This tutorial will provide a description and demonstration of the process we followed, as two academic researchers, to develop a custom ChatGPT to assist with qualitative coding in the thematic data analysis process of immersive learning accounts in a survey of the academic literature: QUAL-E Immersive Learning Thematic Analysis Helper. In the hands-on time, participants will try out QUAL-E and develop their ideas for their own qualitative coding ChatGPT. Participants that have the paid ChatGPT Plus subscription can create a draft of their assistants. The organizers will provide course materials and slide deck that participants will be able to utilize to continue development of their custom GPT. The paid subscription to ChatGPT Plus is not required to participate in this workshop, just for trying out personal GPTs during it.
Describing and Interpreting an Immersive Learning Case with the Immersion Cub...Leonel Morgado
Current descriptions of immersive learning cases are often difficult or impossible to compare. This is due to a myriad of different options on what details to include, which aspects are relevant, and on the descriptive approaches employed. Also, these aspects often combine very specific details with more general guidelines or indicate intents and rationales without clarifying their implementation. In this paper we provide a method to describe immersive learning cases that is structured to enable comparisons, yet flexible enough to allow researchers and practitioners to decide which aspects to include. This method leverages a taxonomy that classifies educational aspects at three levels (uses, practices, and strategies) and then utilizes two frameworks, the Immersive Learning Brain and the Immersion Cube, to enable a structured description and interpretation of immersive learning cases. The method is then demonstrated on a published immersive learning case on training for wind turbine maintenance using virtual reality. Applying the method results in a structured artifact, the Immersive Learning Case Sheet, that tags the case with its proximal uses, practices, and strategies, and refines the free text case description to ensure that matching details are included. This contribution is thus a case description method in support of future comparative research of immersive learning cases. We then discuss how the resulting description and interpretation can be leveraged to change immersion learning cases, by enriching them (considering low-effort changes or additions) or innovating (exploring more challenging avenues of transformation). The method holds significant promise to support better-grounded research in immersive learning.
(June 12, 2024) Webinar: Development of PET theranostics targeting the molecu...Scintica Instrumentation
Targeting Hsp90 and its pathogen Orthologs with Tethered Inhibitors as a Diagnostic and Therapeutic Strategy for cancer and infectious diseases with Dr. Timothy Haystead.
ESR spectroscopy in liquid food and beverages.pptxPRIYANKA PATEL
With increasing population, people need to rely on packaged food stuffs. Packaging of food materials requires the preservation of food. There are various methods for the treatment of food to preserve them and irradiation treatment of food is one of them. It is the most common and the most harmless method for the food preservation as it does not alter the necessary micronutrients of food materials. Although irradiated food doesn’t cause any harm to the human health but still the quality assessment of food is required to provide consumers with necessary information about the food. ESR spectroscopy is the most sophisticated way to investigate the quality of the food and the free radicals induced during the processing of the food. ESR spin trapping technique is useful for the detection of highly unstable radicals in the food. The antioxidant capability of liquid food and beverages in mainly performed by spin trapping technique.
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
Sexuality - Issues, Attitude and Behaviour - Applied Social Psychology - Psyc...
B.Sc. III(VI Sem) Advance Java Unit2: Appet
1. Prepared by, B.Sc. Ill(VISern)
Mr.Hushare Y.V., Asst. Professor Advance Java Programming (Unit-II)
UMT-II: Applet Programming
Introductionto Applet:
• A java program that contains mainO function is called as 'Standalone
iava application'.
• A standalonejava application is saved ina file with '.java' file extension.
• A JDK tool, iava compiler(javac) is used to compile '.java' file.
• A java compiler creates byte code i.e. file with '.class' file extension.
• The by code is executed by JVM usingJDK tool Java Interpreter!iava).
• This is about standalonejava application program.
• Java provides another feature called Applet'.
• An applet is a special java program which also saved in fdc with '.java'
file extension but it does not contain niainfj function.
• Also, applet is not executable using java interpreter. It executes or runs
within a web page.
• We can compile the applet code by using java compiler (javac) that create
executable applet (i.e. .class file) but we cannot execute this code using
iava interpreter(iava).
• Hence to run an applet we require web browser i.e. java compatible web
browser.
• Ifjava compatible web browser isnot available, thenwe can execute or run
a java applet using a JDK tool called 'appletviewer' present in 'bin' of
JDK as 'javac' and 'java' commands are present.
• In short, applet is a java program that does not contains main() function
and which executes or runs within a web page.
• To create and handle the java applet's, a separate package named
iava.applet' is provide by the java developers.
• This package contains a class whose name is Applet' in which methods
are defined to handle execution of the applet.
• Don't get confused between applet package and applet class. Package has
name with all letters in small case whereas class name begins with capital
letter 'A'
NOTE: Package name is: java.applet
Class name is : java.applet.Applet
Prepared by,
Mr.Hushare
B.Sc. Ill(VISem)
Asst. Professor Advance Java Programming (Unit-II)
Standalone java application Vs. Applet
# Standalone java application Java applet application
1 It contains main() function. It does not contains main() function.
2 JDK tool java interpreter can run
byte code of standalone java
application.
JDK tool java interpreter cannot
run byte code of java applet
application.
3 It does not require we browser to It requires web browser to execute.
execute.
4 To execute this application byte code
we have to run.
To execute applet application html
code we have run.
5 It execution is begins with main()
method.
Its execution begins with init()
method.
6 As compare to applet it is large java
program.
Java applet is small program.
2. Prepared by,
Mr.Hushare Y.V., Asst. Professor
Running a iava applet:
B.Sc. Ill(VISem)
Advance Java Programming (Unit-II)
Art applet is small java program without main() function which run's
within a web page.
That is, when we run/test a web page in web browser that web page
execute/run the specifiedjava applet.
Following are the steps for running a iava annlet:
Step 1: Build applet code (i.e. ".java" file)
Step 2: Create executable applet code (i.e. ".class" file)
Step 3: Create a web page (i.e. ".html" file) and add executable applet
inweb page using <APPLET> tag of HTML.
Step 4: Test/execute HTML file usingjava compatible web browser or
using JDK tool "appletviewer".
Step 1: Build Applet code:
importjava.awt.*;
importjava.applet.*;
public class Myapplet extends Applet
f
X
public void paint (Graphics g)
{
.............// Applet code
Fig. Skeleton of applet program (Architecture of applet)
• This Applet skeleton uses two essential classes i.e. Applet and Graphics.
• Applet class is defined in iava.applet package and Graphics class is
defined in java.awt package.
• The paintO method, when it is called actually it displays the result of the
applet code on the screen. It is method of Applet class.
• This applet code we should save with '.java' extension i.e. Myapplet.java.
Step 2: Creating executable applet code:
• Just compile above created Myapplet.java file usingjava compiler (javac).
• It will create executable applet code i.e. Mvapplet.class.
by.
.Hushare Y.V., Asst. Professor
Step 3: Create web page
B.Sc. Ill(VIScm)
Advance Java Programming (Unit-II)
and add executable applet inHTML file:
<HTML>
<BODY>
<APPLET CODE = Myapplet.class
HEIGHT= intcgcrvaluc
WIDTH - integervalue >
</APPLET>
</BODY>
</HTML>
• Save this file say webl.html. Here CODE attribute of <APPLET> tag is
used to embed Myapplet.class applet in web page web 1.html.
Step 4: Test/execute web page:
• When above created web page is tested injava compatible we browser,
Myapplet.class this applet run within this web page as small window
whose size is specified with HEIGHT and WIDTH in <APPLET> tag.
• If java compatible web browser is not available, then use JDK tool
"appletviewer" as follows to runweb page.
C:V> appletviewer web.html
For example, write an applet to show "Hello India" message.
importjava.applet.*;
importjava.awt.*;
public class hello
{
public void paint(Graphics g)
{
g.drawString("Hello India",10,10);
}
J_
hello,java
C:>......>javac hello.java
C:>......>appletviewer hello.html
<html>
<body>
<applet code=hello.class
width=300
height=200>
</applet>
</body>
</html>
hello.html
3. by,
.Hushare Y.V., Asst. Professor
Output:
B.Sc. Ill(VISem)
Advance Java Programming (Unit-II)
j> Applet Viewer: hello-classÿ
Applet started.
by,
.Hushare Y.V., Asst. Professor
Life Cycle of an applet:
B.Sc. Ill(VISem)
Advance Java Programming (Unit-II)
Running
paintQ
destroy()
Fig.Life Cycle of Applet
It is important to understand the order in which the various methods are
get called to control the applet.
The following sequence of methods are invoked, when applet begins.:
o init()
o start()
o paintQ
When an applet is terminated, the following sequence of methods
invoked sequentially:
o stopQ
o destroyQ
NOTE: All of these methods are defined in 'Applet' class which is defined in
'java.applet' package.
4. Prepared by, B.Sc. Ill(VISem)
Mr.Hushare Y.V., Asst. Professor Advance Java Programming (Unit-II)
1. Born Slate :
• The init() methodis the first methodthat gets called when we runan applet
and put the applet in borne state.
• Inthis state of applet, its variables are get initialized.
2. Running State:
• The initQ methodcalls another methodstartQ automatically put the applet
in running state.
• Again startQ method invokes paintQ method and its output will be
displayed on screen.
• The startQ and paintQ methods are called in sequence every time when
applet receives focus.
3. Idle State:
• When web browser going to display another page, then stopQ method is
get called to suspend the execution of applet.
• At this time, the applet is said to be in Idle state.
• Suspended applet may resume again by calling startQ method when it
receives focus.
4. Dead State:
• When applet is not needed further, then it will be moved from the memory
and pushed into dead state.
• This is done by invoking destroyQ method.
• This is the last methodthat invoked.
by,
.Hushare Y.V., Asst. Professor
Passing Parameters to Applet:
B.Sc. Ill(VISem)
Advance Java Programming(Unit-II)
• Wc can pass parameter to applet by using <PARAM> tag.
• Two essential attributes of <PARAM> tag are :
o NAME
o VALUE
• The <PARAM> tag should be used within <APPLET> tag as follows:
<APPLET ... >
<PARAM name= text
value= stringval >
</APPLET>
• To catch the Parameters are passed to an applet gctParametcrQ method
we should define in initQ method.
• getParameterQ methodcan accept only ONE string argument i.e. name
of the parameter and returns a string i.e. value of that parameter.
• For example,
/*
<APPLET code-paramTest.class height=500 width=400>
<PARAM name-x
value-'SSSC, Amravati">
</APPLET>
*/
importjava.awt.*;
importjava.applet.*;
public class paramTest extends Applet
{
String str;
public void init()
{
str=getParameter("x");
}
public void paint(Graphics g)
{
g.drawString(str,100,100);
}
}
5. Prepared by, B.Sc. Ill(VISern)
Mr.Hushare Y.V., Asst. Professor Advance Java Programming (Unit-II)
getCodeBaseO and getDocumentBaseO methods:
• In applet programming wc create THREE files i.e. ".java", ".class" and
".html".
• Wc also know that there is no role of ".java" file after compilation.
• It is also important that, two files i.e. '.class' and '.html' file must be in
same folder.
• Executable applet means '.class' file.
• Wc know that runs within a html document. Hcncc full path of html file is
referred as document base of the applet i.e. from which document it is
executed.
• Whereas the path where ".html" and ".class" files arc stored is referred as
code base of applet i.e. at which place executable applet is stored.
• That iscodebase anddocument base ofapplet isnothingbut thepathwhere
it is.
• We can retrieve both of these paths by making use of two methods:
ÿ
getDocumcBascO
ÿ
getCodeBase()
For example,
• Consider the files "test.class" and "test.html" both arc stored in folder
"D:testing".
• The following program output illustrate the use of getCodeBaseO an
getDocumentBaseO methods.
Mr.Hushare Y.V., Asst. Professor
B.Sc. Ill(VIScm)
Advance Java Programming (Unit-II)
/*
<APPLET code~tcst.class height=500 width=400>
</APPLET>
*/
importjava.awt.*;
importjava.applet.*;
public class test extends Applet
{
public void paint(Graphics g)
{
g.drawString("Document base:" + getDocumentBaseO,20,30);
g.drawString("Code base:" +getCodeBaseO,20,50);
}
Output:
mAm
4i| Applet Viewer: test.class
Applet
DocumentBase=fiIe:/D:n"estingl2.html
CodeBase=file:/D:JTestingi
Applet started.
6. Prepared by, B.Sc. Ill(VIScm)
Mr.Hushare Y.V., Asst. Professor Advance Java Programming (Unit-II)
ApplicationContext:
• 'AppletContext' is anjava interface defined in 'applet' package.
• An applet runs inside a browser or applet viewer.
• An applet runningwithin a browser can ask the browser to do things for it:
o Fetch an audio clip
o Show a short message in the status line
o Show a different web page
• The browser can performthese requests or ignore them.
• To communicate with the browser, an applet calls the
java.applet.Applet.getApplctContextO method, which returns an object
that implements an interface of type java.applet.AppletContext.
• Think of AppletContext as a communication path between the applet and
the browser.
• AppletContext interface provides the following methods:
# MethodDescription MethodDescription
1 void showStatus(String message)
Shows the message inthe status line
of the browser
2 Enumeration getApplets!)
Returns an enumeration of all the
applets in the same context (same web
page)
3 Applet getApplet(Stringname)
Returns the applet in the current
context with the specified name (null
ifnone exists)
4 void showDocument(URL url)
Shows a new web page in the browser,
displacing the current page.
5
void showDocument(URL url,
String target)
Shows a new web page in the browser,
specifying the target frame
(" self", " parent", " top",
" blank", or <frame-name>)
Prepared by, B.Sc. Ill(VIScm)
Mr.Hushare Y.V., Asst. Professor Advance Java Programming (Unit-II)
6 Image getlmage(URL url)
Returns an image object that
encapsulates the image specified by
the URL
7 AudioClip getAudioClip(URL url)
Returns an AudioClip object that
encapsulates the sound file specified
by the URL.
• The following program shows the use of Application context.
• Inthis programwe are usingapplicationcontext objet to openanother .html
file(Test.html) from the applet ACDemo.class.
o D:ACDemo.java
o D:ACDemo.class
o D:Test.html
/*<applel code— 'ACDemo" width=300 height=50> </applet>*/
importjava.awt.*;
importjava.applet.*;
importjava.net.*;
public class ACDemo extends Applet
i
public void start()
{
AppletContext ac = getAppletContext();
url = getCodeBase(); // get url of this applet(here ,url="file://D:/")
try
{
ac.showDociimentfnew URL(url+"Test.html"j);
}
catch(Exception e)
{
showStatus("URL not found");
}
}
}
7. 13
Prepared by,
Mr.Hiishare Y.V., Asst. Professor
B.Sc. Ill(VISem)
Advance Java Programming (Unit-II)
Graphics Class:
• Java provides another feature called graphics programming.
• Graphics means art of drawing graphical shapes ( e.g. a line,a rectangle, a
ellipse, etc.)
• Java allows to draw different graphical shapes.
• The feature of graphics programming is provided in java through a class
'Graphics' defined in 'awt' package, (iava.awt.Graphics)
• The 'Graphics' class contains various methods for drawing various
shapes.
• The following are some methods of the 'Graphics' class:
Method Description
drawLine() Draws a straight line
drawString() Displays the string.
drawRect() Draws a hollow (empty) Rectangle.
drawRoundRect() Draws a hollow (empty) Rectangle with rounded corners
fillRect() Draws a filled Rectangle.
drawOval() Draws a hollow (empty) oval.
fdlOval() Draws a filled oval.
drawPolygonO Draws a hollow (empty) Polygon.
fillPlolygon() Draws a filled Polygon.
drawArc() Draws a hollow)empty) arc.
setFont() Sets font.
setColor() Sets the drawing color.
:parcd by, B.Sc. Ill(VISem)
Mr.Hushare Y.V., Asst. Professor Advance Java Programming(Unit-II)
Draw Lines:
• The drawLineO method is used to draw straight line.
• This method is defined in Graphics class of awt package.
• Syntax:
Graphics g;
g.drawLine(x1,yl,x2,y2);
• For example.
/*
<applet code="lineTest.class"
height=700
width=800>
</applet>
#/
importjava.awt.*;
importjava.applet.*;
public class lineTest extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.orange);
g.drawLine(100,100,500,100);
g.setColor(Color.green);
g.drawLine) 100,100,100,500);
8. 15
Prepared by,
Mr.Hushare Y.V., Asst. Professor
B.Sc. Ill(VISern)
Advance Java Programming (Unit-II)
Output:
IIIApplet Viewer: lineTest.class | ÿ |B !•—£3—1
Applet
Applet started.
Drawing Rectangle:
• The drawRectO and fillRectO methods are used to draw
hollow(empty) and filled rectangle respectively.
• Ittakes coordinates left-topcomer (x,y),width andheight as arguments.
(X, y) Width
Height
Syntax:
Graphics g;
g.drawRect(x, y, width, Height);
g.fillRect(x, y, width, Height);
Prepared by,
Mr.Hushare
B.Sc. Ill(VIScm)
Asst. Professor Advance Java Programming (Unit-II)
/*
<applet code="rectTest.class"
width=500
height=400>
</applct>
*/
importjava.awt.*;
importjava.applet.*;
public class rectTest extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawRcct(l0,10,100,70);
g.setColor(Color.green);
g.fillRect(150,10,100,70);
}
}
Output:
=.l Applet Viewer rectTest.class
Applet
Applet started.
9. 17
Prepared by,
Mr.Hiishare Y.V., Asst. Professor
B.Sc. Ill(VISem)
Advance Java Programming (Unit-II)
Drawing Ellipses:
• The drawOval() and fillOval() methods are used to draw hollow(empty)
and filled ellipse/circle respectively.
• It draws a oval within specified rectangle.
• Hence it takes coordinates left-top comer (x,y), width and height of
rectangle as arguments.
• The oval whose width and height is equal is referred as circle.
(x,y)
• Syntax:
Graphics g;
g.drawOval(x, y, width, Height);
g.fillOval(x, y, width, Height);
For example.
by,
.Hushare Y.V.,
B.Sc. Ill(VIScm)
Asst. Professor Advance Java Programming(Unit-II)
/*<applet code="ovalTest.class"
width=500
height=400>
</applet>*/
importjava.awt.*;
importjava.applet.*;
public class ovalTest extends Applet
i
t
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawOval(l0,10,150,70); // Ellipse
g.fillOval(200,l0,150,70); // Ellipse
g.setColor(Color.magenta);
g.fill0val(10,100,150,150);
}
I
/
Output:
Applet Viewer: ovalTest.class
Applet
Applet started.