Results 1 to 3 of 3

Thread: How to disable component in Java Swing

  1. #1
    Join Date
    Dec 2011
    Posts
    62

    How to disable component in Java Swing

    Hi friends, I just want to create one Login Form in Java Swing in such a way that when the user make the three wrong input in the User_name or in the Password field then the Login Form automatically block the user input, so that the user can’t able to make input or click on the Submit button. How it can be possible to do this program in Swing, if you guys have any ideas then please let me know. Thanks in Advances

  2. #2
    Join Date
    May 2009
    Posts
    543

    Re: How to disable component in Java Swing

    According to my information this is one of the advance features of Java Swing Technology that it provides several inbuilt method for several action. You can make use of ‘void setEnabled(Boolean b);’ method for Disabling and Enabling the Swing Component in Java. This are the method can be evoke by any of the instance of Java Swing Components. The method setEnabled(Boolean b); enable and disable the function of the components based on the parameter passed to these method. If it is ‘true’ then the component is enabled to works and if the parameter is false then the component is disabling to performs. E.g: btn.setEnabled(false); //This will disable the particular component functionality

  3. #3
    Join Date
    May 2009
    Posts
    527

    Re: How to disable component in Java Swing

    The java swing has many predefine method that can be used for controlling the behaviors of Swing Components like TextField, TextArea, PasswordField, Button etc. If you wish to gray out the component so that the user can’t interact with that particular component you can make use of the setEnabled(); method and the alternate thing that you can also do is to hide that particular component with the help of setVisisble(); method.

Similar Threads

  1. Applets V/s Swing in JAVA
    By "Dritan" in forum Software Development
    Replies: 3
    Last Post: 14-12-2010, 09:04 AM
  2. Print in java using Swing
    By Sheenas in forum Software Development
    Replies: 3
    Last Post: 18-11-2009, 09:50 AM
  3. Java Swing and MySQL
    By shelton141 in forum Software Development
    Replies: 1
    Last Post: 22-09-2009, 08:50 AM
  4. Message Box example for Java Swing
    By Visala28 in forum Software Development
    Replies: 3
    Last Post: 31-07-2009, 05:30 PM
  5. Java swing help with repaint()
    By grudge in forum Software Development
    Replies: 4
    Last Post: 23-07-2009, 03:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,580,726.80366 seconds with 17 queries