java - How to create hyperlink to other stage from the text area -
in javafx application there 1 text area in want create hyperlink after clicking on hyperlink new stage open @ run time(which contain 1 text area) , text coming main text area forwarded new text area of new stage.is achievable? suggestion?
i having below code in application "actlogtarea" text area in want give hyperlink/button , want transfer text coming main text area new text area can suggest how can changed?
new thread(new runnable() { protected logger logger = logger.getlogger(unixboxtask.class.getname()); public void run() { try { string user = username; string pass = pwd; string host = lanip; jsch jsch = new jsch(); session session = jsch.getsession(user, host, 22); //session.sethostkeyalias(sshhostkey); java.util.properties config = new java.util.properties(); config.put("stricthostkeychecking", "no"); session.setconfig(config); session.setpassword(pass); session.connect(); bufferedreader br = new bufferedreader(new filereader(scriptpath)); string line; string command_cd = ""; // build unix command list separated semicolon while ((line = br.readline()) != null) { if (line.charat(0) == '.' && line.charat(1) == '/') { line = ". " + line; } command_cd += line + ";"; } br.close(); arraylist nameofthreads = new arraylist(); stringbuilder outputfromunix = new stringbuilder(); this.logger.info("command = " + command_cd); channel channel = session.openchannel("shell"); if (taskname.equalsignorecase(incresesrb) || taskname.equalsignorecase(decresesrb)) { string keyvaluefile = deploymenttaskcontroller.getinstance().scriptfilepath + "\\" + taskname + "_keyvalue.txt"; buildparameterlist(keyvaluefile, taskname); channelsftp channelsftp = (channelsftp) session.openchannel("sftp"); channelsftp.connect(); copyfiles(channelsftp, new file(keyvaluefile), globalvalues.getvaluefromprops(taskname, "build path", logincontroller.environment) + "/" + taskname); channelsftp.disconnect(); } channel.connect(); printstream commander = new printstream(channel.getoutputstream(), true); commander.println(command_cd); commander.println("exit;"); commander.close(); bufferedwriter bw = null; inputstream outputstream_from_the_channel = channel.getinputstream(); bufferedreader reader = new bufferedreader(new inputstreamreader(outputstream_from_the_channel)); bw = new bufferedwriter(new filewriter(resultlogfile.getabsolutepath(), true), 20000); string jaroutput; int count=0; while ((jaroutput = reader.readline()) != null) { this.logger.info("status update = " + jaroutput); bw.write(jaroutput); if (jaroutput.contains("test")) { nameofthreads.add(jaroutput); continue; } bw.newline(); bw.flush(); outputfromunix.append(jaroutput).append("\n"); // display in activity log area in realtime. if (deploymenttaskcontroller.actlogtarea != null && !taskname.equalsignorecase(connectbundle)) { final string outputstr = outputfromunix.tostring(); platform.runlater(new runnable() { @override public void run() { **deploymenttaskcontroller.actlogtarea.settext(outputstr); deploymenttaskcontroller.actlogtarea.end();** } }); } } bw.close(); reader.close(); { thread.sleep(1000); } while (!channel.iseof()); channel.disconnect(); session.disconnect(); thread.sleep(1000); } catch (jschexception jex) { system.out.println("jsch exception : " + jex.getmessage()); } catch (exception ex) { system.out.println("general exception jsch block : " + ex.getmessage() + apputil.stack2string(ex)); } } }).start();
it easy achieve. , actually, hyperlink not thing, used that. don't muff javafx , html.
what do:
- create button (hyperlink, if want)
setonaction(new eventhandler<actionevent>(){})
, add next code function:new stage(new scene(new group(new textarea(ta.textproperty().bind(ta.textproperty()))))).show()
, ta - text area first stage.
you have note, javafx object oriented gui technology, , can create new javafx component object @ time, , update existing 1 @ time, when have access or link on it. important concept, usefull - properties. property contain value of time. , properties can binded - when value 1 property automaticaly propogated binded properties. each javafx component (controls/layouts) interfaces based on properties usage.
button b = new button("create new console"); b.setonaction(new eventhandler<actionevent>(){ ... action() { new stage(new scene(new group(new textarea(deploymenttaskcontroller.actlogtarea.gettext()))))).show(); } });
instead of deploymenttaskcontroller.actlogtarea have create kind of hash map, decide, text area chose add new content in :
deploymenttaskcontroller.actlogtareahashmap.get(<some key, determine text area>);
and add new text area there, when create new one.
Comments
Post a Comment