AWT (Abstract Window Toolkit) is a collection of classes and methods that allows creation and management of windows. It provides support for applets and contains support for window-based graphical user interfaces. Different window classes defined by AWT add functionality, with Component and Container being the base classes. Layout managers determine how components are arranged in frames using algorithms. Common layout managers include FlowLayout, BorderLayout, and GridLayout. Graphics methods allow for drawing shapes and text to windows.
- Java AWT (Abstract Windowing Toolkit) is an API that provides components to build graphical user interfaces (GUIs) in Java. It includes classes like TextField, Label, TextArea, etc.
- AWT components are platform-dependent and heavyweight, using operating system resources. Common containers include Frame, Dialog, and Panel.
- This document provides details on various AWT components like Label, Button, Checkbox, List, and TextField. It also covers events, listeners, and methods of these components.
This document provides an overview of Java Swing components. It defines Swing as a GUI toolkit built on top of AWT that provides platform-independent and lightweight components. It describes common Swing components like JButton, JTextField, JTextArea and their usage. It also compares AWT and Swing, explaining how Swing components are more powerful and support pluggable look and feel while AWT is platform-dependent. Examples are given to demonstrate creating and using Swing components like JButton, JTextField, JTextArea etc.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
This document discusses Java collections framework and various collection classes like ArrayList, LinkedList, HashSet, HashMap etc. It provides definitions and examples of commonly used collection interfaces like List, Set and Map. It explains key features of different collection classes like order, duplicates allowed, synchronization etc. Iterators and generic types are also covered with examples to iterate and create typed collection classes.
1) A constructor in Java is a special method that is used to initialize objects and is called when an object is created. It can set initial values for object attributes.
2) There are different types of constructors including default, parameterized, and copy constructors. The default constructor takes no parameters, parameterized constructors take parameters to initialize objects with different values, and copy constructors are used to create a copy of an object.
3) Constructor overloading allows a class to have multiple constructors with the same name but different parameters, allowing objects to be initialized in different ways.
Our trainer’s having vast experience in real time environment. If anyone has a dream for their career in software programming, then go for java because it is a popular route to establish and fulfill your dreams.
We offer the best quality and affordable training, so you get trained from where you are, from our experienced instructors, remotely using Webex / Gotomeeting.
The document discusses various Java I/O streams including input streams, output streams, byte streams, character streams, buffered streams, properties class, print stream, file locking, serialization and print writer class. It provides examples of reading and writing files using FileInputStream, FileOutputStream, FileReader, FileWriter and other stream classes. Methods of different stream classes are also explained along with their usage.
The document discusses Java AWT (Abstract Window Toolkit). It describes that AWT is an API that allows developing GUI applications in Java. It provides classes like TextField, Label, TextArea etc. for building GUI components. The document then explains key AWT concepts like containers, windows, panels, events, event handling model, working with colors and fonts.
- Java AWT (Abstract Windowing Toolkit) is an API that provides components to build graphical user interfaces (GUIs) in Java. It includes classes like TextField, Label, TextArea, etc.
- AWT components are platform-dependent and heavyweight, using operating system resources. Common containers include Frame, Dialog, and Panel.
- This document provides details on various AWT components like Label, Button, Checkbox, List, and TextField. It also covers events, listeners, and methods of these components.
This document provides an overview of Java Swing components. It defines Swing as a GUI toolkit built on top of AWT that provides platform-independent and lightweight components. It describes common Swing components like JButton, JTextField, JTextArea and their usage. It also compares AWT and Swing, explaining how Swing components are more powerful and support pluggable look and feel while AWT is platform-dependent. Examples are given to demonstrate creating and using Swing components like JButton, JTextField, JTextArea etc.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
This document discusses Java collections framework and various collection classes like ArrayList, LinkedList, HashSet, HashMap etc. It provides definitions and examples of commonly used collection interfaces like List, Set and Map. It explains key features of different collection classes like order, duplicates allowed, synchronization etc. Iterators and generic types are also covered with examples to iterate and create typed collection classes.
1) A constructor in Java is a special method that is used to initialize objects and is called when an object is created. It can set initial values for object attributes.
2) There are different types of constructors including default, parameterized, and copy constructors. The default constructor takes no parameters, parameterized constructors take parameters to initialize objects with different values, and copy constructors are used to create a copy of an object.
3) Constructor overloading allows a class to have multiple constructors with the same name but different parameters, allowing objects to be initialized in different ways.
Our trainer’s having vast experience in real time environment. If anyone has a dream for their career in software programming, then go for java because it is a popular route to establish and fulfill your dreams.
We offer the best quality and affordable training, so you get trained from where you are, from our experienced instructors, remotely using Webex / Gotomeeting.
The document discusses various Java I/O streams including input streams, output streams, byte streams, character streams, buffered streams, properties class, print stream, file locking, serialization and print writer class. It provides examples of reading and writing files using FileInputStream, FileOutputStream, FileReader, FileWriter and other stream classes. Methods of different stream classes are also explained along with their usage.
The document discusses Java AWT (Abstract Window Toolkit). It describes that AWT is an API that allows developing GUI applications in Java. It provides classes like TextField, Label, TextArea etc. for building GUI components. The document then explains key AWT concepts like containers, windows, panels, events, event handling model, working with colors and fonts.
The document discusses exception handling in Java. It defines exceptions as abnormal conditions that arise during runtime and disrupt normal program flow. There are three types of exceptions: checked exceptions which must be declared, unchecked exceptions which do not need to be declared, and errors which are rare and cannot be recovered from. The try, catch, and finally blocks are used to handle exceptions, with catch blocks handling specific exception types and finally blocks containing cleanup code.
Collections Framework is a unified architecture for managing collections, Main Parts of Collections Framework
1. Interfaces :- Core interfaces defining common functionality exhibited by collections
2. Implementations :- Concrete classes of the core interfaces providing data structures
3. Operations :- Methods that perform various operations on collections
A thread is an independent path of execution within a Java program. The Thread class in Java is used to create threads and control their behavior and execution. There are two main ways to create threads - by extending the Thread class or implementing the Runnable interface. The run() method contains the code for the thread's task and threads can be started using the start() method. Threads have different states like New, Runnable, Running, Waiting etc during their lifecycle.
The document discusses Java event handling and the delegation event model. It describes key concepts like events, sources that generate events, and listeners that handle events. It provides examples of registering components as listeners and implementing listener interfaces. The delegation event model joins sources, listeners, and events by notifying listeners when sources generate events.
This presentation introduces some concepts about the Java Collection framework. These slides introduce the following concepts:
- Collections and iterators
- Linked list and array list
- Hash set and tree set
- Maps
- The collection framework
The presentation is took from the Java course I run in the bachelor-level informatics curriculum at the University of Padova.
This document discusses arrays in Java programming. It covers defining and creating single and multi-dimensional arrays, accessing array elements using indexes and loops, and performing operations like sorting and finding maximum/minimum values. Examples are provided for different array types like integer, string and character arrays, and operations like input/output, break/continue statements, and star patterns. Homework involves writing a program to produce a given output pattern.
SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. It is often used for local/client storage in applications. Key points:
- Created by D. Richard Hipp, it provides a lightweight disk-based database that doesn't require a separate server process and allows accessing the database using SQL queries.
- The entire database is stored in a single cross-platform file and can be as small as 0.5MB, making it suitable for embedded and mobile applications.
- It supports common data types like NULL, INTEGER, REAL, TEXT, and BLOB and is used in standalone apps, local
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
This document discusses I/O streams in Java. It defines streams as sequences of bytes that flow from a source to a destination. Streams can be categorized as character streams for text data or byte streams for raw binary data. Streams are also categorized as data streams that act as sources or destinations, or processing streams that alter or manage stream information. The Java IO package contains classes for defining input and output streams of different types.
The document discusses exception handling in programming. It defines different types of errors like syntax errors, semantic errors, and logical errors. Runtime errors can occur due to issues like division by zero. Exception handling involves finding and throwing exceptions using try, catch, and throw keywords. The catch block handles the exception. Common Java exceptions include NullPointerException, FileNotFoundException, and ArrayIndexOutOfBoundsException.
Properties are named members of classes, structures, and interfaces. Member variables or methods in a class or structures are called Fields. Properties are an extension of fields and are accessed using the same syntax. They use accessors through which the values of the private fields can be read, written, or manipulated.
An indexer allows an object to be indexed such as an array. When you define an indexer for a class, this class behaves similar to a virtual array. You can then access the instance of this class using the array access operator ([ ]).
This document provides an overview of Applets and Java GUI programming. It discusses Applets, their life cycle, how to run Applets using AppletViewer and HTML, and classes used in Applet programming like Applet, Graphics, Color, Font, and AWT components. It also covers Swing components like JApplet, JComponent, JLabel, JTextField, JButton, and JRadioButton. Code examples and demonstrations are provided for many of the concepts discussed.
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...Edureka!
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Java Collections” will talk about the complete hierarchy of Collections Frameworks in Java. It will walk you through the various fundamentals of collections like Lists, Queue, Sets, Interfaces etc. Through this tutorial you will learn the following topics:
Java Collection Framework
Collection Framework Hierarchy
Interfaces
List
Queue
Set
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
This document discusses JavaScript events and event listeners. It begins with an introduction that defines events as notifications that specific actions occurred, like user or browser actions. Event handlers are scripts that are executed in response to events. Events can be used to trigger JavaScript code that responds to user interactions. The document then provides examples of common event types like onclick, onsubmit, onmouseover, onmouseout, focus, and blur. It also discusses how to add and remove event listeners using addEventListener() and removeEventListener() methods. The document concludes with an example demonstrating how events can be used to change an HTML element in response to user clicks.
This document discusses graphics programming in Java. It covers the applet and AWT packages used for drawing graphics. Methods like drawString(), drawLine(), drawRect(), fillOval() and setColor() are described for drawing different shapes and text. Sample code is provided to demonstrate using these methods to draw lines, rectangles, ovals and changing color in an applet. The document serves as an introduction to graphics programming concepts in Java.
This document provides an overview of threads in Java, including:
- Threads allow for multitasking by executing multiple processes simultaneously. They are lightweight processes that exist within a process and share system resources.
- Threads can be created by extending the Thread class or implementing the Runnable interface. The run() method defines the code executed by the thread.
- Threads transition between states like new, runnable, running, blocked, and dead during their lifecycle. Methods like start(), sleep(), join(), etc. impact the thread states.
- Synchronization is used to control access to shared resources when multiple threads access methods and data outside their run() methods. This prevents issues like inconsistent data.
This document discusses ADO.NET, which is a data access technology that allows applications to connect to and manipulate data from various sources. It describes the core ADO.NET objects like Connection, Command, DataReader, DataAdapter, DataSet and DataTable. It also explains the differences between connected and disconnected data access models in ADO.NET, detailing the objects used in each approach and their advantages. Finally, it provides an overview of commonly used .NET data providers like SqlClient, OleDb and Odbc.
JQuery is a JavaScript library that simplifies HTML document manipulation, event handling, animations, and Ajax interactions. It works across browsers and makes tasks like DOM traversal and manipulation, event handling, animation, and Ajax much simpler. JQuery's versatility, extensibility, and cross-browser compatibility have made it popular, with millions of developers using it to write JavaScript.
This document provides an overview of the Abstract Window Toolkit (AWT) in Java. It discusses AWT components like frames, panels, buttons, checkboxes, lists, text fields, scrollbars and layout managers like flow, border, grid and card layouts. The document also provides examples of creating AWT windows and using various AWT components and layout managers to design graphical user interfaces.
The document provides an overview of the Abstract Windowing Toolkit (AWT) in Java, including:
1. AWT allows the creation of graphical user interfaces and provides containers, components, layout managers, graphics capabilities, and event handling.
2. Common containers include frames, panels, dialogs. Common components include labels, text fields, text areas, buttons, checkboxes, lists.
3. Layout managers like flow, border, grid, card and gridbag layouts are used to position components in containers.
4. Events in AWT are handled through interfaces like action listener, item listener and mouse listener. Programmers implement the appropriate listener interface.
The document discusses exception handling in Java. It defines exceptions as abnormal conditions that arise during runtime and disrupt normal program flow. There are three types of exceptions: checked exceptions which must be declared, unchecked exceptions which do not need to be declared, and errors which are rare and cannot be recovered from. The try, catch, and finally blocks are used to handle exceptions, with catch blocks handling specific exception types and finally blocks containing cleanup code.
Collections Framework is a unified architecture for managing collections, Main Parts of Collections Framework
1. Interfaces :- Core interfaces defining common functionality exhibited by collections
2. Implementations :- Concrete classes of the core interfaces providing data structures
3. Operations :- Methods that perform various operations on collections
A thread is an independent path of execution within a Java program. The Thread class in Java is used to create threads and control their behavior and execution. There are two main ways to create threads - by extending the Thread class or implementing the Runnable interface. The run() method contains the code for the thread's task and threads can be started using the start() method. Threads have different states like New, Runnable, Running, Waiting etc during their lifecycle.
The document discusses Java event handling and the delegation event model. It describes key concepts like events, sources that generate events, and listeners that handle events. It provides examples of registering components as listeners and implementing listener interfaces. The delegation event model joins sources, listeners, and events by notifying listeners when sources generate events.
This presentation introduces some concepts about the Java Collection framework. These slides introduce the following concepts:
- Collections and iterators
- Linked list and array list
- Hash set and tree set
- Maps
- The collection framework
The presentation is took from the Java course I run in the bachelor-level informatics curriculum at the University of Padova.
This document discusses arrays in Java programming. It covers defining and creating single and multi-dimensional arrays, accessing array elements using indexes and loops, and performing operations like sorting and finding maximum/minimum values. Examples are provided for different array types like integer, string and character arrays, and operations like input/output, break/continue statements, and star patterns. Homework involves writing a program to produce a given output pattern.
SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. It is often used for local/client storage in applications. Key points:
- Created by D. Richard Hipp, it provides a lightweight disk-based database that doesn't require a separate server process and allows accessing the database using SQL queries.
- The entire database is stored in a single cross-platform file and can be as small as 0.5MB, making it suitable for embedded and mobile applications.
- It supports common data types like NULL, INTEGER, REAL, TEXT, and BLOB and is used in standalone apps, local
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
This document discusses I/O streams in Java. It defines streams as sequences of bytes that flow from a source to a destination. Streams can be categorized as character streams for text data or byte streams for raw binary data. Streams are also categorized as data streams that act as sources or destinations, or processing streams that alter or manage stream information. The Java IO package contains classes for defining input and output streams of different types.
The document discusses exception handling in programming. It defines different types of errors like syntax errors, semantic errors, and logical errors. Runtime errors can occur due to issues like division by zero. Exception handling involves finding and throwing exceptions using try, catch, and throw keywords. The catch block handles the exception. Common Java exceptions include NullPointerException, FileNotFoundException, and ArrayIndexOutOfBoundsException.
Properties are named members of classes, structures, and interfaces. Member variables or methods in a class or structures are called Fields. Properties are an extension of fields and are accessed using the same syntax. They use accessors through which the values of the private fields can be read, written, or manipulated.
An indexer allows an object to be indexed such as an array. When you define an indexer for a class, this class behaves similar to a virtual array. You can then access the instance of this class using the array access operator ([ ]).
This document provides an overview of Applets and Java GUI programming. It discusses Applets, their life cycle, how to run Applets using AppletViewer and HTML, and classes used in Applet programming like Applet, Graphics, Color, Font, and AWT components. It also covers Swing components like JApplet, JComponent, JLabel, JTextField, JButton, and JRadioButton. Code examples and demonstrations are provided for many of the concepts discussed.
Java Collections | Collections Framework in Java | Java Tutorial For Beginner...Edureka!
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Java Collections” will talk about the complete hierarchy of Collections Frameworks in Java. It will walk you through the various fundamentals of collections like Lists, Queue, Sets, Interfaces etc. Through this tutorial you will learn the following topics:
Java Collection Framework
Collection Framework Hierarchy
Interfaces
List
Queue
Set
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
This document discusses JavaScript events and event listeners. It begins with an introduction that defines events as notifications that specific actions occurred, like user or browser actions. Event handlers are scripts that are executed in response to events. Events can be used to trigger JavaScript code that responds to user interactions. The document then provides examples of common event types like onclick, onsubmit, onmouseover, onmouseout, focus, and blur. It also discusses how to add and remove event listeners using addEventListener() and removeEventListener() methods. The document concludes with an example demonstrating how events can be used to change an HTML element in response to user clicks.
This document discusses graphics programming in Java. It covers the applet and AWT packages used for drawing graphics. Methods like drawString(), drawLine(), drawRect(), fillOval() and setColor() are described for drawing different shapes and text. Sample code is provided to demonstrate using these methods to draw lines, rectangles, ovals and changing color in an applet. The document serves as an introduction to graphics programming concepts in Java.
This document provides an overview of threads in Java, including:
- Threads allow for multitasking by executing multiple processes simultaneously. They are lightweight processes that exist within a process and share system resources.
- Threads can be created by extending the Thread class or implementing the Runnable interface. The run() method defines the code executed by the thread.
- Threads transition between states like new, runnable, running, blocked, and dead during their lifecycle. Methods like start(), sleep(), join(), etc. impact the thread states.
- Synchronization is used to control access to shared resources when multiple threads access methods and data outside their run() methods. This prevents issues like inconsistent data.
This document discusses ADO.NET, which is a data access technology that allows applications to connect to and manipulate data from various sources. It describes the core ADO.NET objects like Connection, Command, DataReader, DataAdapter, DataSet and DataTable. It also explains the differences between connected and disconnected data access models in ADO.NET, detailing the objects used in each approach and their advantages. Finally, it provides an overview of commonly used .NET data providers like SqlClient, OleDb and Odbc.
JQuery is a JavaScript library that simplifies HTML document manipulation, event handling, animations, and Ajax interactions. It works across browsers and makes tasks like DOM traversal and manipulation, event handling, animation, and Ajax much simpler. JQuery's versatility, extensibility, and cross-browser compatibility have made it popular, with millions of developers using it to write JavaScript.
This document provides an overview of the Abstract Window Toolkit (AWT) in Java. It discusses AWT components like frames, panels, buttons, checkboxes, lists, text fields, scrollbars and layout managers like flow, border, grid and card layouts. The document also provides examples of creating AWT windows and using various AWT components and layout managers to design graphical user interfaces.
The document provides an overview of the Abstract Windowing Toolkit (AWT) in Java, including:
1. AWT allows the creation of graphical user interfaces and provides containers, components, layout managers, graphics capabilities, and event handling.
2. Common containers include frames, panels, dialogs. Common components include labels, text fields, text areas, buttons, checkboxes, lists.
3. Layout managers like flow, border, grid, card and gridbag layouts are used to position components in containers.
4. Events in AWT are handled through interfaces like action listener, item listener and mouse listener. Programmers implement the appropriate listener interface.
The document discusses the Abstract Window Toolkit (AWT) in Java. Some key points:
- AWT allows developing graphical user interfaces (GUIs) in Java and its components are platform-dependent.
- The AWT class hierarchy includes Component, Container, Window, Panel, Frame, and Dialog classes. Containers hold other components.
- Layout managers determine how components are arranged. Common layouts include flow, grid, border, and card layouts.
This chapter introduces the Abstract Window Toolkit (AWT) in Java. It discusses creating windows and frames using AWT classes. It covers working with graphics, colors, fonts, and layout managers. It also discusses using AWT controls like buttons, checkboxes, lists, menus and dialog boxes. The chapter describes handling events by extending AWT components and exploring controls, menus and layout managers in more detail.
This document discusses controls in the AWT (Abstract Window Toolkit) framework in Java. It describes how to add controls to windows by calling the add() method on Container. The core AWT controls are labels, push buttons, check boxes, choice lists, lists, and scroll bars. Labels are the simplest control and are used to display read-only text. Buttons generate action events when pressed that can be listened for. The document includes examples of how to create and add labels and buttons as controls in a Java application.
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 provides an overview of the Abstract Window Toolkit (AWT) in Java. It discusses AWT classes for creating and managing windows, graphics, controls, menus, and events. Key topics include the Component and Container class hierarchies, creating Frame windows, setting window properties, working with colors and fonts, using controls like buttons and lists, layout managers, and handling events. The document also provides examples of creating a windowed application and displaying information within windows using AWT graphics methods.
The document discusses 4 common layout managers in AWT: FlowLayout, GridLayout, BorderLayout, and BoxLayout. It provides details on how each layout manager arranges and positions components within a container. Code examples are given to demonstrate implementing each layout manager. The document is intended to help students understand how to define and use layout managers to structure the UI design of an AWT application.
The document discusses different layout managers in Java including BorderLayout, GridLayout, FlowLayout, BoxLayout, CardLayout, GridBagLayout, SpringLayout, and GroupLayout. It provides details on the constructors and commonly used methods of each layout manager, along with examples of how to use each one. Key information covered includes how each layout positions and sizes components within a container.
This document provides an overview of Swing components for creating graphical user interfaces in Java. It discusses top-level containers like JFrame and JDialog, general purpose containers like JPanel and JScrollPane, basic controls for user input like JTextField and JButton, components for displaying information like JLabel and JTable, and various layout managers including FlowLayout, BorderLayout, GridLayout, BoxLayout, and GridBagLayout. It also covers using borders with components and implementing listeners for text fields. The document is intended to teach what is needed to create full-featured GUIs with Swing.
The document discusses various GUI components and layout managers in Java's Abstract Window Toolkit (AWT). It describes common components like labels, buttons, checkboxes, lists, text fields, and text areas. It also covers container classes, panels, and different layout managers including flow, border, grid, card and inset layouts. The layout managers are responsible for positioning and sizing components within containers when the application is resized.
This document discusses layout managers in AWT. It describes four common layout managers: FlowLayout, which arranges components horizontally from left to right; GridLayout, which divides a container into a grid of equal rows and columns; BorderLayout, which divides a container into five regions (north, south, east, west, center); and BoxLayout, which arranges components vertically or horizontally within a container. It provides code examples of using each layout manager.
Java Swing is a GUI toolkit that is used to create window-based applications. It is built on top of AWT and provides more powerful and lightweight components like tables, lists, scroll panes etc. Swing components are platform-independent and follow the MVC architecture. Common Swing components include JButton, JTextField, JTextArea and common layouts include FlowLayout, BorderLayout, GridLayout etc. Menus in Swing can support keyboard navigation using mnemonics and shortcuts using accelerators.
Implement a Javascript application that allows the user to enter strin.docxmckerliejonelle
Implement a Javascript application that allows the user to enter strings into a variable number of input widgets. As a string is entered by the user its length is automatically displayed next to the input widget. Buttons are provided to control the interface and to provide some functionality. . Clicking one button will add another input widget Clicking another button will remove an input widget, always leaving at least one input widget. . Clicking anther button will cause the visible strings to be sorted As a convenience to the user, the application will remember the string entered into a widget even after the widget is removed. If the widget is added back again, then the saved value will be displayed in the widget. But, be careful, the saved strings do not participate in a sort operation if not visible. Provide styling that will approximately center the visible components. Also, change the default color for the background. Organize the application in three files: the HTML file that is the user interface to the application; a file with most of the Javascript code; a file with the styling rules.
Solution
<HTML>
<HEAD>
<TITLE> My Program in Java Script </TITLE>
<SCRIPT language=\"javascript\">
function addNewRow(tableID) {
var table = document.getElementById(tableID);
var count_row = table.rows.length;
var row = table.insertRow(count_row);
var cell1 = row.insertCell(0);
var element1 = document.createElement(\"input\");
element1.type = \"checkbox\";
element1.name=\"check_box[]\";
cell1.appendChild(element1);
var cell2 = row.insertCell(1);
cell2.innerHTML = count_row + 1;
var cell3 = row.insertCell(2);
var element2 = document.createElement(\"input\");
element2.type = \"text\";
element2.name = \"txtbox[]\";
cell3.appendChild(element2);
}
function deletePreviousRow(tableID) {
try {
var table = document.getElementById(tableID);
var count_row = table.rows.length;
for(var i=0; i<count_row; i++) {
var row = table.rows[i];
var check_box = row.cells[0].childNodes[0];
if(null != check_box && true == check_box.checked) {
table.deletePreviousRow(i);
count_row--;
i--;
}
}
}catch(e) {
alert(e);
}
}
</SCRIPT>
</HEAD>
<BODY>
<INPUT type=\"button\" value=\"Add Row\" onclick=\"addNewRow(\'myTable\')\" />
<INPUT type=\"button\" value=\"Delete Row\" onclick=\"deletePreviousRow(\'myTable\')\" />
<TABLE id=\"myTable\" width=\"350px\" border=\"1\">
<TR>
<TD><INPUT type=\"checkbox\" name=\"chk\"/></TD>
<TD> 1 </TD>
<TD> <INPUT type=\"text\" /> </TD>
</TR>
</TABLE>
</BODY>
</HTML>
.
This document discusses graphical user interface (GUI) components in Java and layout managers. It provides descriptions of common GUI components like JLabel, JTextField, JButton, JCheckBox, and JComboBox. It then explains several layout managers - BorderLayout, CardLayout, FlowLayout, GridLayout, GridBagLayout, GroupLayout, and SpringLayout - and provides their class declarations.
This document provides information about the Advanced Java Programming course including the teaching and examination scheme, chapter details, and content about Abstract Windowing Toolkit (AWT) and Swings. The teaching scheme covers 5 chapters worth 100 marks total. The first chapter on AWT and Swings is worth 24 marks and covers designing graphical user interfaces using AWT and Swing components, arranging components using different layouts, and details on common AWT classes like Container, Panel, Frame, and controls like Buttons, Checkboxes, and Lists.
This document discusses labels and buttons in Java. It covers adding controls to windows, the different types of controls including labels and buttons, and how to handle button events. Labels are used to display text while buttons generate action events when pressed. The code examples demonstrate how to create labels and buttons, set their text/labels, add them to windows, and handle button press events.
The document discusses the Java Abstract Window Toolkit (AWT). It describes that AWT is used to create graphical user interface applications in Java and its components are platform dependent. It then lists and describes various AWT components like containers, frames, panels, labels, buttons, checkboxes, lists, text fields, text areas, canvases and scroll bars. It also discusses how to create frames using inheritance and association. Finally, it provides examples of using buttons, text fields and text areas in AWT applications.
This document provides an overview of the Abstract Window Toolkit (AWT) in Java. It discusses key AWT classes like Window, Frame, Dialog, Panel, Canvas and their uses. It also covers common AWT controls like labels, text fields, buttons, checkboxes and lists. Layout managers, events and listeners in AWT are explained. The document is intended as an introduction to working with windows, graphics and GUI components using the AWT toolkit in Java.
This document discusses Java's GUI components and how to create basic buttons and labels. It provides details on:
- Java's GUI components include labels, text fields, buttons, and containers like frames and panels
- Buttons can be created and added to frames or panels, and listeners can be assigned to detect button clicks
- Labels are used to display text, text fields allow for single-line text input, and text areas are for multi-line text
Similar to Dr. Rajeshree Khande :Introduction to Java AWT (20)
This document discusses inheritance, operator overloading, and overriding in F#. It provides an example of defining a Person base class and Student and Teacher subclasses that inherit from Person. It also defines a Complex class that overloads the + and - operators. Finally, it shows how to override a base class method in a subclass by declaring it as abstract and overriding.
The document discusses exception handling in .NET F# including try/with, try/finally, raising exceptions, and common exception types. It provides examples of handling different exceptions using try/with blocks and raising custom exceptions. The key constructs for exception handling in F# are covered including basic syntax, matching exception patterns, and ensuring cleanup code executes.
The document discusses events, creating custom events, and processing event streams in F#. It provides an overview of events, how they allow objects to communicate asynchronously, and how to create and handle events through the Event class. It also covers creating custom events for a Worker class to notify when the name or shift changes, attaching callback functions to event handlers, and an example of implementing an interface using events.
This document discusses classes in F# including:
- Constructors are used to initialize class properties and fields when an object is created. Classes can use implicit or explicit constructor syntax.
- Implicit syntax fuses the constructor with the class body while explicit syntax requires declaring fields and constructors separately.
- Let and do bindings execute initialization code during object construction. Fields created by let bindings can be accessed throughout the class.
- Methods can take parameters, call other methods, and be parameterless. Methods support curried or tuple parameter passing forms.
An abstract class is a base class that is meant to be inherited from but cannot be instantiated. It may contain implemented and unimplemented members, with unimplemented members denoted as abstract. Derived classes must implement all abstract members. An interface defines a contract that classes can implement but contains no implementation. Classes implementing an interface must provide method bodies for all interface members. Interfaces can inherit other interfaces.
The document discusses generic classes in F#. It explains that generics allow code to work with any data type without repeating code for each type. It provides examples of generic methods, functions, classes, records, and discriminated unions. It demonstrates how to define a generic method, record, and class. The examples show how to specify type parameters and how the compiler infers types when they are not explicitly provided.
This document discusses delegates in F#. It defines delegates as special functions that encapsulate a method and represent a method signature, similar to function pointers in C/C++. It provides three ways to define delegates and describes simple and multicast delegates. Examples are given to demonstrate defining static and instance methods, defining delegates to reference those methods, and invoking delegates to call the methods. Delegates allow methods to be passed as arguments and attached to functions or methods at runtime.
The document discusses mutable dictionaries in F#. It describes how to create a dictionary, add/remove items from a dictionary, retrieve items from a dictionary, and handle exceptions when accessing non-existent items. It provides examples of creating a dictionary of students by name and accessing dictionary properties like count and keys. It also shows methods for adding, removing, and checking for keys/values and provides an example of a dictionary storing atomic elements by name and weight.
The document discusses mutable lists and dictionaries in F#. It describes lists as mutable collections that can be resized and allow adding elements using methods like Add. Lists are implemented as resizable arrays under the hood. The List<T> class provides properties like Count and Capacity and methods for adding, removing, and accessing elements. Dictionaries are also mutable and map keys to values, providing similar functionality to lists.
The document discusses lists vs arrays in F#, summarizing that:
- Arrays provide constant-time lookups but fixed size, while lists allow variable sizes but are slower;
- Lists are immutable and allow efficient prepending, while mutating arrays is less efficient;
- Multidimensional arrays come in rectangular (same sizes) and jagged (varying row sizes) forms.
Searching arrays uses functions like Array.find to retrieve elements matching a condition. The example shows encrypting a string using ROT13 array indexing.
This document discusses arrays in F# and provides examples of creating and manipulating arrays. It covers:
1. Three ways to create arrays - with semicolon separators, without separators, and using sequence expressions.
2. Accessing array elements using dot notation and indexes, and slice notation to access subranges.
3. Common functions for creating arrays like Array.create, Array.init, and Array.zeroCreate.
4. Other useful functions like Array.copy, Array.append, Array.map, Array.filter, and Array.reverse.
5. An example showing the Apartment type and creating an array of apartments to demonstrate array functions.
The document discusses various ways to create and initialize lists in F#:
1. Using list literals by specifying values separated by semicolons in square brackets.
2. Using the cons (::) operator to prepend values to an existing list or empty list [].
3. Using the List.init method of the List module, which takes the desired length and an initializer function to generate list items.
This document provides an introduction to Microsoft Word 2007 and its features. It covers topics such as creating documents using templates, performing basic tasks, inserting and editing pictures and tables, formatting text, working with language tools like spelling and grammar check, inserting headers and footers, and mail merge. Practical assignments are included at the end to help learners practice different Word functions like formatting text, inserting tables, sorting data, and using mail merge.
The document discusses the String class in Java. It states that a String represents a sequence of characters and belongs to the java.lang package. Character sequences can be represented using character arrays, but character arrays do not support the full range of string operations. In Java, strings are class objects implemented using the String and StringBuffer classes. Strings are immutable while StringBuffers are mutable and support modifying string contents.
The document describes various component constructor methods in Java including Labels, Buttons, TextFields, Checkboxes, RadioButtons, Lists, Dropdown Lists, TextAreas, and Scroll Bars. It provides the constructor syntax and key methods for each component type.
The document discusses reading input from the keyboard in Java programs. It covers using the BufferedReader and InputStreamReader classes to get user input as a String. It also discusses extracting separate data items from the input String using a StringTokenizer and converting the items to primitive types using wrapper classes. An example is provided that reads numerical data from the keyboard as a String, uses StringTokenizer to separate the items, and wrapper classes to convert them to ints to calculate a result.
Java Evolution
Java was originally developed by Sun Microsystems in 1991 under the name Oak as a language for programming consumer electronics. It was later renamed to Java and became best known as a language for developing applications and applets to run on web browsers over the Internet. Key features of Java include being platform-independent, object-oriented, robust, secure, and having a rich class library. Java applications are compiled to bytecode that runs on a Java Virtual Machine, allowing them to run on any platform that supports Java.
This document discusses exception handling in Java. It defines exceptions as runtime errors that disrupt normal program flow. Exceptions are represented as objects that can be thrown and caught. There are two main types of exceptions - checked exceptions which must be handled, and unchecked exceptions which do not require handling. The try, catch, and finally keywords are used to define exception handling blocks to catch exceptions and define error recovery. Custom exceptions can also be created by extending the Exception class.
This document provides an overview of data types, variables, and constants in Java. It discusses the primitive data types like int, float, boolean and char. It describes how to declare variables, assign values, and the rules for compatible data types. The document also covers strings, literals, escape sequences and constants. It explains implicit and explicit type casting, operator precedence and mixed-type arithmetic expressions. Finally, it provides an introduction to arrays, including how to declare, assign values to, and access array elements.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Dr. Rajeshree Khande :Introduction to Java AWT
1. AWT :Abstract Window ToolKit
AWT is collection of classes and methods that allows
to create & manage window.
AWT provide support for Applet.
AWT contains support for windows_ based Graphical Interface.
To use the AWT classes & method we have to import
awt package as
import java.awt.*;
1RAJESHREE KHANDE
2. AWT:classes
Different window classes are defined by AWT which add
functionality with each level.
Component
Container
Window Panel
Frame Applet
2RAJESHREE KHANDE
4. AWT:classes
Component :
It’ an abstract class.
All GUI component that interact with user are
subclasses of component class.
Defines various methods for managing event such
as keyboard & mouse input.
Also defines attribute to store current foreground
& background colors and fonts
4RAJESHREE KHANDE
5. AWT:classes
Container:
Inherits various methods & attribute of component
class
Having additional methods of nesting other
component object.
A container position various GUI component
within it with the help of different Layout manager
5RAJESHREE KHANDE
6. AWT:classes
Panel :
It is a window which does not contain title bar,
menu bar, border.
It is super class of Applet class.
Any screen output written on applet is drawn on
the surface of panel object.
AppletViewer provide titlebar & border to an
applet.
We add GUI component such as buttons ,list box
to a panel.
6RAJESHREE KHANDE
7. AWT:classes
Window :
Window class is used to create top level window.
Window object are not created directly.
Subclass of window is used to place on desktop.
7RAJESHREE KHANDE
8. AWT:classes
Frame:
It is subclass of window.
It has title bar , menu bar & border etc
To create a normal window in Java application Frame class
is used.
In Applet we does not use Frame class, since AppletViewer
provide titlebar, menubar & boarder to an applet.
8RAJESHREE KHANDE
9. AWT:classes
Canvas:
It is not subclass of window or panel.
It is another type of window.
This widow is blank window upon which we can
draw.
9RAJESHREE KHANDE
10. Layout Managers
It is an object which determine the way that
component are arranged in frame window.
It arranges a control within a window using some
type of an algorithm.
Each window has a layout manager associated with
it.
10RAJESHREE KHANDE
11. Layout Managers
LayoutManager is set by the setLayout() method
to a window.
syntax
void setLayout(LayoutManager layobj)
If it is not set then default layout manager is used
If layobj parameter set to null then control are
positioned manually using the setBound() method
11RAJESHREE KHANDE
12. LayoutManager Classes
1.FlowLayout
Default frame layout.
Places Components in successive rows in window fitting as
many as in each row as possible.
When the row is full it start fitting the components on the
next row.
This is similar to how word flow in text editor
A small space is left in each component.
12RAJESHREE KHANDE
13. LayoutManager Classes :FlowLayout
Following are constructor for FlowLayout.
1. FlowLayout()
Centers all component and leves 5 pixel space between each component
2. FlowLayout(int align)
Flowlayout.LEFT
Flowlayout.CENTER
Flowlayout.RIGHT
Flowlayout.LEADING
Flowlayout.TRAILING
3. FlowLayout(int align, int hspace, int vspace)
Example
13RAJESHREE KHANDE
14. LayoutManager Classes :BorderLayout
Frame is divided into north, south, east, west, and
center
Components are placed by the programmer in the
desired location using the add method
14RAJESHREE KHANDE
16. LayoutManager Classes :BorderLayout
Following are constructor for BorderLayout
1) BorderLayout()
2) BorderLayout(int hspace, int vspace)
To add a component in BorderLayout use following
format of add() method
Syntax :
void add(Component-obj, Object Region)
16RAJESHREE KHANDE
17. LayoutManager Classes :BorderLayout
Where region specifies following five
constant:
1. BorderLayout.EAST
2. BorderLayout.WEST
3. BorderLayout.SOUTH
4. BorderLayout.NORTH
5. BorderLayout.CENTER
Example
17RAJESHREE KHANDE
19. LayoutManager Classes
:GridLayout
GridLayout uses following Constructor
1) GridLayout()
Creates a single column grid Layout
2) GridLayout(int nrows, int ncols)
Creates a grid layout with specified no. of rows and
columns
3) GridLayout(int nrows, int ncols, int hspcae, int vspace)
Creates a grid layout with specified no. of rows and
columns and specifies horizontal and vertical space
between the component
19RAJESHREE KHANDE
21. AWT Component
Adding a control
1. Create an instance of desired control
2. Then add it to window by calling add() method which is define by
container
3. The add method has several form
4. Once the control has been added it will be automatically visible
whenever it’s parent window is display
Syntax
Component add(Component compObj)
21RAJESHREE KHANDE
22. AWT Component
Removing a control
If control no longer need we will remove that control
by remove() method
This method also defined by Container class
Syntax
void remove (Component compObj)
We can remove all controls by removeAll() method
22RAJESHREE KHANDE
23. AWT Component
Responding to controls
1. All control except label generates events when they
are accessed by user.
2. In general , your program simply implements the
appropriate interface & register an event listener
for each control that need to monitor.
23RAJESHREE KHANDE
24. AWT Component
Label
1. It is an object type Label
2. It is a passive control
3. Do not support any interaction
Following Constructor
1. Label() : Construct blank label
2. Label(String) : construct a label containing string
3. Label(String, int) :
Alignment
( Label.LEFT,Label.RIGHT,
Label.CENTER) 24RAJESHREE KHANDE
25. AWT Component :Label
Methods
Sr.
No
Methods Description
1 void setText(String) Set or change a text of label
2 String getText() Obtain the text of label
3 void setAlignment(int) Set or change the alignment
of text in the label
4 int getAlignment() Obtain the current alignment
25RAJESHREE KHANDE
26. AWT Component :Push Button
1. It is push button component
2. Contain a label
3. Generate a event when it is pressed
4. It is an object of type Button
5. Button defines two constructor
1. Button() : Create a buttton without label
2. Button (String str) :Creates a button with label
26RAJESHREE KHANDE
27. Methods
Sr.
No
Methods Description
1 void setLabel(String) Set or change a label of
Button
2 String getLabel() Obtain the label Button
AWT Component :Push Button
27RAJESHREE KHANDE
28. AWT Component :TextField
TextField class is used to create a single line text
entry edit box.
Constructor
1. TextField() : Creates a default textfield
2. TextField(int) : Creates a textfield which wide as
specified number of characters.
3. Textfield(String) : Creates a textfield with specified
string initially.
4. TextField(String, int) : Creates a textfield with initial
text and set it’s width.
28RAJESHREE KHANDE
29. AWT Component :TextField
Methods
Sr.
No
Methods Description
1 String getText() Return the content of TextField.
2 void setText(String) Set or change the text of TextField.
3 String getSelectedText() To get currently selected text
4 void select(int startIndex, int
endIndex)
To select portion of text
5 boolean isEditable() To determine editability
6 void setEditable(boolean) To set or reset editability 29RAJESHREE KHANDE
30. AWT Component :TextField
Example1 :Button and Label
Example2 : Conversion to binary ,Hexadecimal, Octal
Example 3: Converting String to Uppercase and
Lowercase
30RAJESHREE KHANDE
31. AWT Component :Check Box
Used to toggle an option
A Checkbox class is used to create an object
Constructor
1. Checkbox() :
Creates a checkbox without label.
2. Checkbox(String) :
Creates a checkbox with label specified initial state is
unchecked.
3 Checkbox(String, boolean) :
Creates a checkbox with label specified initial state is
either true or false.
31RAJESHREE KHANDE
32. AWT Component :Check Box
Methods
Sr.
No
Methods Description
1 Boolean getState() Retrieve the current state
2 void setState(boolean) Set the state true or false
3 String getLabel() Retrieve the label associated
4 Void setLabel(String) Sets the label as specified
32RAJESHREE KHANDE
33. AWT Component :CheckBoxGroup
It is also called radio buttons
CheckBoxGroup class is used to create group of
check boxes.
From list of choices we select only one at a time.
Constructor
CheckboxGroup()
e.g.
CheckBoxGroup cbg = new CheckBoxGroup()
c1 = new Checkbox("check-1“,cbg,true);
c2 = new Checkbox("check-2“,cbg,false);
c3 = new Checkbox("check-3“,cbg,false);
33RAJESHREE KHANDE
34. AWT Component :CheckBoxGroup
Method :
1)getSelectedCheckbox() : determine which
checkbox in a group is currently selected
Checkbox getSelectedCheckbox()
2)setSelectedCheckbox() : set a check box
void setSelectedCheckbox(Checkbox obj))
34RAJESHREE KHANDE
35. AWT Component :List
Provide a list of items, which can be scrolled
From list of items single or multiple item can be
selected.
Constructor
1. List() : Creates a listbox in which single selection is
possible.
2. List(int) :Creates a listbox , specified number of
items always to visible selection.
Selection is possible
35RAJESHREE KHANDE
36. AWT Component :List
3. List(int, boolean) :
Specified no. of items
To be visible
Specifies wheather
multiple selection is
allowed
True Indicate multiple
Selection
36RAJESHREE KHANDE
37. AWT Component :List
Sr.
No
Methods Description
1 Void add(string) Add item to the end of list
2 Void add(String,int) Add the item at the index specified
in second parameter.
3 String getSelectedItem() Returns a string which is selected
4 int getSelectedIndex() Return an index of selected item
5 String[] getSelectedItems() Returns an array contains string
which are selected.(Multiselect)
37RAJESHREE KHANDE
38. AWT Component :List
Sr.
No
Methods Description
6 Int[] getSelectedIndexes() Returns an array containing
indexes of selected items.
7 Int getItemCount() Returns no. of items in the list
8 Void select(int) Select the item of specified index
9 String getItem(int) Obtain the name of item having
specified index.
38RAJESHREE KHANDE
40. AWT Component :Choice list
The class Choice is used to create a drop-down or
pop-up list of string
It requires less space than the list box control
It uses only default constructor
Choice()
40RAJESHREE KHANDE
41. AWT Component :Choice list
Sr.
No
Methods Description
1 void add(String) To add a string in choice list
2 String getSelectedItem() Determine which item is currently selected
3 int getSelectedIndex() Determine the index of currently selected
item.
4 int getItemCount() Returns no. of items in the list
5 void select(int) Select the item whose index is specified
6 void select(String) Select the item match with string parameter
7 String getItem(int) Obtain the name associated with the item at
specified index
41RAJESHREE KHANDE
43. AWT Component :TextArea
TextArea class is used to create a multiline textbox
Following constructor are available
1. TextArea() :
Creates a default TextArea
2. TextArea(int, int) :
Creates a TextArea with specified no. of lines &
characters.
43RAJESHREE KHANDE
44. AWT Component :TextArea
3. TextArea(String) :
Create with initial string.
4. TextArea(Sring, int, int) :
Creates a TextArea with initial string and for
specified no. of lines & characters.
5. TextArea(String, int numlines, int nchar, int s bars)
Creates a TextArea with Scroll Bars. The value of
sBars must be one of the following
SCROLLBAR_BOTH, SCROLLBAR_NONE,
SCROLLBAR_HORIZONTAL_ONLY,
SCROLLBAR_VERTICAL_ONLY
44RAJESHREE KHANDE
45. AWT Component :TextArea
Support all the methods of TextField & some
additional method
Sr.
No
Methods Description
1 void append(String) Append Specified string at the
end.
2 void insert(string,int) Insert a string at specified index
3 void replace(String, int
startIndex, endIndex)
It replaces the character from
start index to end with given
string
45RAJESHREE KHANDE
46. AWT Component :Scroll Bars
Scrollbar class is used to create scrollbar.
Scrollbar may be either vertical or horizontal.
Constructor
1. Scrollbar() :
Create vertical scrollbar.
2. Scrollbar(int style) :
Create a scrollbar of specified style. It can be
Scrollbar.HORIZONTAL
Scrollbar.VERTICAL
46RAJESHREE KHANDE
47. AWT Component :Scrollbar
3. Scrollbar(int style, int start, int thumb,int min, int max) :
Create a scrollbar with specified style.
Initial Value Thumbsize
47RAJESHREE KHANDE
48. AWT Component :Scrollbar
Sr.
No
Methods Description
1 int getValue() To get the current value of scroll bar
2 void setValue(int) Set new value
3 int getMinimum() To get minimum value of scrollbar
4 int getMaximum() To get maximum value of scrollbar
5 void setUnitIncrement(int) To change unit increment.
Default is 1
6 void setBlockIncrement(int) To change block increment.
Default is 10
48RAJESHREE KHANDE
49. Graphics
AWT support a rich assortment of Graphics methods.
All graphics are drawn relative to window.
This can be main window of an applet, Child window
of an applet or stand alone application window
The origin of window is at the Top-left corner and is
(0,0).
Co-ordinates is specified in pixel.
All output to a window takes place through a
graphics context.
49RAJESHREE KHANDE
50. Graphics
Graphics Context is encapsulated by Graphics class &
is obtained in two ways.
1. It is passed to an applet when one of it’s various
methods, such as paint() or update() .
2. It is returned by getGraphics() method of Component
The Graphics class defines the a number of
drawing functions
Each shape can be drawn edge-only or filled
50RAJESHREE KHANDE
51. Graphics
Object are drawn and filled in currently selected
graphics color, which is black by default.
When a graphics object is drawn that exceeds the
dimension of the window, output is automatically
clipped
51RAJESHREE KHANDE
52. Drawing Lines
Lines are drawn by means of the drawLine() method
void drawLine(int startX, int startY,int endX, endY)
drawLine() display a line in the current drawing
color.
Example
52RAJESHREE KHANDE
53. Drawing Rectangle
drawRect() method display an outline of rectangle
fillRect() method filled the rectangle.
void drawRect(int top,int left,int width, int height)
void fillRect(int top, int left, int width, int height)
The upper-left corner of the rectangle is top,left
The dimension of the rectangle are specified by
width and height.
53RAJESHREE KHANDE
54. Drawing Rounded Rectangle
To draw Rounded Rectangle use drawRoundRect() of
fillRoundRect().
void drawRect(int top,int left,int width, int height)
void fillRect(int top, int left, int width, int height)
54RAJESHREE KHANDE
55. LayoutManager Classes
:CardLayout
CardLayout
-- Display containers you pass to it as card.
-- You give each card a name.
-- The card are typically held in an object of type Panel
-- We can move from card to card with the Card’s
layout show() method.
--We can also display specific cards using first , last, next & previous
method of CardLayout.
55RAJESHREE KHANDE
56. is encapsulated by graphics class & is obtained in two
ways.
56RAJESHREE KHANDE
57. LayoutManager Classes
:CardLayout
Constructor
1) CardLayout() :
creates new card layout
2) CardLayout(int hspace,int vspace)
creates new card layout with given horizontal and
vertical space
57RAJESHREE KHANDE
58. LayoutManager Classes
:CardLayout
Step for CardLayout
1. Create a panel that contains a deck and panel for each card
in the deck.
2. Add to the appropriate panel the components that form
each card.
3. Then add these panels to the panel for which CardLayout is
the layout manager
4. Finally you add this panel to window
5. To select between the cards ,include one push button for
each card in the deck.
58RAJESHREE KHANDE
59. LayoutManager Classes
:CardLayout
When panels are added to panel, they are given a name.
So use the following add method
Void add(Component panelObj, Object name)
Name of the card whose
panel is specified by
panelObj
59RAJESHREE KHANDE
60. LayoutManager Classes
:CardLayout
After deck creation, you can activate a card by
calling one of the method defined by CardLayout
1. void first(Container deck)
2. void last(Container deck)
3. void next(Container deck)
4. void previous(Container deck)
5. void show(Container deck,String cardName) 60RAJESHREE KHANDE
61. LayoutManager Classes
:CardLayout
deck : is the reference to the container(usually panel)
that holds the card
cardName : is the name of the card
Example
61RAJESHREE KHANDE
62. Scrollbars
The leftmost position of a horizontal scrollbar
corresponds to some integer value and the rightmost
position corresponds to a larger integer value
Scrollbars can be displayed vertically
User movement options
Clicking either end button causes bubble to move in
unit increments.
Clicking the are between bubble and end button
causes movement in 10 unit increments
Clicking and dragging the bubble in the desired
direction
62RAJESHREE KHANDE
63. Using Inheritance
It is possible to use inheritance to allow
TwoButtons to become a frame in its own
right
Note that the UML diagram will show
TwoButtons as a subclass of Frame
You will need to use super()to set the
frame title
63RAJESHREE KHANDE