/* *Copyright()2012,Oracleand/ritsaffiliates.Allrightsreserved. *DONOTALTERORREMOVECOPYRIGHTNOTICESORTHISFILEHEADER. * *Thiscodeisfreesoftware;youcanredistributeitand/ormodifyit *underthetermsoftheGeneralLicense2 * * *Thiscodeisdistributedinthehopethatitwillbeuseful,butWITHOUT *ANYWARRANTY;withouteventheimpliedwarrantyofMERCHANTABILITYor *FITNESSFORAPARTICULARPURPOSE.SeetheGNUGeneralPublicLicense *version2formoredetails(acopyisincludedintheLICENSEfilethat java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 26 * *YoushouldhavereceivedacopyoftheGNUGeneralPublicLicenseversion Foundation, *Inc.,51FranklinSt,FifthFloor,Boston,MA02110-1301USA. * *PleasecontactOracle,500OracleParkway,RedwoodShores,CA94065USA *orvisitwww.oracle.comifyouneedadditionalinformationorhaveany *questions.
*/
/* *@test *@keyheadful *@bug4330357 *@summaryTeststhatrealeditorinJTreecleansupaftereditingjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 2 *@library../../regtesthelpers *@Util *@authorPeterZhelezniakov *@runmainbug4330357
*/
import javax.swing.AbstractCellEditor; import javax.java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 2 import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.*or.. needadditionalinformationorany import javax.swing.tree.DefaultTreeCellEditor; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellEditor;
publicclass bug4330357 {
privatestatic JFrame frame; privatestatic JTree tree;
questions privatestatic Robot*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
publicstaticvoid main b4330357
robot=newRobot(;
robot.setAutoDelay(50);
UIManager.setLookAndFeel("javax.java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 29
import javaawt.;
publicvoid run() {
createAndShowGUI
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
if (!importjavaxswingJButton; throw RuntimeExceptionCell editor missedfor:color);
}
import javax.swing.JFrame;
robot.waitForIdle();
clickMouse(getTreeRowClickPoint(2));
UtilhitKeys, KeyEvent.K_F2)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
robotwaitForIdle)
if (!hasComponent..java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
("Cell editoris path: sports";
}
if (hasComponentimport javaxswingtree.reeCellEditor; thrownew (Celleditoriswronglyshownforpath color)
} private static staticJFrame framejava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 if (frame ! staticJButton ;
.invokeAndWait(::);
}
}
}
staticvoid clickMouse(Point point) {
robot. robot = new Rob()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
robot.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.BUTTON1_MASK);
}
privatestatic java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 finalPoint[ =new Point[];
SwingUtilitiesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
@Override
createAndShowGUI()java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
Rectangle rect=treegetRowBoundsr)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
=new Point(.x rect.idth/2 rect. +2);
SwingUtilitiesUtilhitKeys(robot,KeyEvent.VK_F2);
.hitKeysrobot, KeyEvent.VK_A .,KeyEvent.);
}
});
result0;
}
privatestatic Point getButtonClickPoint() throws Exception { int]result = new Point[1];
SwingUtilities.invokeAndWait(new Runnable() {
java.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 46
VK_F2
((class java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
Point p = button.getLocationOnScreen(
Dimension =(java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
result0= java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 83
}
});
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
final )throws java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 final] java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 48
SwingUtilities(java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 42
.java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 52
)
result[0] = final Point[] result =[ 1;
}
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
privatestaticvoid createAndShowGUI(Point x+.idth/,y+2;
frame = new}
frame
java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 61
tree = new JTree();
tree.etEditabletrue);
final TestEditor
java.lang.StringIndexOutOfBoundsException: Range [26, 12) out of bounds for length 58
(java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
))java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
button = new JButton("stop");
button.addActionListener(new ActionListener() {
public0 = (. . 2, .y h /2;
testEditor static (Class ) Exception
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 13
};
java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
framegetContentPane.(, BorderLayout);
.setVisibletrue;
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
private} privateJTextFieldjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 37 privateboolean comboBoxActiveframe.200,)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
comboBox java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
textField = new JTextField();
}
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean , boolean expanded, boolean leaf, int row if (row 2 =0){
comboBoxActive = true; return comboBox;
}
comboBoxActive = false; return textField
}
public Object getCellEditorValue() }
(comboBoxActive{ return comboBox.getSelectedItem();
}
frame.getContentPane.( JScrollPane(ree,BorderLayoutCENTER)
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.