An event is defined as the act of changing the state of an item or behavior. A button click, cursor movement, key press via keyboard, or page scrolling are all examples of actions. Various event classes can be found in the java.awt.event package. Event Handling Components: There are three major components to event management. An […]
August 12, 2022 | Java | No comments
JApplet is a public java swing class created for developers often developed in Java. JApplet is usually written in Java byte code and executed using a Java virtual machine (JVM) or Applet reader from Sun Microsystems. It was initially released in 1995. JApplet can be developed in any programming language and then compiled into Java […]
August 12, 2022 | Java | No comments
java.awt.Graphics class in Applet has methods for working with graphics. Methods of the Graphics class: Method Description public abstract void drawString(String str, int x, int y) Draws the provided string. public void drawRect(int x, int y, int width, int height) Draws a rectangle with the provided width and height. public abstract void fillRect(int x, int […]
August 10, 2022 | Java | No comments
A Java Applet is a sort of software that is embedded in a webpage to generate dynamic content. It operates on the client side and runs within the browser. All applets are subclasses (either directly or indirectly) of java.applet.Applet class. Applets are not independent programs. They instead run in a web browser or an applet […]
August 9, 2022 | Java | No comments
What are the Legacy Classes in Java? Before Java 1.2, there were multiple classes and interfaces to hold the objects. There was no Collection Framework before this version. In that circumstance, legacy classes and interfaces are employed to store things.All legacy classes have been synchronized. The following legacy classes are defined in java.util package: HashTable […]
August 8, 2022 | Java | No comments
To sort the objects of user-defined classes, a comparator interface is utilized. A comparator object can compare two items of the same type.This interface may be found in java.util package and includes two methods: compare(Object obj1,Object obj2) equals (Object element). It supports different sorting sequences, which means you can sort the items based on any […]
August 6, 2022 | Java | No comments
The Comparable interface is used to compare an object of the same class with an instance of that class; it also enables data ordering for user-defined class objects. The class has to implement the java.lang.Comparable interface to compare its instance, it provides the compareTo() method, which accepts an object of that class as an argument. Its sorting algorithm is determined by the type of object used by the interface. If the object type is a string, it is sorted lexicographically. Else, If the object type is a wrapper class object, such as an integer […]
August 5, 2022 | Java | No comments
The Collections class belongs to the Java Collections Framework. The package java.util.Collections is the package containing the Collections class. The Collections class mainly uses static methods that operate on or return collections. If the collection or object supplied to the methods is null, all the methods in this class throw the NullPointerException. Declaration: Collections Methods: […]
August 5, 2022 | Java | No comments
The Hashtable class creates a hash table by mapping keys to values. As a key or value, any non-null object can be used. The objects used as keys must implement the hashCode and equals methods in order to successfully store and retrieve objects from a hashtable. Hashtable class Declaration: Remember the following: A Hashtable is […]
August 3, 2022 | Java | No comments
Along with the AbstractMap Class, the TreeMap class in Java is used to implement the Map interface and NavigableMap. Depending on which constructor is used, the map is sorted based on the natural ordering of its keys or by a Comparator specified at map creation time. TreeMap class declaration: where, K: It is the type of […]
August 2, 2022 | Java | No comments