-
Bug
-
Resolution: Fixed
-
P3
-
1.0
-
1.1
-
x86
-
windows_nt
-
Not verified
###@###.### (Patrick Chan)
The list box on win32-beta2 has a problem if the last visible
line is partially visible. If you toggle between single-
and multiple-selection mode, the list gets smaller and smaller.
Using 1.0 beta 2
Steps to reproduce
Compile and run the attached code
<Click> Multiple-selection Mode check box
<Click> Multiple-selection Mode check box again
// note: size of list shrinks each time.
/*
From daemon@java (0000-Admin(0000))
Newsgroups: fp.bugs
Subject: Unknown bug report
Date: 12 Dec 1995 17:49:08 -0800
>From: ###@###.### (Patrick Chan)
This does not look like form output to me.
The list box on win32-beta2 has a problem if the last visible
line is partially visible. If you toggle between single-
and multiple-selection mode, the list gets smaller and smaller.
I believe you need to set the NOINTEGRALHEIGHT (sp?) style bit.
Also, moving from multiple-selection mode to single-selection
mode should not select any items if no items are already selected.
Cheers,
Pat
Here's a test.
*/
import java.awt.*;
class Main extends AppFrame
{
static final int ITEMS = 10;
static List l = new List(ITEMS, false);
static Checkbox b = new Checkbox("Multiple-selection Mode",
null, false);
static public void main(String[] args) {
Main f = new Main();
for (int i = 0; i < ITEMS; i++) {
l.addItem("item "+i);
}
f.add("Center", l);
f.add("South", b);
f.pack();
f.show();
}
public Main()
{
super("List toggle");
}
public boolean action(Event evt, Object what)
{
if (evt.target == b)
{
l.setMultipleSelections(!l.allowsMultipleSelections());
return true;
}
else
return super.action(evt, what);
}
}
/* Generic Full Application Frame
* @(#)AppFrame.java 1.4 15 Nov 1995 15:48:24
* @author Kevin A. Smith
*
* The class AppFrame provides an AWT Frame window for running
* applications.
*
*/
import java.awt.Frame;
import java.awt.Event;
import java.awt.MenuItem;
// Application Frame window
class AppFrame extends Frame
{
// constructor needed to pass window title to class Frame
public AppFrame(String name)
{
// call java.awt.Frame(String) constructor
super(name);
}
// needed to allow window close
public boolean handleEvent(Event e)
{
// Window Destroy event
if (e.id == Event.WINDOW_DESTROY)
return appExit(0);
// it's good form to let the super class look at any
// unhandled events
return super.handleEvent(e);
} // end handleEvent()
// Generic Action event handler
public boolean action(Event evt, Object obj)
{
if(evt.target instanceof MenuItem)
return menuEvent(evt, obj);
else
// it is good form to let the super class look at any
// unhandled events.
return super.action(evt, obj);
} // end action()
// Generic Menu event handler
public boolean menuEvent(Event evt, Object obj)
{
String menuLabel = obj.toString();
if( menuLabel.equals("Exit") )
{
// This menu item is the same as Close
return appExit(0);
}
else
// menu event handler did nothing with this event.
// In a fully written application, you should never
// get to this line.
return false;
} // end menuEvent()
// application exit code
protected boolean appExit(int exitCode)
{
System.exit(exitCode);
return true;
}
} // end class AppFrame