Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

run()

 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Documentation does not seem to include the following call option to run:


Is this a bug or am I overlooking something?



Code sourced from here.
 
Anuj Prashar
Ranch Hand
Posts: 99
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such method in java.lang.Runnable. In the code it is not calling run() method from java.lang.Runnable instead it is calling user created static method also named run.
 
Wim Vanni
Ranch Hand
Posts: 96
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you're referring to is not an implementation of the Runnable interface. The width and height arguments are there to set the size of a JFrame.

Cheers
Wim
 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wim Vanni wrote:The code you're referring to is not an implementation of the Runnable interface. The width and height arguments are there to set the size of a JFrame.

Cheers
Wim


I did not see any run documented under methods at http://download.oracle.com/javase/6/docs/api/javax/swing/JFrame.html, so how do you know?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15438
41
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the source code you pointed to, you can see that the run(JFrame frame, int width, int height) method is defined immediately under the main method.

That run() method here does not have anything to do with Runnable or JFrame or any other class in the standard library. It's just a normal method in the FileChooserTest class of the example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic