UNIT – 4
PART I
APPLET
APPLETS - GUI COMPONENTS
APPLET PARAMETERS
LIFE CYCLE OF AN APPLET
APPLICATION CONVERSION TO APPLETS
AWT AND AWT HIERARCHY
SWING COMPONENTS
UNIT – 5
PART- II
JDBC DRIVER AND ITS TYPES
DATABASE URL FORMULATION
CREATE CONNECTION OBJECT
CLOSING JDBC CONNECTIONS
DATA TYPES
RESULT SETS
CONCURRENCY OF RESULTSET
VIEWING A RESULT SET
TRANSACTIONS
COMMIT & ROLLBACK
UNIT - 2
ARRAY AND ITS TYPES
INHERITANCE AND ITS TYPES
THE SUPER KEYWORD
POLYMORPHISM
ABSTRACT CLASSES
INTERFACES
DECLARING INTERFACES
IMPLEMENTING INTERFACES
EXTENDED INTERFACES
EXTENDING MULTIPLE INTERFACES
PACKAGES
THE IMPORT KEYWORD
THE DIRECTORY STRUCTURE OF PACKAGES
ACCESS SPECIFIER
UNIT - 4
PART II
AWT EVENT HANDLING
AWT EVENT CLASSES
AWT EVENT LISTENERS
AWT ADAPTER CLASSES
AWT CONTAINERS
AWT LAYOUT MANAGER
AWT MENU CLASSES
MENU CONTROLS
AWT GRAPHICS CLASSES
GRAPHICS
WINDOW FUNDAMENTALS
WORKING WITH FRAME WINDOW
WORKING WITH GRAPHICS
UNIT – 5
PART- II
JDBC DRIVER AND ITS TYPES
DATABASE URL FORMULATION
CREATE CONNECTION OBJECT
CLOSING JDBC CONNECTIONS
DATA TYPES
RESULT SETS
CONCURRENCY OF RESULTSET
VIEWING A RESULT SET
TRANSACTIONS
COMMIT & ROLLBACK
UNIT - 2
ARRAY AND ITS TYPES
INHERITANCE AND ITS TYPES
THE SUPER KEYWORD
POLYMORPHISM
ABSTRACT CLASSES
INTERFACES
DECLARING INTERFACES
IMPLEMENTING INTERFACES
EXTENDED INTERFACES
EXTENDING MULTIPLE INTERFACES
PACKAGES
THE IMPORT KEYWORD
THE DIRECTORY STRUCTURE OF PACKAGES
ACCESS SPECIFIER
UNIT - 4
PART II
AWT EVENT HANDLING
AWT EVENT CLASSES
AWT EVENT LISTENERS
AWT ADAPTER CLASSES
AWT CONTAINERS
AWT LAYOUT MANAGER
AWT MENU CLASSES
MENU CONTROLS
AWT GRAPHICS CLASSES
GRAPHICS
WINDOW FUNDAMENTALS
WORKING WITH FRAME WINDOW
WORKING WITH GRAPHICS
Java 9 is just around the corner, and yet many of us developers have yet to use Java 8 features in an application. The goal of this presentation is to move beyond slide-sized examples of streams and lambdas, and to show how to build a fully working end-to-end application using just the core libraries available in the latest version of Java.
In this session, Trisha will build a Java 8 application live. This application will consume a real-time feed of high velocity data, contain services that make sense of the data, and present it in a JavaFX dashboard. Along the way, we’ll encounter Java 8 streams, lambdas, new ways of working with collections, and probably bump into the new date and time API.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
Turbocharge SQL Performance in PL/SQL with Bulk ProcessingSteven Feuerstein
Is your Oracle Database application running slower than you'd like? One of the first things to check is row-by-row processing: non-query DML (insert, update, delete) within a loop. And the fix? Bulk processing, either with smarter SQL or with FORALL and BULK COLLECT in PL/SQL.
Java 9 is just around the corner, and yet many of us developers have yet to use Java 8 features in an application. The goal of this presentation is to move beyond slide-sized examples of streams and lambdas, and to show how to build a fully working end-to-end application using just the core libraries available in the latest version of Java.
In this session, Trisha will build a Java 8 application live. This application will consume a real-time feed of high velocity data, contain services that make sense of the data, and present it in a JavaFX dashboard. Along the way, we’ll encounter Java 8 streams, lambdas, new ways of working with collections, and probably bump into the new date and time API.
A short introduction (with many examples) to the Scala programming language and also an introduction to using the Play! Framework for modern, safe, efffcient and reactive web applications.
Turbocharge SQL Performance in PL/SQL with Bulk ProcessingSteven Feuerstein
Is your Oracle Database application running slower than you'd like? One of the first things to check is row-by-row processing: non-query DML (insert, update, delete) within a loop. And the fix? Bulk processing, either with smarter SQL or with FORALL and BULK COLLECT in PL/SQL.
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.
An applet is a Java program that operates in a Web browser. An applet can be a completely efficient Java program because it has the entire Java API at its convenience.
An applet is a Java program that operates in a Web browser. An applet can be a completely efficient Java program because it has the entire Java API at its convenience.
MOBILE APPLICATIONS DEVELOPMENT -ANDROID BY SIVASANKARISivaSankari36
unit 1; ANDROID
Native and web applications - Mobile operating systems and applications - Mobile Databases. Android: History of Android - Android Features – OSS – OHA - Android Versions and compatibility - Android devices - Prerequisites to learn Android -– Setting up software – IDE - XML. Android Architecture: Android Stack - Linux Kernel - Android Runtime - Dalvik VM - Application Framework - Android emulator - Android applications.
UNIT II Android development:
Java - Android Studio – Eclipse – Virtualization – APIs and Android tools – Debugging with DDMS – Android File system – Working with emulator and smart devices - A Basic Android Application - Deployment. Android Activities: The Activity Lifecycle – Lifecycle methods – Creating Activity. Intents – Intent Filters – Activity stack.
UNIT III Android Services:
Simple services – Binding and Querying the service – Executing services.- Broadcast Receivers: Creating and managing receivers – Receiver intents – ordered broadcasts. Content Providers: Creating and using content providers – Content resolver. Working with databases: SQLite – coding for SQLite using Android – Sample database applications – Data analysis.
UNIT IV Android User Interface:
Android Layouts – Attributes – Layout styles - Linear – Relative – Table – Grid – Frame. Menus: Option menu – context menu - pop-up menu – Lists and Notifications: creation and display. Input Controls: Buttons-Text Fields-Checkboxes-alert dialogs-Spinners-rating bar-progress bar.
UNIT V Publishing and Internationalizing mobile applications :
Live mobile application development: Game, Clock, Calendar, Convertor, Phone book. App Deployment and Testing: Doodlz app – Tip calculator app – Weather viewer app.
Text Books
1. Barry Burd, “Android Application Development – All-in-one for Dummies”, 2nd Edition, Wiley India, 2016.
Reference
1. Paul Deitel, Harvey Deitel, Alexander Wald, “ Android 6 for Programmers – An App-driven Approach”, 3rd edition, Pearson education, 2016.
2. Jerome (J. F) DiMarzio, “Android – A Programmer‟s Guide”, McGraw Hill Education, 8th reprint, 2015.
3. http://www.developer.android.com
UNIT I -WIRELESS COMMUNICATION FUNDAMENTALS
UNIT II -TELECOMMUNICATION NETWORKS & WIRLESS LAN
UNIT III -MOBILE NETWORK LAYER & TRANSPORT LAYER
UNIT IV- APPLICATION LAYER
UNIT V- DATABASE ISSUES
Functional MRI using Apache Spark in Big Data ApplicationSivaSankari36
Technologies for ascendable investigation of terribly massive datasets have emerge within the domain of web computing, however are still seldom utilized in neuroimaging despite the existence of knowledge and analysis queries in want of economical computation tools particularly in fMRI
Ethnobotany and Ethnopharmacology:
Ethnobotany in herbal drug evaluation,
Impact of Ethnobotany in traditional medicine,
New development in herbals,
Bio-prospecting tools for drug discovery,
Role of Ethnopharmacology in drug evaluation,
Reverse Pharmacology.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
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!
How to Split Bills in the Odoo 17 POS ModuleCeline George
Bills have a main role in point of sale procedure. It will help to track sales, handling payments and giving receipts to customers. Bill splitting also has an important role in POS. For example, If some friends come together for dinner and if they want to divide the bill then it is possible by POS bill splitting. This slide will show how to split bills in odoo 17 POS.
We all have good and bad thoughts from time to time and situation to situation. We are bombarded daily with spiraling thoughts(both negative and positive) creating all-consuming feel , making us difficult to manage with associated suffering. Good thoughts are like our Mob Signal (Positive thought) amidst noise(negative thought) in the atmosphere. Negative thoughts like noise outweigh positive thoughts. These thoughts often create unwanted confusion, trouble, stress and frustration in our mind as well as chaos in our physical world. Negative thoughts are also known as “distorted thinking”.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
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.
1. PROGRAMMING IN JAVA
A. SIVASANKARI
ASSISTANT PROFESSOR
DEPARTMENT OF COMPUTER APPLICATION
SHANMUGA INDUSTRIES ARTS AND SCIENCE
COLLEGE,
TIRUVANNAMALAI. 606601.
Email: sivasankaridkm@gmail.com
2. PROGRAMMING IN JAVA
UNIT – 4
PART I
APPLET
APPLETS - GUI
COMPONENTS
APPLET PARAMETERS
LIFE CYCLE OF AN APPLET
APPLICATION
CONVERSION TO APPLETS
AWT AND AWT HIERARCHY
SWING COMPONENTS
A. SIVASANKARI - SIASC-TVM UNIT-4
3. PROGRAMMING IN JAVA
APPLET BASICS
• An applet is a Java program that runs in a Web browser. An applet can be a fully functional
Java application because it has the entire Java API at its disposal.
• There are some important differences between an applet and a standalone Java application,
including the following
• An applet is a Java class that extends the java.applet.Applet class.
• A main() method is not invoked on an applet, and an applet class will not define main().
• Applets are designed to be embedded within an HTML page.
• When a user views an HTML page that contains an applet, the code for the applet is
downloaded to the user's machine.
• A JVM is required to view an applet. The JVM can be either a plug-in of the Web browser or
a separate runtime environment.
• The JVM on the user's machine creates an instance of the applet class and invokes various
methods during the applet's lifetime.
• Applets have strict security rules that are enforced by the Web browser. The security of an
applet is often referred to as sandbox security, comparing the applet to a child playing in a
sandbox with various rules that must be followed.
• Other classes that the applet needs can be downloaded in a single Java Archive (JAR) file.
A. SIVASANKARI - SIASC-TVM
4. PROGRAMMING IN JAVA
APPLETS (GUI COMPONENTS)
• Applets are small java programs that run inside of a web browser.
• It is also stored as part of webpage.
• The applet classes contained in the java applet package.
• It also defines three interfaces.
1. Applet context
2. Audio clip
3. Applet stub
• It will be executed within HTML tag.
• It is an intelligent program.
• It is an application designed to be transmitted over internet and executed by a java compatible
with browser.
SYNTAX
• <applet code= “ program name” width=200 height=200> </applet>
APPLET INITIALIZATION AND TERMINATION
When started
• Init( )
• Start( )
• Paint( )
When Applet is terminated
• Stop( )
• Destroy( )
A. SIVASANKARI - SIASC-TVM
5. PROGRAMMING IN JAVA
Another method is overriding update( )
EXAMPLE
• Public void paint (Graphics g)
• {
• Update(g);
• }
APPLET CLASSES OR METHODS
APPLET METHODS DESCRIPTION
void destroy( ) It called by the browser just before an applet is
terminated.
String getAppletinfo( ) It should return String.
URL getcodeBase( ) It returns URL
image getimage(URL url) It returns image object.
void init( ) It begins execution.
void start( ) It should starts of execution.
Void stop( ) Browser to suspend execution of applets.
A. SIVASANKARI - SIASC-TVM
7. PROGRAMMING IN JAVA
EXAMPLE
• import java.awt.*;
• import java.applet.*;
• /*<applet code=”sample” width=300 height=200></applet>
• public class sample extends Applet{
• Public void init( ){
• setBackground(color.cyan)}
• Public void paint( Graphics g){
• g.drawString(“This is sample”,10,20);
• show status(“This is status window”);}}
HTMLAPPLET TAGS
• <APPLET[CODE BASE=code base URL] name of file CODE=applet file
• [ALT= alternate text] [NAME= applet instance name]name of attributes
• [WIDTH=pixels, HEIGHT=PIXELS]height and width of window
• [ALIGN= alignment]top, bottom, up, down, middle
• [VSPACE=Pixels]vertical space [HSPACE=Pixels]>horizontal space
• [<param name=attribute name VALUE=attribute value>]
• </APPLET>
A. SIVASANKARI - SIASC-TVM
8. PROGRAMMING IN JAVA
LIFE CYCLE OF AN APPLET
• Four methods in the Applet class gives you the framework on which you build any
serious applet
• init − This method is intended for whatever initialization is needed for your applet.
It is called after the param tags inside the applet tag have been processed.
• start − This method is automatically called after the browser calls the init method.
It is also called whenever the user returns to the page containing the applet after
having gone off to other pages.
• stop − This method is automatically called when the user moves off the page on
which the applet sits. It can, therefore, be called repeatedly in the same applet.
• destroy − This method is only called when the browser shuts down normally.
Because applets are meant to live on an HTML page, you should not normally leave
resources behind after a user leaves the page that contains the applet.
• paint − Invoked immediately after the start() method, and also any time the applet
needs to repaint itself in the browser. The paint() method is actually inherited from
the java.awt.
A. SIVASANKARI - SIASC-TVM
9. PROGRAMMING IN JAVA
A "Hello, World" Applet
Following is a simple applet named HelloWorldApplet.java
• import java.applet.*;
• import java.awt.*;
• public class HelloWorldApplet extends Applet {
• public void paint (Graphics g) {
• g.drawString ("Hello World", 25, 50);
• }
• }
These import statements bring the classes into the scope of our applet class
• java.applet.Applet
• java.awt.Graphics
• Without those import statements, the Java compiler would not recognize the classes Applet
and Graphics, which the applet class refers to.
The Applet Class
• Every applet is an extension of the java.applet.Applet class. The base Applet class provides
methods that a derived Applet class may call to obtain information and services from the
browser context.
A. SIVASANKARI - SIASC-TVM
10. PROGRAMMING IN JAVA
These include methods that do the following
• Get applet parameters
• Get the network location of the HTML file that contains the applet
• Get the network location of the applet class directory
• Print a status message in the browser
• Fetch an image
• Fetch an audio clip
• Play an audio clip
• Resize the applet
• Additionally, the Applet class provides an interface by which the viewer or browser obtains
information about the applet and controls the applet's execution. The viewer may
• Request information about the author, version, and copyright of the applet
Request a description of the parameters the applet recognizes
1. Initialize the applet
2. Destroy the applet
3. Start the applet's execution
4. Stop the applet's execution
• The Applet class provides default implementations of each of these methods. Those
implementations may be overridden as necessary.
• The "Hello, World" applet is complete as it stands. The only method overridden is the paint
method.
A. SIVASANKARI - SIASC-TVM
11. PROGRAMMING IN JAVA
Invoking an Applet
• An applet may be invoked by embedding directives in an HTML file and viewing the file
through an applet viewer or Java-enabled browser.
• The <applet> tag is the basis for embedding an applet in an HTML file. Following is an
example that invokes the "Hello, World" applet
• <html>
• <title>The Hello, World Applet</title>
• <hr>
• <applet code = "HelloWorldApplet.class" width = "320" height = "120">
• If your browser was Java-enabled, a "Hello, World" message would appear here.
• </applet>
• <hr>
• </html>
• The code attribute of the <applet> tag is required. It specifies the Applet class to run. Width
and height are also required to specify the initial size of the panel in which an applet runs. The
applet directive must be closed with an </applet> tag.
• If an applet takes parameters, values may be passed for the parameters by adding <param>
tags between <applet> and </applet>. The browser ignores text and other tags between the
applet tags.
A. SIVASANKARI - SIASC-TVM
12. PROGRAMMING IN JAVA
GETTING APPLET PARAMETERS
• The following example demonstrates how to make an applet respond to setup
parameters specified in the document. This applet displays a checkerboard pattern
of black and a second color.
• The second color and the size of each square may be specified as parameters to the
applet within the document.
• CheckerApplet gets its parameters in the init() method. It may also get its
parameters in the paint() method. However, getting the values and saving the
settings once at the start of the applet, instead of at every refresh, is convenient and
efficient.
• The applet viewer or browser calls the init() method of each applet it runs. The
viewer calls init() once, immediately after loading the applet. (Applet.init() is
implemented to do nothing.) Override the default implementation to insert custom
initialization code.
• The Applet.getParameter() method fetches a parameter given the parameter's name
(the value of a parameter is always a string). If the value is numeric or other non-
character data, the string must be parsed.
A. SIVASANKARI - SIASC-TVM
13. PROGRAMMING IN JAVA
The following is a skeleton of CheckerApplet.java
• import java.applet.*;
• import java.awt.*;
• public class CheckerApplet extends Applet {
• int squareSize = 50; // initialized to default size
• public void init() {}
• private void parseSquareSize (String param) {}
• private Color parseColor (String param) {}
• public void paint (Graphics g) {}}
Here are CheckerApplet's init() and private parseSquareSize() methods
• public void init () {
• String squareSizeParam = getParameter ("squareSize");
• parseSquareSize (squareSizeParam);
• String colorParam = getParameter ("color");
• Color fg = parseColor (colorParam);
• setBackground (Color.black); setForeground (fg);
• } private void parseSquareSize (String param) {
• if (param == null) return;
• try { squareSize = Integer.parseInt (param); }
• catch (Exception e) { // Let default value remain }}
A. SIVASANKARI - SIASC-TVM
14. PROGRAMMING IN JAVA
• The applet calls parseSquareSize() to parse the squareSize parameter. parseSquareSize() calls
the library method Integer.parseInt(), which parses a string and returns an integer.
Integer.parseInt() throws an exception whenever its argument is invalid.
• Therefore, parseSquareSize() catches exceptions, rather than allowing the applet to fail on bad
input.
• The applet calls parseColor() to parse the color parameter into a Color value. parseColor()
does a series of string comparisons to match the parameter value to the name of a predefined
color.
• We need to implement these methods to make this applet work.
• Specifying Applet Parameters
The following is an example of an HTML file with a CheckerApplet embedded in it.
• The HTML file specifies both parameters to the applet by means of the <param> tag.
• <html>
• <title>Checkerboard Applet</title>
• <hr> <applet code = "CheckerApplet.class" width = "480" height = "320">
• <param name = "color" value = "blue">
• <param name = "squaresize" value = "30">
• </applet>
• <hr>
• </html>
• Note − Parameter names are not case sensitive.
A. SIVASANKARI - SIASC-TVM
15. PROGRAMMING IN JAVA
APPLICATION CONVERSION TO APPLETS
• It is easy to convert a graphical Java application (that is, an application that uses the AWT and
that you can start with the Java program launcher) into an applet that you can embed in a web
page.
Following are the specific steps for converting an application to an applet.
• Make an HTML page with the appropriate tag to load the applet code.
• Supply a subclass of the JApplet class. Make this class public. Otherwise, the applet cannot be
loaded.
• Eliminate the main method in the application. Do not construct a frame window for the
application. Your application will be displayed inside the browser.
• Move any initialization code from the frame window constructor to the init method of the
applet. You don't need to explicitly construct the applet object. The browser instantiates it for
you and calls the init method.
• Remove the call to setSize; for applets, sizing is done with the width and height parameters in
the HTML file.
• Remove the call to setDefaultCloseOperation. An applet cannot be closed; it terminates
when the browser exits.
• If the application calls setTitle, eliminate the call to the method. Applets cannot have title
bars. (You can, of course, title the web page itself, using the HTML title tag.)
• Don't call setVisible(true). The applet is displayed automatically
A. SIVASANKARI - SIASC-TVM
16. PROGRAMMING IN JAVA
AWT AND AWT HIERARCHY
• Java AWT (Abstract Window Toolkit) is an API to develop GUI or window-based
applications in java.
• Java AWT components are platform-dependent i.e. components are displayed according to the
view of operating system. AWT is heavyweight i.e. its components are using the resources of
OS.
• The java.awt package provides classes for AWT api such as TextField, Label, TextArea,
RadioButton, CheckBox, Choice, List etc.
A. SIVASANKARI - SIASC-TVM
17. PROGRAMMING IN JAVA
SWING COMPONENTS
• It is a set of classes that provides more powerful and flexible components that are possible
with the awt.
• Swing components are also called Java Foundation classes(JFC)
METHOD NAME COMMANDS
Abstract button Abstract super class for swing buttons.
Button group Encapsulates a mutually exclusive set of buttons.
Image Icon Encapsulates an icon.
JApplet The swing version of applet.
JButton The swing push button class.
JCheckBox Check box.
JComboBox The swing combination of dropdown list and text field.
JLabel Label.
JRadioButton Swing version of Radio Button.
JScrollpane Encapsulates a scrollable window.
JTabbedWindow Encapsulates a tabbed window.
JTable Encapsulates a table based control.
JTextField Text Box.
JTree Tree based Control.
A. SIVASANKARI - SIASC-TVM
18. PROGRAMMING IN JAVA
• JAPPLETS:
• Swing must be subclasses of JApplet. Use add( ) method.
• Syntax:
• Container getContentpane( )
• Example:
• void add( components)
• ICONS AND LABELS:
• Syntax:
• ImageIcon( String filename)
• Example:
• ImageIcon(URL url)
• Methods:
• int getIconHeight( )
• int getIconWidth( )
• void paintIcon(Component comp, Graphics g, int x, int y)
• JLABEL:
• JLabel(Icon i)
• JLabel(String s)
• JLabel(String s, Icon I, int align)
• JTEXT FIELDS:
• JText component are JTextFields.
A. SIVASANKARI - SIASC-TVM
19. PROGRAMMING IN JAVA
• Example:
• JTextField( )
• JTextField(int cols)
• JTextField(String s, int cols)
• JBUTTONS:
• Abstract button is a super class for push buttons, check boxes and radio buttons.
• Example:
• JButton(Icon i)
• JButton(String s)
• JButton(String s, Icon i)
• JCHECKBOX:
• Example:
• JCheckbox(Icon i)
• JCheckbox(Icon i, Boolean State)
• JCheckbox(String s)
• JCheckbox(String s, Icon i, Boolean State)
• Example:
• Void setselected(Boolean State)
A. SIVASANKARI - SIASC-TVM
20. PROGRAMMING IN JAVA
• JRadioButton:
• Example 1:
• JRadioButton(Icon i)
• JRadioButton(Icon i, String s)
• JRadioButton(String s)
• JRadioButton(String s, Icon i, Boolean State)
• Example 2:
• JRadioButton jb=new JRadioButton(“SAI”);
• JCOMBOBOX:
• Example 1:
• JCombobox( )
• JComboBox(vector v)
• Example 2:
• Void additem(Object obj);
• Example 3:
• JComboBox jb=new JComboBox( );
• jb.addItem(“INDIA”);
A. SIVASANKARI - SIASC-TVM
21. PROGRAMMING IN JAVA
• JTABBED PANE:
• Tabbed pane is a component that appears as a group of folders in a file cabinet.
• Example:
• void addtab(String str, Component comp)
• Here str is titile for the tab, comp is a add to tabs.
• JSCROLLPANE :
• Example 1:
• Jscrollpane(Component comp)
• Jscrollpane(int vsb, int hsb)
• Jscrollpane(Component comp, int vsb, int hsb)
• Example 2:
• JPanel jp=new JPanel( );
• JScrollpane jsb=new JScrollpane(jp,v,h);
• JTREES:
• It is a hierarchical view of data.
• Syntax:
• JTree( hash table ht)
• JTree(vector v)
A. SIVASANKARI - SIASC-TVM
22. PROGRAMMING IN JAVA
METHODS
• Add
• Remove
• Example:
• Void add( )
• Void remove( )
• JTABLES:
• It is a combination of rows and columns.
• Syntax:
• JTable(object data[][], object colsheads[])
A. SIVASANKARI - SIASC-TVM