我正在用Java编写GUI.我需要知道如何检查用户是否点击了鼠标.我知道如何检查鼠标的位置,但我只需要检查它是否被点击.
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this …Run Code Online (Sandbox Code Playgroud)