/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6462008
* @summary Tests that mouse/keyboard work properly on JList with lead < 0 or > list.getModel().getSize()
* @author Shannon Hickey
* @run main bug6462008
*/
public class bug6462008 {
private static int anchorLead;
private static boolean isAquaLAF;
private static int controlKey;
public void run() {
}
});
setAnchorLead(-1);
setAnchorLead(100);
}
// Space
resetList();
// Control + Space
resetList();
// Shift + Space
resetList();
// Control + Shift + Space
resetList();
// Control + A Multiple Selection
resetList();
// Control + A Single Selection
resetList();
// Control + A Selection interval (5, 5)
checkSelection(5);
resetList();
// Page Down
// Not applicable for the Aqua L&F
if (!isAquaLAF) {
resetList();
}
// Shift + Page Down
/*
* We really want to use robot here, but there seems to be a bug in AWT's
* robot implementation (see 6463168). For now, we'll invoke the action
* directly instead. When the bug is fixed, we'll use the following four
* lines instead:
* robot.keyPress(KeyEvent.VK_SHIFT);
* robot.keyPress(KeyEvent.VK_PAGE_DOWN);
* robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
* robot.keyRelease(KeyEvent.VK_SHIFT);
*/
resetList();
// Down
resetList();
// L
resetList();
// Click item 4
Point p = clickItem4();
resetList();
// Control + Click item 4
p = clickItem4();
resetList();
// Shift + Click item 4
p = clickItem4();
resetList();
// Control + Shift + Click item 4
p = clickItem4();
resetList();
}
for (int i = 0; i < 10; i++) {
}
return listModel;
}
public void run() {
result[0] = p;
}
});
return result[0];
}
public void run() {
}
});
}
public void run() {
}
});
}
public void run() {
}
});
}
public void run() {
}
});
}
public void run() {
}
});
}
private static void setAnchorLeadNonThreadSafe() {
}
private static void createAndShowGUI() {
frame.setVisible(true);
}
}
private static void checkSelectionAL(final int anchor, final int lead, final int... sels) throws Exception {
public void run() {
}
});
}
}
}
for (int i : sels) {
checks[i] = true;
}
if (lsm.isSelectedIndex(i)) {
throw new RuntimeException(i + " is selected when it should not be");
}
throw new RuntimeException(i + " is supposed to be selected");
}
}
}
}