swing - in java, when do I get access to this instance if not in main()? -


so trying make simple swing app learning purposes, , bit confused this. understand entry-point of program main() function, , object doesn't exist @ point can't refer this, how , when know instance has been created?

my class extends jframe has visual presence when execute it, , right after created, want position on specific position on screen. option seems to use new classname(), create second instance instead....so yeh, total beginner , confused

you need create instance of class in main:

myclass c = new myclass("a nice frame title here"); 

then in class constructor or methods:

public myclass(string title) {    //you can use here }  public void method() {    //and here } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -