About javafx--my hierarchical classification method for writing UI interfaces through code

Source: Internet
Author: User

Preface: In my other article, "My approach to naming Java identifiers," I mentioned that I wrote the method of returning the control in a way similar to: W_borderpane ().

Now I propose a hierarchical classification method for writing UI interfaces through code:

Example code:

    //Root Container    Private StaticBorderpane w_borderpanebasis () {//CreateBorderpane _borderpanebasis =NewBorderpane (); //#自我定义_borderpanebasis.setbackground (NewBackground (NewBackgroundfill (paint.valueof ("#333333"),NULL,NULL))); //#添加子级组件_borderpanebasis.settop (W_menubarbasis ()); //return        return_borderpanebasis; }    //Main Menu Bar    Private StaticMenuBar w_menubarbasis () {MenuBar _menubar=NewMenuBar ();        _menubar.getmenus (). Add (W_menuproject ()); return_menubar; }    //Menu "Items"    Private StaticMenu W_menuproject () {menu _menuproject=NewMenu ("Project"); return_menuproject; }

    @Override    publicvoidthrows  exception{        Primarystage.settitle ("translation assistant");         New Scene (W_borderpanebasis (),.        Primarystage.setresizable (false);        Primarystage.setscene (_scene);        Primarystage.geticons (). Add (new Image (Windowmain.  Class. getResourceAsStream ("Resource/img/dao.png"));        Primarystage.show ();    }

About javafx--my hierarchical classification method for writing UI interfaces through code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.