Solved

JButton feedback

Posted on 2004-09-11
4
232 Views
Last Modified: 2010-03-31
Can I get some ideas about how to combat a user repeatedly clicking a button effectively launching a DOS attack on the app! How can I limit the number of clicks (within a reasonable time frame of course) to prevent this happening?
0
Comment
Question by:krakatoa
  • 2
4 Comments
 
LVL 3

Expert Comment

by:aviadbd
ID: 12033577

Cant you just have a member, "clickButton = false" set to "true" when teh button is clicked, and check if its false before starting the action?
0
 
LVL 3

Assisted Solution

by:aviadbd
aviadbd earned 75 total points
ID: 12033587

You can also inherit JButton and override the fireActionPerformed() and fireItemStateChanged() methods, to fire only once per limited time frame, or at all.

AviadBD.
0
 
LVL 16

Author Comment

by:krakatoa
ID: 12034869
I'll give both of these some thought. ;)
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 125 total points
ID: 12038197
You could do it in the actionPerformed () method itself. Maintain a record of the last-time when the button was clicked. Use getSource () to check if the button-source is same and search for its last-click-time. If the current-time is within some predefined time-frame, ignore the click and exit the method.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now