How can you use the Keyboard for a JComboBox within a JTable without F2
I am brand new to Java and I can't seem to figure this out. I have a JTable with 4 columns. The first column is a jCheckBox which is working fine. The other three are JComboBoxes. They work fine when you click them and select from the list, but our end users only want to navigate with the keyboard. They want to be able to tab to the column and just start typing the first letter of the item that they want to choose from the list and have that pop up the list and scroll to the first item in the list that starts with the letter the typed. Does anyone know how to do this? I have been playing with this for a week now and I can't seem to make it work. Please help. Below is the code for my table. Any help would be appreciated greatly. Thanks,
Lisa
private void LoadSTCGTable(){
//Connect to database
try {
connection = ConnecttoDB.connect();
// Tell me why I couldn't connect
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (SQLException ex) {
ex.printStackTrace();
try {
// Get listing of Squad Types
tblSTCG.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{new Boolean(false), null, null, null},
new String [] {
"SELECT", "SQUAD TYPE", "SQUAD CLASS", "SQUAD GROUP"
//Add Checkbox column
tblSTCG.getColumnModel().getColumn(0).setCellEditor(tblSTCG.getDefaultEditor(Boolean.class));
tblSTCG.getColumnModel().getColumn(0).setCellRenderer(tblSTCG.getDefaultRenderer(Boolean.class));
tblSTCG.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
Whichquerytoread = 1;
GetSql();
sql = textfileinfo;
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
md = rs.getMetaData();
typelist = new ArrayList();
// Loop Through Results
typelist.add(new PairedDescriptionCodeDesc("",""));
while (rs.next())
int i = 1;
typelist.add( new PairedDescriptionCodeDesc(rs.getString(2),rs.getString(1)));
s1 = new TreeSet(typelist);
typelist = new ArrayList(s1);
AllTypeList = new PairedDescriptionCodeDesc[typelist.size()];
for (int i = 0; i<typelist.size(); i++)
AllTypeList=(PairedDescriptionCodeDesc)typelist.get(i);
rs.close();
catch (SQLException ex) {
ex.printStackTrace();
Vector typedata = new Vector();
for (int i=0;i<typelist.size();i++)
typedata.addElement((PairedDescriptionCodeDesc)typelist.get(i));
cmboType = new JComboBox();
cmboType.setModel(new DefaultComboBoxModel(typedata));
cmboType.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
cmboType = new JComboBox(AllTypeList);
cmboType.setBorder(BorderFactory.createEmptyBorder());
squadcol = tblSTCG.getColumnModel().getColumn(1);
DefaultCellEditor cmboTypeEditor = new DefaultCellEditor(cmboType);
cmboTypeEditor.addCellEditorListener(new NewRowCellEditorListener(tblSTCG));
squadcol.setCellEditor(cmboTypeEditor);
try {
// Get listing of Squad Class
Whichquerytoread = 2;
GetSql();
sql = textfileinfo;
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
md = rs.getMetaData();
classlist = new ArrayList();
// Loop Through Results
classlist.add(new PairedDescriptionCodeDesc("",""));
while (rs.next())
classlist.add(new PairedDescriptionCodeDesc(rs.getString(2),rs.getString(1)));
s1 = new TreeSet(classlist);
classlist = new ArrayList(s1);
AllClassList = new PairedDescriptionCodeDesc[classlist.size()];
for (int i = 1; i<classlist.size(); i++)
AllClassList[i]=(PairedDescriptionCodeDesc)classlist.get(i);
rs.close();
catch (SQLException ex) {
ex.printStackTrace();
Vector classdata = new Vector();
for (int i=0;i<classlist.size();i++)
classdata.addElement((PairedDescriptionCodeDesc)classlist.get(i));
cmboClass = new JComboBox();
cmboClass.setModel(new DefaultComboBoxModel(classdata));
cmboClass = new JComboBox(AllClassList);
classcol = tblSTCG.getColumnModel().getColumn(2);
DefaultCellEditor cmboClassEditor = new DefaultCellEditor(cmboClass);
classcol.setCellEditor(new DefaultCellEditor(cmboClass));
cmboClassEditor.addCellEditorListener(new NewRowCellEditorListener(tblSTCG));
try {
// Get listing of Squad Group
Whichquerytoread = 3;
GetSql();
sql = textfileinfo;
stmt = connection.createStatement();
rs = stmt.executeQuery(sql);
md = rs.getMetaData();
grouplist = new ArrayList();
// Loop Through Results
grouplist.add(new PairedDescriptionCodeDesc("",""));
while (rs.next())
int i = 0;
grouplist.add( new PairedDescriptionCodeDesc(rs.getString(2), rs.getString(1)));
s1 = new TreeSet(grouplist);
grouplist = new ArrayList(s1);
AllGroupList = new PairedDescriptionCodeDesc[grouplist.size()];
for (int i = 0; i<grouplist.size(); i++)
AllGroupList[i]=(PairedDescriptionCodeDesc)grouplist.get(i);
rs.close();
catch (SQLException ex) {
ex.printStackTrace();
Vector groupdata = new Vector();
for (int i=0;i<grouplist.size();i++)
groupdata.addElement((PairedDescriptionCodeDesc)grouplist.get(i));
cmboGroup = new JComboBox();
cmboGroup.setModel(new DefaultComboBoxModel(groupdata));
cmboGroup = new JComboBox(AllGroupList);
groupcol = tblSTCG.getColumnModel().getColumn(3);
DefaultCellEditor cmboEditor = new DefaultCellEditor(cmboGroup);
cmboEditor.addCellEditorListener(new NewRowCellEditorListener(tblSTCG));
groupcol.setCellEditor(cmboEditor);
tblSTCG.setShowHorizontalLines(false);
tblSTCG.setShowVerticalLines(false);
TableColumnModel columnModel = tblSTCG.getColumnModel();
TableColumn column;
tblSTCG.getColumnModel().getColumn(0).setPreferredWidth(5);
tblSTCG.getColumnModel().getColumn(1).setPreferredWidth(100);
tblSTCG.getColumnModel().getColumn(2).setPreferredWidth(100);
tblSTCG.getColumnModel().getColumn(3).setPreferredWidth(100);
scpSTCG.setViewportView(tblSTCG);
private class NewRowCellEditorListener implements CellEditorListener
JTable editingTable;
public NewRowCellEditorListener(JTable table)
editingTable = table;
public void editingStopped(ChangeEvent e)
if(editingTable.getRowCount() == editingTable.getSelectedRow() + 1)
((DefaultTableModel)editingTable.getModel()).addRow(new Object [] {null, null, null, null});
public void editingCanceled(ChangeEvent e)
Final Cut Pro menu > Audio / Video Settings... (Cmd Opt Q) will show you al the various presets currently loaded
Sequence menu > Settings... (Cmd Zero) will show you the current sequence's settings
Edit > Item Properties > Format... (Cmd 9) will show you the selected clip's properties
Similar Messages
-
How can you use the same e-mail address for multiple ipads?
I have two iPads.. an iPad and an ipad 2. I registared my new ipad 2 and now my old ipad is will not let me log on and is telling me that my e-mail address is already in use. how can you use the same e-mail address for multiple ipads?
And by using the same Apple ID you can also share purchases. If you have a different Apple ID for each iPhone then you can't share purchases.
-
How can I used the keyboard to change the name of a archive
How can I used the keyboard or thr mouse to change the name of a archive
Select the file, hit the enter key, type in the new name, and hit the enter key.
-
I would like to make an in app purchase using the $20.00 credit that I have on itunes. I am using my i phone5. It does not give me the option of using the credit that I already have, only of using a credit card. How can I use the credt that I already have instead of a credit card?
Is Settings > General > Restrictions > In-App Purchases: ON (green)?
Some In-App Purchases works only with credit card. -
How can you use the ipad with lectures in uni where i can annotate my notes?
How can i use my ipad fpr lectures in uni?
There are tons of note taking apps. If you want one that records lectures, take a look at Auditorium.
-
How can you use the same Apple ID for music and apps but have a different iCloud
Collectively in my family we have 1 iPhone 2 ipod(4th gen) and 3 iPad mini's and we like to buy music and apps through the same Apple ID so that we can all share it but we also have a problem about the iCloud.
My son has one iPod and one iPad and he would like his contacts and messages to be shared between HIS two devices but he would also like all of the pictures taken in the family to be shared
The same for my daughter and for me.
Is there a way of selecting which devices share what????
Thanks a lot
AcwillsYou could and should set up different iCloud accounts in "Settings > iCloud", so that every user has its own email account, calendars, reminders, notes, storage for backups and app data (files etc.), by the way everyone could also use his own account for iMessage (Settings > Messages > Send & Receive) and FaceTime (Settings > FaceTime) so that you all could write and call each other.
Next the Apple ID for music, apps and other media: You all could just set up the ssame Apple ID in "Settings > iTunes & App Stores" for all your media purchases like songs, movies, apps etc. -
How can you disable the alerts for find my phone app
I have one iPad and 3 iPhones on my account. 2 of those are my kids. When I Use the find my phone App, one of my kids gets an alert that say I just tracked her, the other 2 phones don't or the iPad. How can I disable this? And why is that happening? If a phone was stolen I wouldn't want to alert the thief I was tracking them..
I'm not sure if you can change the meesage but try here.
-
How can you hide the controls for the video (faster)
Hi there, I've created a new video player for my client who has bounced the job as the subs are overlaid by the controls of the video - he still wants the full screen option but does not want to see the controls once you play the video.
Here is the work so far: http://www.wecreativ3.com/trust/trust-videoplayer.html
Any way to do this?Hi,
Please check this:
http://css-tricks.com/custom-controls-in-html5-video-full-screen/
Hope that helps!
Regards,
Meenakshi -
Can you use the iMessage for FaceTime on your mac?
I was wondering if you could use the imessage on the mac computer but it seems like you cant please help me i have been doing some reserch on the apple prouducs and if u have any questions askk me. thanks bye
<Edited By Host>http://www.apple.com/macosx/mountain-lion/messages-beta/
-
HT4759 How can i use the find iphone app to find my ipod without i cloud ?
My ipod has gone and i want to find it please i ned ur help it doesnt include icloud
It sounds like you need some clarification.
Find my iPhone = Find my iPod = Find my iPad = Find my Mac: a service that lets you locate any of those devices, assuming you turned it on on that device before you lost it.
iCloud: Find my iPhone (and friends) is one of the many iCloud services.
That being said, did you turn on Find my iPod on your iPod before you lost it? If so, go to icloud.com or use the Find my iPhone app on anyone's iOS device and log in.
If you did not turn on Find my iPod, then you're out of luck. -
How do you use the keyboard to play sound from a button?
I am building a site for a client who wants to be able to
press a keyboard button such as the "up" button and have it play an
instrument sound. I am fimiliar with html and css coding but i am
not that great at actionscript. It would be greatly appreciated if
someone could show me what I would have to do to achieve this
affect. I was looking around the web and saw something that said I
might need an eventlistner. I am com,pletely lost! All help
welcome. Thanks. Here is an example of exactly what I am trying to
achieve, the only difference is it doesnt need to be complicated
and I only need it to work for 3 buttons.
http://www.ababasoft.com/music/drums01.htm
http://www.kenbrashear.com/dasaimedia wrote:
> I am building a site for a client who wants to be able
to press a keyboard
> button such as the "up" button and have it play an
instrument sound. I am
> fimiliar with html and css coding but i am not that
great at actionscript. It
> would be greatly appreciated if someone could show me
what I would have to do
> to achieve this affect. I was looking around the web and
saw something that
> said I might need an eventlistner. I am com,pletely
lost! All help welcome.
> Thanks. Here is an example of exactly what I am trying
to achieve, the only
> difference is it doesnt need to be complicated and I
only need it to work for 3
> buttons.
http://www.ababasoft.com/music/drums01.htm
>
http://www.kenbrashear.com/
Many ways to achieves that. You can make a movie clip with
(for 4 sounds) 5 frames.
Frame 1 stop(); to prevent it from running. Frame 2 attach
your sound, frame 3 another
sound, frame 4 and 5 same. Give that movie clip instance name
"soundCLIP" Now all you
need is to add key listener to timeline frame so you can
capture the key and go to
corresponding frame of the movie clip to play your sound.
var keyListObj:Object = new Object();
keyListObj.onKeyDown = function() {
switch (Key.getCode()) {
case Key.LEFT :
soundCLIP.gotoAndStop(2);
break;
case Key.UP :
soundCLIP.gotoAndStop(3);
break;
case Key.RIGHT :
soundCLIP.gotoAndStop(4);
break;
case Key.DOWN :
soundCLIP.gotoAndStop(5);
break;
Key.addListener(keyListObj);
Best Regards
Urami
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
How can I use the CPS for Oracle ECM with webcenter
Hi I did install webcenter "webcenter_windows_x86_101320_disk1" but im not able to use CPS(content portlet suite) anybody used them together before .
Hey Khalid,
I think you might be in the wrong forum. This one is for WebCenter Interaction - the old BEA ALUI/Plumtree product, not the original Oracle WebCenter Portal.
Terrible terrible terrible job in picking such similar names for these 2 different products! -
How can i remove the keyboard for a cleaning? pavillion dv7...
hi yesterday i had an accident with the coffe, i splill it in part of the numeric key board, i remove all coffe from the keyboar and wasnt workinf caracteres like 6 , 3 , 2 1 0 and enter, today they are working (eccept enter is not working) but they are very stiky when u push them, i think the system is working good, so i dont need to send to repair the pc, just a full cleaning on the key board, i will be very grateful for any help to open and cleaning process, i have the tool i need direction thanx alot ...
http://h20574.www2.hp.com/?jumpid=reg_R1002_USEN&lang=en&cc=US&hpappid=psml
From the above url ( HP Partner Services Media Library ), do the following;
1. Select Laptop and Tablet PCs in "Product Category".
2. Select HP Pavilion Notebook PCs in "Product Family".
3. Select HP Pavilion dv7-1000/2000/3000 Entertainment Notebook Series in "product Series". You need to figure out it is a 1000, 2000 or 3000 series from your own dv7.
4.After step 3 is selected, you should able to Media selection and additional resources for your dv7-1000/2000/3000 at the bottom of this url.
5. Select FRU remove/Replace. A new window should pop up " HP Service Media Library".
6. Select "Keyboard" to see the video and Keyboard removal procedures.
Since Notebook keyboard is quite different than the normal full desktop keyboard, it may not be easy to clean if the coffee got into the rubberized part of the keys.
Have fun.... -
I have a Macbook Pro and an iPad2 which I sync to the Macbook. Sometimes I buy apps straight from the iPad and other times from the Macbook but each time I change from one to the other I have to re-enter my payment details. Can I set my account up to recognise that I may buy from both of these devices?
Apple "verifies" your Apple ID account information with every purchase of all free or paid apps whether iOS devics or computers.
Apple wants to make sure someone else hasn't compromised your account. -
I can't use my keyboard for long in CS4 - very odd
I have 2 computers and when I try to use the keyboard for shortcuts on my second computer, some weird dialog with chinese characters pops up shortly after I start using the keyboard and I can't use the keyboard for shortcuts after that point, ever. I'm pretty sure it's within CS4 because it doesn't happen at all in Windows.
What the heck is this and how do I disable it?:I see... this is the first computer of mine that I've ever kept the factory installed OS on in my life. Lol. Bloatware.
Thanks!
Maybe you are looking for
-
Sound does not work from speakers
I have Windows 7 on a HP 500B MT product desktop computer. According to my computer, my sound works fine. I installed the Microsoft Fixit and it said nothing wrong. I can plug in earphones and I can hear system sounds but no other sounds. The other s
-
Oracle JDBC 8.1.7 XA prepare bug
Both Oracle JDBC 8.1.7 XA thin and oci drivers have a bug related to the prepare fase of 2PC. In some circunstances when loosing connection, the prepare fase cannot be completed but Oracle driver returns a successfull status, so WLS issues second pha
-
With a SSRS 2008R2 report consisting of a page header and a tablix in the body with columnar information, how can you control which rows are in the Frozen Pane at the top of the workbook when exporting the report to Excel. Currently the top pane is
-
Adding item level field to field catalog for a PPF for Outbound Delivery
Hi, We wish to send a method call to an external system at the time of PGI of the Outbound Delivery Order for the combination of Product/Ship To combination. Since Product is at item level and not in the standard field catalog, I added it to the fiel
-
How do I ensure that double-sided is the default printing option across all programs in my Macbook Pro?