下面列出了怎么用javax.swing.plaf.TreeUI的API类实例代码及写法,或者点击链接到github查看源代码。
/** Make a path visible.
* @param path the path
*/
private void showPathWithoutExpansion(TreePath path) {
Rectangle rect = tree.getPathBounds(path);
if (rect != null) { //PENDING
TreeUI tmp = tree.getUI();
int correction = 0;
if (tmp instanceof BasicTreeUI) {
correction = ((BasicTreeUI) tmp).getLeftChildIndent();
correction += ((BasicTreeUI) tmp).getRightChildIndent();
}
rect.x = Math.max(0, rect.x - correction);
rect.y += rect.height;
if (rect.y >= 0) { //#197514 - do not scroll to negative y values
tree.scrollRectToVisible(rect);
}
}
}
/**
* Invokes the <code>getPathBounds</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public Rectangle getPathBounds(JTree a, TreePath b) {
Rectangle returnValue =
((TreeUI) (uis.elementAt(0))).getPathBounds(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathBounds(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getPathForRow</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getPathForRow(JTree a, int b) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getPathForRow(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathForRow(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getRowForPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getRowForPath(JTree a, TreePath b) {
int returnValue =
((TreeUI) (uis.elementAt(0))).getRowForPath(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getRowForPath(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getPathBounds</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public Rectangle getPathBounds(JTree a, TreePath b) {
Rectangle returnValue =
((TreeUI) (uis.elementAt(0))).getPathBounds(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathBounds(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getClosestPathForLocation</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getClosestPathForLocation(JTree a, int b, int c) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getClosestPathForLocation(a,b,c);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getClosestPathForLocation(a,b,c);
}
return returnValue;
}
/**
* Invokes the <code>stopEditing</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public boolean stopEditing(JTree a) {
boolean returnValue =
((TreeUI) (uis.elementAt(0))).stopEditing(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).stopEditing(a);
}
return returnValue;
}
/**
* Invokes the <code>stopEditing</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public boolean stopEditing(JTree a) {
boolean returnValue =
((TreeUI) (uis.elementAt(0))).stopEditing(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).stopEditing(a);
}
return returnValue;
}
/**
* Invokes the <code>getEditingPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getEditingPath(JTree a) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getEditingPath(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getEditingPath(a);
}
return returnValue;
}
/**
* Invokes the <code>getPathBounds</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public Rectangle getPathBounds(JTree a, TreePath b) {
Rectangle returnValue =
((TreeUI) (uis.elementAt(0))).getPathBounds(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathBounds(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getPathForRow</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getPathForRow(JTree a, int b) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getPathForRow(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathForRow(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getRowForPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getRowForPath(JTree a, TreePath b) {
int returnValue =
((TreeUI) (uis.elementAt(0))).getRowForPath(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getRowForPath(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getEditingPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getEditingPath(JTree a) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getEditingPath(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getEditingPath(a);
}
return returnValue;
}
/**
* Invokes the <code>getClosestPathForLocation</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getClosestPathForLocation(JTree a, int b, int c) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getClosestPathForLocation(a,b,c);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getClosestPathForLocation(a,b,c);
}
return returnValue;
}
/**
* Invokes the <code>isEditing</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public boolean isEditing(JTree a) {
boolean returnValue =
((TreeUI) (uis.elementAt(0))).isEditing(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).isEditing(a);
}
return returnValue;
}
/**
* Invokes the <code>stopEditing</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public boolean stopEditing(JTree a) {
boolean returnValue =
((TreeUI) (uis.elementAt(0))).stopEditing(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).stopEditing(a);
}
return returnValue;
}
/**
* Invokes the <code>getPathForRow</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getPathForRow(JTree a, int b) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getPathForRow(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathForRow(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getEditingPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getEditingPath(JTree a) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getEditingPath(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getEditingPath(a);
}
return returnValue;
}
/**
* Invokes the <code>getPathBounds</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public Rectangle getPathBounds(JTree a, TreePath b) {
Rectangle returnValue =
((TreeUI) (uis.elementAt(0))).getPathBounds(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathBounds(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getRowForPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getRowForPath(JTree a, TreePath b) {
int returnValue =
((TreeUI) (uis.elementAt(0))).getRowForPath(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getRowForPath(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getRowCount</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getRowCount(JTree a) {
int returnValue =
((TreeUI) (uis.elementAt(0))).getRowCount(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getRowCount(a);
}
return returnValue;
}
/**
* Invokes the <code>getClosestPathForLocation</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getClosestPathForLocation(JTree a, int b, int c) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getClosestPathForLocation(a,b,c);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getClosestPathForLocation(a,b,c);
}
return returnValue;
}
/**
* Invokes the <code>isEditing</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public boolean isEditing(JTree a) {
boolean returnValue =
((TreeUI) (uis.elementAt(0))).isEditing(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).isEditing(a);
}
return returnValue;
}
/**
* Invokes the <code>getRowForPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getRowForPath(JTree a, TreePath b) {
int returnValue =
((TreeUI) (uis.elementAt(0))).getRowForPath(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getRowForPath(a,b);
}
return returnValue;
}
/**
* Invokes the <code>stopEditing</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public boolean stopEditing(JTree a) {
boolean returnValue =
((TreeUI) (uis.elementAt(0))).stopEditing(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).stopEditing(a);
}
return returnValue;
}
/**
* Invokes the <code>getPathBounds</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public Rectangle getPathBounds(JTree a, TreePath b) {
Rectangle returnValue =
((TreeUI) (uis.elementAt(0))).getPathBounds(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathBounds(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getPathForRow</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getPathForRow(JTree a, int b) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getPathForRow(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getPathForRow(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getRowForPath</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getRowForPath(JTree a, TreePath b) {
int returnValue =
((TreeUI) (uis.elementAt(0))).getRowForPath(a,b);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getRowForPath(a,b);
}
return returnValue;
}
/**
* Invokes the <code>getRowCount</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public int getRowCount(JTree a) {
int returnValue =
((TreeUI) (uis.elementAt(0))).getRowCount(a);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getRowCount(a);
}
return returnValue;
}
/**
* Invokes the <code>getClosestPathForLocation</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/
public TreePath getClosestPathForLocation(JTree a, int b, int c) {
TreePath returnValue =
((TreeUI) (uis.elementAt(0))).getClosestPathForLocation(a,b,c);
for (int i = 1; i < uis.size(); i++) {
((TreeUI) (uis.elementAt(i))).getClosestPathForLocation(a,b,c);
}
return returnValue;
}