The quickest way to get the reference of Clipboard is via Toolkit. Due to this, binding of the Abstract Window Toolkit with the native windowing makes the behavior of GUI distinct of the platform upon which the application runs. The Toolkit is an abstract superclass that comprises all the functionalities of the Abstract Window Toolkit and binds with the usability of native windowing toolkit implementations, such as the effect of scrolling, visibility of window, sizing, modality, and so on. In most cases, however, direct instantiation of this class by using its sole constructor is not necessary because we can obtain a reference of it through the instance of another class, called Toolkit, defined in the java.awt package. The instance of this class is used to refer to the system resource called Clipboard. Java provides a dedicated class called Clipboard, defined in. This means that the global memory we are referring to is actually outside the periphery of the application from where it was extracted. It may also be the case that the Java application from where the text is extracted has terminated, yet the data is available to another application through the paste command. It is for this reason that when we cut or copy a text from, say, a Swing textfield, it is also available to any other Java or non-Java application, say, the notepad. What usually happens is that when we issue a cut or copy command from a user component, the data is extracted to a global memory location managed by the underlying platform’s Clipboard manager. The cut-copy-paste functionality simplifies data transfer between GUI components with the help of the resource called Clipboard.
This article focuses into this API to give an idea how to implement it in Java code. This can be done with the help of the API support provided by Java. But, hard coding is necessary if we want to imbibe this feature into a custom user component developed in Swing, AWT, or JavaFX.
This is the reason we do not need to explicitly hard code to implement this feature in every Java application. Many of the user components provided by the Java GUI, such as Swing or AWT, have built-in support of this mechanism.
What we can do is select an element-be it a text segment, image, file, and so forth-from a user interface and trigger keyboard operations on the component that has input focus. The Clipboard provides one of the most important functionalities of GUI, namely the cut-copy-paste functions.