Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #4267
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail |
|---|---|
| From | "Sriram" <sriram@THRWHITE.remove-dii-this> |
| Subject | JButton Action Listeners |
| Message-ID | <8f4084e9-5e60-460f-93e0-e18732aa51fe@v13g2000pro.googlegroups.com> (permalink) |
| X-Comment-To | comp.lang.java.gui |
| Newsgroups | comp.lang.java.gui |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] |
| Lines | 48 |
| Date | Wed, 27 Apr 2011 15:49:38 GMT |
| NNTP-Posting-Host | 96.60.20.240 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1303919378 96.60.20.240 (Wed, 27 Apr 2011 10:49:38 CDT) |
| NNTP-Posting-Date | Wed, 27 Apr 2011 10:49:38 CDT |
| Organization | TDS.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.gui:4267 |
Show key headers only | View raw
To: comp.lang.java.gui
Hi all
I have a question regarding action events... Is it possible for a
button to have multiple events generated??... I have been wanting to
generate two events from clicking a single button ..My following
sample code has the Add Row button and Up button that generates
separate events but I would like a single Up button to generate adding
a row below as well as insertion of a row if there are entries say
between table cells A and C it should insert a cell in between
(functionality like Excel)......
How do I do this? Pls help!!
button = new JButton( "Add Row" );
buttonPanel.add( button );
button.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
model.addRow( createRow() );
int row = table.getRowCount() - 1;
table.getColumnModel().getColumn(4).setCellEditor(new
DefaultCellEditor(comboBox));
table.changeSelection(row, 0, false, false);
table.requestFocusInWindow();
}
});
//
button = new JButton( "Up" );
buttonPanel.add( button );
button.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int row=table.getSelectedRow();
model.insertRow(row, createRow() );
table.changeSelection(0, 0, false, false);
table.requestFocusInWindow();
}
});
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar
JButton Action Listeners "Sriram" <sriram@THRWHITE.remove-dii-this> - 2011-04-27 15:49 +0000 Re: JButton Action Listen "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:49 +0000 Re: JButton Action Listen "Mark Space" <mark.space@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
csiph-web