< prev index next >
src/java.desktop/share/classes/javax/swing/MenuSelectionManager.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -137,11 +137,11 @@
* Returns the path to the currently selected menu item
*
* @return an array of MenuElement objects representing the selected path
*/
public MenuElement[] getSelectedPath() {
- MenuElement res[] = new MenuElement[selection.size()];
+ MenuElement[] res = new MenuElement[selection.size()];
int i,c;
for(i=0,c=selection.size();i<c;i++)
res[i] = selection.elementAt(i);
return res;
}
@@ -221,12 +221,12 @@
int i,c,j,d;
Component mc;
Rectangle r2;
int cWidth,cHeight;
MenuElement menuElement;
- MenuElement subElements[];
- MenuElement path[];
+ MenuElement[] subElements;
+ MenuElement[] path;
int selectionSize;
p = event.getPoint();
Component source = event.getComponent();
@@ -290,11 +290,11 @@
path = new MenuElement[i+2];
for(k=0;k<=i;k++)
path[k] = tmp.elementAt(k);
}
path[i+1] = subElements[j];
- MenuElement currentSelection[] = getSelectedPath();
+ MenuElement[] currentSelection = getSelectedPath();
// Enter/exit detection -- needs tuning...
if (currentSelection[currentSelection.length-1] !=
path[i+1] &&
(currentSelection.length < 2 ||
@@ -345,15 +345,15 @@
}
}
}
}
- private void printMenuElementArray(MenuElement path[]) {
+ private void printMenuElementArray(MenuElement[] path) {
printMenuElementArray(path, false);
}
- private void printMenuElementArray(MenuElement path[], boolean dumpStack) {
+ private void printMenuElementArray(MenuElement[] path, boolean dumpStack) {
System.out.println("Path is(");
int i, j;
for(i=0,j=path.length; i<j ;i++){
for (int k=0; k<=i; k++)
System.out.print(" ");
@@ -394,11 +394,11 @@
int i,c,j,d;
Component mc;
Rectangle r2;
int cWidth,cHeight;
MenuElement menuElement;
- MenuElement subElements[];
+ MenuElement[] subElements;
int selectionSize;
SwingUtilities.convertPointToScreen(p,source);
screenX = p.x;
@@ -502,11 +502,11 @@
} else
return false;
}
private boolean isComponentPartOfCurrentMenu(MenuElement root,Component c) {
- MenuElement children[];
+ MenuElement[] children;
int i,d;
if (root == null)
return false;
< prev index next >