3 import jalviewfx.controllers.engine.ControlledScreen;
4 import jalviewfx.controllers.engine.ScreensController;
6 import java.io.IOException;
7 import java.net.MalformedURLException;
9 import java.util.ResourceBundle;
11 import javafx.fxml.FXML;
12 import javafx.fxml.FXMLLoader;
13 import javafx.fxml.Initializable;
14 import javafx.scene.Parent;
15 import javafx.scene.Scene;
16 import javafx.scene.canvas.Canvas;
17 import javafx.scene.canvas.GraphicsContext;
18 import javafx.scene.control.TextField;
19 import javafx.scene.text.TextAlignment;
20 import javafx.scene.web.WebEngine;
21 import javafx.scene.web.WebView;
25 public class Controller implements Initializable, ControlledScreen {
27 private WebView browser;
31 private Canvas canvas;
33 ScreensController myController;
37 String pre_msg = "fx:id=\"";
38 String post_msg = "\" was not ingected: check the FXML file 'TestUI.fxml' ";
39 assert browser != null : pre_msg + "map_listview" + post_msg;
40 assert canvas != null : pre_msg + "canvas" + post_msg;
41 System.out.println("Textfield : "+tf);
42 System.out.println("Canvas : "+canvas);
45 public void doSmt() throws MalformedURLException, IOException {
46 System.out.println("do smt ..");
47 System.out.println(tf.getText());
48 System.out.println(browser.getId());
49 WebEngine webEngine = browser.getEngine();
50 webEngine.load(getClass().getResource("/html/alignment.html").toString());
53 public void gotoStageTwo() throws IOException{
54 System.out.println("Going to next stage");
55 Scene sceneTwo = new Scene((Parent) FXMLLoader.load(getClass().getResource("/fxml/TestUI.fxml")));
56 Main.getPrimaryStage().setScene(sceneTwo);
59 public void useCanvas() {
60 System.out.println("Canvas object ------> "+canvas);
61 GraphicsContext gc = canvas.getGraphicsContext2D();
62 gc.setTextAlign(TextAlignment.JUSTIFY);
63 // gc.setTextBaseline(VPos.TOP);
65 String longestSeq = "MASVSATMISTSFMPRKPAVTSLKPIP-NVG-EALFGLKS---ANGGKVTCMASYKVKLITPDGPIEFDCPDNVYILDQAEEAGHDLPYSCRAGSCSSCAGKIAGGAVDQT";
68 double fontSize = 8;//gc.getFont().getSize();
69 for(int x = 1; x < longestSeq.length(); x++){
71 gc.fillText(String.valueOf(x), charSpace, 15);
73 gc.fillText(" ", charSpace, 15);
77 gc.fillText("|", charSpace, 30);
79 charSpace += fontSize;
81 gc.fillText(longestSeq, 0, 45);
82 gc.fillText("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 60);
87 public void setScreenParent(ScreensController screenParent) {
88 myController = screenParent;
93 public void initialize(URL paramURL, ResourceBundle paramResourceBundle) {
94 // TODO Auto-generated method stub