java - How to create a custom component in JavaFX 8? -
in swing possible create custom components (purely in code) extending jcomponent
(or jpanel
), give layout , add components manually , expose invented getters , setters modify set of controls.
however unable find how in javafx 8? figure must possible, documentation either doesn't go advanced or comes immediatly fxml, in not interested yet.
if helps, want in 1 component:
textarea textarea = new textarea(); textfield textfield = new textfield(); borderpane borderpane = new borderpane(); textarea.seteditable(false); borderpane.setcenter(textarea); textfield.addeventhandler(keyevent.key_released, keyevent -> { if (keyevent.getcode() == keycode.enter) { textarea.appendtext(textfield.gettext() + system.lineseparator()); messages.offer(textfield.gettext()); textfield.clear(); } }); borderpane.setbottom(textfield);
take @ great video on parleys
it shows 3 options:
- just use custom css if control exists needs different
- extend layout container, eg region (java coding)
- extend control (java coding) (good making libraries)
the video explains of rest. luck!
Comments
Post a Comment