Submitted On 01-OCT-2000
killj0y
Please update 'Reported Against' to include JDK 1.3.
I am not sure why this is not fixed, when the fix is listed
in the evaluation? Does it take that long to type in the
fix? <sigh>
Submitted On 06-JAN-2001
widebluesky
// It appears that there is one ListSelectionEvent on mouse
press and another one on mouse release.
// This program illustrate this point.
/* The main window has to be resized for the viewResult list
to be visible.
Now you can observe that when pressing mouse button on
First element for example
the viewResult list print One Two Three and when you
release mouse button, viewResult
changes its content and print Four Five Six.
There are two element in the actionList for the
experience to be possibly repeated */
// That's all, I hope it could help.
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import java.awt.event.*;
class BugReport extends JFrame {
static boolean flipflop = true;
String [] listData = {"First element", "Second
element"};
final String [] stringToPrintOne = {"One", "Two",
"Three"};
final String [] stringToPrintTwo = {"Four", "Five",
"Six"};
JList actionList = new JList (listData);
JList viewResult = new JList ();
public BugReport (String title) {
setTitle (title);
getContentPane ().add (actionList, "North");
getContentPane ().add (viewResult, "Center");
actionList.addListSelectionListener (new
ListSelectionListener () {
public void valueChanged (ListSelectionEvent e) {
if (flipflop)
viewResult.setListData (stringToPrintOne);
else
viewResult.setListData (stringToPrintTwo);
flipflop = !flipflop;
}
});
pack ();
show ();
}
public static void main (String [] args) {
new BugReport ("Bug report : two ListSelectionEvent
generated on mouse click");
}
}
Submitted On 09-JAN-2001
s_nonkichi
This bug also appears in JTable like below.
.....
final JTable table = new JTable(convertedRows,
sessionSchool.getColumnMeta());
ListSelectionModel listSelectionModel =
table.getSelectionModel();
listSelectionModel.setSelectionMode
(ListSelectionModel.SINGLE_SELECTION);
table.getSelectionModel().addListSelectionListener(new
ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
ListSelectionModel model = (ListSelectionModel)
e.getSource();
System.out.println(table.getModel().getValueAt
(model.getMinSelectionIndex(), 1).toString());
}
}
);
.....
Submitted On 19-JAN-2001
Pushps
In case of JTable navigation across rows , a Single Event
will be fired if the navigation is done thru Keyboard , and
multiple events will be fired if the navigation is done
thru mouse.
So its but Obvious that one of the Events is fired due to
Deselection of a row and the other event is fired due to
selection of a new row.
The workaround can be written inside the Event Handler by
checking the boolean value of "isValueAdjusting". If its
true the actions written inside the event Handler will be
executed twice and if its false it would be executed only
once.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|