473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Enabling and Disabling the Button

I have a problem. I have code that generates a GUI. This is the first thing that the application does.

I want to incorporate a button, that when information is available becomes enabled but when information isnt available is disabled.

Using the buttonname.setEnabled(false) does not work. It initially does but the button never becomes enabled. Ive tried using various structures of where I have placed the buttonname.setEnabled(true) but the GUI is not being updated. Any ideas on how I can update the GUI when buttonname.setEnabled(true) is accessed??

Thanks
Mar 23 '08 #1
3 1453
Laharl
849 Expert 512MB
You can use ActionListeners so that once everything that needs to be entered has been entered, you call setEnabled(true). If you need help with them (they have quirks), poke around here for help. Google will probably also prove helpful.
Mar 23 '08 #2
If u can use a button as setEnable(true) it just has focus to the button.
You can try using a ActionEvent with KeyListener.

Whenever a key is stroked ur button condition should become true..
or else it will be in default mode setEnable(false);
Mar 24 '08 #3
JosAH
11,448 Expert 8TB
I have a problem. I have code that generates a GUI. This is the first thing that the application does.

I want to incorporate a button, that when information is available becomes enabled but when information isnt available is disabled.

Using the buttonname.setEnabled(false) does not work. It initially does but the button never becomes enabled. Ive tried using various structures of where I have placed the buttonname.setEnabled(true) but the GUI is not being updated. Any ideas on how I can update the GUI when buttonname.setEnabled(true) is accessed??

Thanks
w.r.t. the boldface part: then the error must be somewhere else in your code. Don't
work around your bug, fix it instead.

kind regards,

Jos
Mar 24 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: HumptyDumpty | last post by:
Does anyone know if there is a problem with re-enabling the Screen Saver after it has been disabled programmatically. I am using the SystemParametersInfo function within User32.dll, and have...
7
by: Marco Castro | last post by:
How can I disable and then re-enable the close button on a form? Thanks.
7
by: John Meyer | last post by:
I have a program where I have to enable or disable a list box based upon a radio button. Is there an "enabled" property on select boxes?
7
by: Vignesh | last post by:
I have tab control which has some TabPages. I want to enable or disable the tabpages based on some condition. It is possible to that. Thanks in advance.
2
by: dougawells | last post by:
Hi- I'm wanting to have a set of radio buttons disabled when a form is displayed, then if they check another specific radio button, those would become enabled. I've tried setting it via...
1
by: barq | last post by:
I'm using image in an anchor tag as a submit button. We use document.images.parentElement.removeAttribute('href') in a javascript function to make a image button non-clickable (not-hyperlink)....
2
by: metalwing12 | last post by:
hi guys can someone help me out here.im having a hard time doing this project well this is my code I try using the disabled property of the textbox yes it workss, it disable it but when i set it to...
0
by: krizzie khonnie | last post by:
How can I Disable a Radio Button if it's a Radio Group. Example, there's a two radio button, Value and Group, in a radio group. Now I want to disable Radio Button Value when I create a Parent Item....
1
by: hello2008 | last post by:
Hi, I have just started coding in PHP. I have coded a web page using HTML, JS, and PHP. An HTML table has to be populated dynamically using the data from the backend. Presently I have 5...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.