Hi,
I know how to do an action listener with a button but now I want to try
something a bit harder. This is what I want to do...
When you user presses the JButton it looks at the JComboBox to see if it is
selected.
If it is, a sound is played.
If it isn't, nothing happens.
I'm not sure how to do this so if someone could give me a simple example or
send me on the write track I would very much appreciate it.
Thanks alot
Matt 2 3303
Matt,
When you say the look to see if the JComboBox is selected, do you mean
see if a selection from the list has been chosen, or does the JComboBox
currently have the focus (ie has been clicked on last)?
If it's the first option, the best bet is to have a blank value in the
first selection, and in your code check...
if(comboBox.get SelectedIndex== 0) {
//do nothing as first option chosen
} else {
//do something else
}
If it's the latter option, you would use comboBox.hasFoc us()
Hope this is what you were looking for :)
webstar wrote: Hi, I know how to do an action listener with a button but now I want to try something a bit harder. This is what I want to do... When you user presses the JButton it looks at the JComboBox to see if it is selected. If it is, a sound is played. If it isn't, nothing happens. I'm not sure how to do this so if someone could give me a simple example or send me on the write track I would very much appreciate it. Thanks alot Matt
I was under the impression that if you clicked on
a button that the button would have the focus?
"Pete" <pc********@ipr imus.com.au> wrote in message news:3f******** **@news.iprimus .com.au... Matt, When you say the look to see if the JComboBox is selected, do you mean see if a selection from the list has been chosen, or does the JComboBox currently have the focus (ie has been clicked on last)? If it's the first option, the best bet is to have a blank value in the first selection, and in your code check... if(comboBox.get SelectedIndex== 0) { //do nothing as first option chosen } else { //do something else } If it's the latter option, you would use comboBox.hasFoc us() Hope this is what you were looking for :) webstar wrote: Hi, I know how to do an action listener with a button but now I want to try something a bit harder. This is what I want to do... When you user presses the JButton it looks at the JComboBox to see if it is selected. If it is, a sound is played. If it isn't, nothing happens. I'm not sure how to do this so if someone could give me a simple example or send me on the write track I would very much appreciate it. Thanks alot Matt This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Krisa |
last post by:
Hello all,
I just discovered something (stop me if you've heard this before....) that
was causing me a significant performance hit when opening a form with
subforms.
To speed up loading the form, I set the rowsources of its, and its
subforms', combo boxes in the "Enter" events of the combo boxes. That's the
standard trick for not loading the rowsource unless/until the user actually
needs the combo box. For example:
|
by: Robert |
last post by:
Stephen,
I think I figured out the problem. I was able to get Check Boxes and Option
Buttons to work on my form by TURNING OFF RECORD SELECTORS on the form. Not
sure why this would make a difference. Perhaps Access attributes the hWnd
of the form to the Record Selector if these are turned on.
In any case, I ran some tests on your Customers form and sure enough, a
Check Box or Option Button will work fine until you turn on Record...
|
by: Tom |
last post by:
I have some very strange issues with combo boxes on a tab control.
Here's the scenario: I have a Windows Forms form that has a tab control
on it, with two (2) tabs. Tab 2 happens to have a number of text and
combo boxes on it (in panels on the tab). These combos were originally
simple drop down lists - i.e. you had to select from the list and
couldn't enter anything of your own. At that time everything worked
fine.
Now, the users...
|
by: Dave |
last post by:
I wasn't sure how to search for previous posts about this, it felt
real specific. Ok so here's the database & problem:
I have 4 combo boxes: cboServer, cboPolicy, cboDB, and
cboApplication. The idea behind the database is for a user to search/
select desired information in any kind of combination between the 4
combo boxes. Then the user clicks a button (btnSearch) and
subsequently a query ("Search Function") is run that shows all 4...
|
by: Dave |
last post by:
I want to put the information that the user selects in my combo boxes
into a subform that lies on the same form as the combo boxes.
Thanks for your help already,
Dave
| |
by: Dave |
last post by:
Hello all,
First I'd like to apologize...This post was meant to be put in my
previous post, but I tried many times without success to reply within
my previous post. Now here goes...
I have a main form (RD Form) with 4 combo boxes (i.e. cbo1, cbo2, etc)
and a subdatasheet (the subform...let's call it subInfo) below the
combo
boxes on the RD Form. I hope this eliminates any confusion of the
|
by: Dave |
last post by:
I have 3 tables of information feeding into 4 combo boxes on my main
form (DR Form). I have as many list boxes (acting as text boxes) as
there are fields in each one of the 3 tables. Once selecting from the
combo box, I have all the combo boxes, using afterupdate, populating
their respective list boxes. These text boxes are directly correlated
to the combo box selection using SQL. Here is an example from the
afterupdate event in the...
|
by: Lindsay Browning |
last post by:
Hello, I found a previous posting by someone on the 10th Sept (http://www.thescripts.com/forum/thread705528.html) who seemed to have the same problem as me, but it was never resolved.
I have created a database with many navigation pages which lead to other forms using buttons. Also some forms are populated by combo boxes where you can select the record from a drop down box and it fills that record's details on the form. This all works...
|
by: someshbakliwal |
last post by:
Hi,
I have created some autopopulating combo boxes on my HTML page (script- Javascript). so these combo boxes are autopopulated with choices made in previous combo boxes.
The problem I am facing is that the combo boxes resize according to the length of the autopulating string. For example if the combo box autopopulates with option 'United States of America', the combo box will become wider and if it autopopulates with value 'NY' the combo box...
|
by: beacon |
last post by:
Hi everybody,
I have a form that has a combo box that asks the user to select the program they work on. Once the user selects the program, a SQL statement populates the row source for 4 staff member combo boxes.
I have an option group that has 4 option buttons for the user to indicate how many staff members to include. Once the user selects one of the option buttons, the appropriate number of combo boxes become enabled and contain the...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |