Is it possible to activate the Operating System context menu in swing application?

Asked

Viewed 106 times

1

Some time ago I realized that it is not possible to call the operating system context menu in swing components, although it is possible to perform standard keyboard actions (such as copy, paste, crop, select) in these components without having to implement anything else.

  • Why the system context menu does not work within swing applications?

  • Is there any way to activate it or only by implementing this menu using the swing components themselves?

  • I believe that only using the components of Swing, the link below shows how to implement. http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html

1 answer

3


What happens is that Operating Systems have native features for creating windows, menus, etc that are not portable between them, that is, if you create a window using a language in Windows using the available resources of S.O. it will work only on Windows, the same is true for Linux. To access native resources you can use AWT components.

Swing emerged as a solution to allow software portability across multiple S.O. by having the Operating System install a Java virtual machine.

Swing builds windows and menus that are interpreted by the Java virtual machine, not using native features of Operating Systems.

You can learn a little more about AWT x Swing in the following link: http://www.devmedia.com.br/awt-x-swing-codigo-nativo-x-codigo-interpretado/3212

Browser other questions tagged

You are not signed in. Login or sign up in order to post.