java - (Generic Class).this.revalidate(); on Mac -
i'm using 2010 mac 1.6.0_37 java, using drjava compile. revalidate method not compile, , receive next error:
2 errors found: file: /users/#########/compsci/final/connectfourframe.java [line: 123] error: /users/#########/compsci/final/connectfourframe.java:123: cannot find symbol symbol : method revalidate() location: class connectfourframe
this method giving rising error:
try { //display in window updatetitlebar(); objectinputstream ois = new objectinputstream(new fileinputstream(currentfile)); colorgrid = (color[][]) ois.readobject(); makegrid(); for(int k = 0; k < 6; k++) { for(int l = 0; l < 7; l++) { if (colorgrid[k][l]==null) { grid[k][l] = new blanktile(new point(k, l)); } else if (colorgrid[k][l].equals(color.red)) { grid[k][l] = new redtile(new point(k, l)); } else if (colorgrid[k][l].equals(color.black)) { grid[k][l] = new blacktile(new point(k, l)); } } } putnewgrid(); string currentcolor = (string) ois.readobject(); ois.close(); connectfourframe.this.repaint(); connectfourframe.this.revalidate(); //this offending line gp.revalidate(); gp.repaint(); }
and outer class connectfourframe (extends jframe , implements runnable)
how can resolve issue?
component.revalidate()
new in java 7. presumably you're using 7 on windows opposed 6 on mac.
if need code work on java 6 you'll have things differently. javadoc component.revalidate says
this convenience method supposed help application developers avoid looking validate roots manually. basically, it's equivalent first calling invalidate()
method on component, , calling validate()
method on nearest validate root.
since jframe
validate root, should able replace revalidate
phone call invalidate()
followed validate()
.
java osx swing
No comments:
Post a Comment