java - JavaFx on Eclipse View -
i designing eclipse plugin in eclipse 3.6. have created eclipse view extending eclipse viewpart class. inside view trying use javafx components label, text fields etc. in view have label , text field.
problem: cannot make text field editable , text field not gain focus on mouse click on text field.
how can make text field gain focus , make editable?
using: eclipse 3.6 helios , javafx 2.2 java 7.
import java.awt.frame; import javafx.application.platform; import javafx.embed.swing.jfxpanel; import javafx.scene.scene; import javafx.scene.control.label; import javafx.scene.control.tab; import javafx.scene.control.tabpane; import javafx.scene.control.textfield; import javafx.scene.layout.gridpane; import javax.swing.jpanel; import org.eclipse.swt.swt; import org.eclipse.swt.awt.swt_awt; import org.eclipse.swt.graphics.color; import org.eclipse.swt.graphics.device; import org.eclipse.swt.widgets.composite; import org.eclipse.swt.widgets.display; import org.eclipse.ui.part.viewpart; public class inputview extends viewpart { device device = display.getcurrent(); color whitecolor = new color(device, 255, 255, 255); color redcolor = new color(device, 255, 0, 0); @override public void createpartcontrol(final composite parent) { composite composite = new composite(parent, swt.embedded | swt.no_background); final frame frame = swt_awt.new_frame(composite); final jpanel parentpanel = new jpanel(); final jfxpanel fxpanel = new jfxpanel(); final tabpane tpane = new tabpane(); tab firsttab = new tab("first tab"); gridpane gpane = new gridpane(); gpane.sethgap(10.0); gpane.setvgap(10.0); final textfield tfield = new textfield(); tfield.setprefwidth(100.0); tfield.seteditable(true); tfield.managedproperty().bind(tfield.editableproperty()); tfield.setstyle("-fx-border-color: black; -fx-border-width: 2"); label username = new label("user name"); gpane.add(username, 0, 0); gpane.add(tfield, 1, 0); firsttab.setcontent(gpane); tpane.gettabs().add(firsttab); platform.runlater(new runnable() { @override public void run() { scene scene = new scene(tpane); fxpanel.setscene(scene); parentpanel.add(fxpanel); frame.add(parentpanel); frame.setsize(1300, 600); frame.setvisible(true); } }); } @override public void setfocus() { // todo auto-generated method stub } }
Comments
Post a Comment