當前位置: 首頁>>代碼示例>>Java>>正文


Java Hyperlink類代碼示例

本文整理匯總了Java中javafx.scene.control.Hyperlink的典型用法代碼示例。如果您正苦於以下問題:Java Hyperlink類的具體用法?Java Hyperlink怎麽用?Java Hyperlink使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Hyperlink類屬於javafx.scene.control包,在下文中一共展示了Hyperlink類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: click

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
@Test public void click() {
    Hyperlink button = (Hyperlink) getPrimaryStage().getScene().getRoot().lookup(".hyperlink");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(new Runnable() {
        @Override public void run() {
            RFXButtonBase rfxButtonBase = new RFXButtonBase(button, null, null, lr);
            Point2D sceneXY = button.localToScene(new Point2D(3, 3));
            PickResult pickResult = new PickResult(button, sceneXY.getX(), sceneXY.getY());
            Point2D screenXY = button.localToScreen(new Point2D(3, 3));
            MouseEvent me = new MouseEvent(button, button, MouseEvent.MOUSE_PRESSED, 3, 3, sceneXY.getX(), screenXY.getY(),
                    MouseButton.PRIMARY, 1, false, false, false, false, true, false, false, false, false, false, pickResult);
            rfxButtonBase.mouseButton1Pressed(me);
        }
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording select = recordings.get(0);
    AssertJUnit.assertEquals("click", select.getCall());
    AssertJUnit.assertEquals("", select.getParameters()[0]);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:RFXHyperlinkButtonTest.java

示例2: createHyperlink

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
public static Hyperlink createHyperlink(final String string)
{
	Hyperlink hyperlink = new Hyperlink(string);
	hyperlink.setPadding(new Insets(0, 0, 0, 1));
	hyperlink.setOnAction(new EventHandler<ActionEvent>()
	{
		@Override
		public void handle(ActionEvent event)
		{
			try
			{
				DesktopHelper.browse(string);
			}
			catch (Throwable e)
			{
				e.printStackTrace();
			}
		}
	});
	return hyperlink;
}
 
開發者ID:PolyphasicDevTeam,項目名稱:NoMoreOversleeps,代碼行數:22,代碼來源:JavaFxHelper.java

示例3: mergeFailed

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
private void mergeFailed(Exception exception) {
	Platform.runLater(() -> {
		Text text = new Text(
				String.format("Merging failed.\nProblem: %s\nIf you think this is a bug, please report it here:",
						exception.getMessage()));
		text.setWrappingWidth(CONTENT_WIDTH);
		text.setFill(Color.WHITE); // XXX: Ugly workaround because CSS doesn't work

		Hyperlink link = buildBugReportLink(exception);
		FlowPane content = new FlowPane(text, link);

		ThemedAlert alert = new ThemedAlert(AlertType.ERROR);
		alert.getDialogPane().setContent(content);
		alert.showAndWait();
		System.exit(1);
	});
}
 
開發者ID:CedricReichenbach,項目名稱:audiomerge,代碼行數:18,代碼來源:OperationPage.java

示例4: buildBugReportLink

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
private Hyperlink buildBugReportLink(Exception exception) {
	Hyperlink link = new Hyperlink(BUG_REPORT_LINK);
	String body;
	try {
		Throwable cause = exception.getCause();
		// XXX: Can we include whole stack trace? URL length limitations? Privacy issues?
		body = URLEncoder.encode(String.format("*Message:* `%s`\n*Cause:* `%s`", exception.getMessage(),
				cause == null ? "(null)" : cause.getClass().getCanonicalName()), "UTF-8");
	} catch (UnsupportedEncodingException e) {
		System.err.println("Failed to build body argument for bug reporting URL");
		e.printStackTrace();
		body = "";
	}
	String args = "?body=" + body;
	link.setOnAction(event -> directoryOpener.accept(BUG_REPORT_LINK + args));
	return link;
}
 
開發者ID:CedricReichenbach,項目名稱:audiomerge,代碼行數:18,代碼來源:OperationPage.java

示例5: lvFindRsltOnMouseClick

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
/**
 * 리스트뷰를 클릭했을때 이벤트
 * @작성자 : KYJ
 * @작성일 : 2017. 7. 25. 
 * @param e
 */
public void lvFindRsltOnMouseClick(MouseEvent e) {
	FindModel selectedItem = lvFindRslt.getSelectionModel().getSelectedItem();
	if (selectedItem != null) {
		this.pagination.setCurrentPageIndex(selectedItem.getPage());

		List<Hyperlink> collect = IntStream.iterate(0, a -> a + 1).limit(selectedItem.getLines().size()).mapToObj(idx -> {
			Line line = selectedItem.getLines().get(idx);

			Hyperlink hyperlink = new Hyperlink(String.format("%d", line.getLine()));
			hyperlink.setOnAction(ev -> {
				CPagenationSkin skin = (CPagenationSkin) pagination.getSkin();
				SimpleTextView view = (SimpleTextView) skin.getCurrentPage();
				view.getHelper().moveToLine(line.getLine(), line.getStartCol() - 1, line.getEndCol() - 1);

			});
			return hyperlink;

		}).collect(Collectors.toCollection(LinkedList::new));

		this.fpLines.getChildren().setAll(collect);

	}
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:30,代碼來源:BigTextView.java

示例6: showOpenFileButton

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
private void showOpenFileButton() {
  Hyperlink link = new Hyperlink(Util.text("create-file-open"));
  TextFlow flow = new TextFlow(new WikiLabel("create-file-success"), link);
  flow.setTextAlignment(TextAlignment.CENTER);
  addElement(flow);
  link.setOnAction(ev -> {
    try {
      Desktop.getDesktop().open(Session.FILE);
    } catch (IOException ex) {
      LOGGER.log(Level.WARNING, 
          "Cannot open file: {0}",
          new String[]{ex.getLocalizedMessage()}
      );
    }
  });
  
  nextButton.linkTo("StartPane", stage, true).setText(Util.text("create-file-back-to-start"));
  nextButton.setVisible(true);
}
 
開發者ID:yarl,項目名稱:pattypan,代碼行數:20,代碼來源:CreateFilePane.java

示例7: setContent

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
private void setContent() {
  addElement("check-intro", 40);

  Session.FILES_TO_UPLOAD.stream().map(uploadElement -> {
    String name = uploadElement.getData("name");
    Hyperlink label = new Hyperlink(name);

    label.setTooltip(new Tooltip(name));
    label.setOnAction(event -> {
      setDetails(uploadElement, label);
    });
    return label;
  }).forEach(label -> {
    fileListContainer.getChildren().add(label);
  });

  addElementRow(10,
          new Node[]{new WikiScrollPane(fileListContainer).setWidth(250), new WikiScrollPane(detailsContainer)},
          new Priority[]{Priority.SOMETIMES, Priority.SOMETIMES}
  );

  setDetails(Session.FILES_TO_UPLOAD.get(0), (Hyperlink) fileListContainer.getChildren().get(0));

  prevButton.linkTo("LoadPane", stage);
  nextButton.linkTo("LoginPane", stage);
}
 
開發者ID:yarl,項目名稱:pattypan,代碼行數:27,代碼來源:CheckPane.java

示例8: LanguageSelectionPane

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
public LanguageSelectionPane(@Nullable Language defaultPreviewLanguage) {
	super(10, 10);
	this.defaultLanguage = defaultPreviewLanguage;
	setToKey(null);
	chosenLanguageObserver.addListener(new ValueListener<Language>() {
		@Override
		public void valueUpdated(@NotNull ValueObserver<Language> observer, @Nullable Language oldValue, @Nullable Language newValue) {
			for (Hyperlink hyperlink : links) {
				if (hyperlink.getUserData().equals(newValue)) {
					hyperlink.setStyle(LanguageSelectionPane.SELECTED_LINK_STYLE);
				} else {
					hyperlink.setStyle("");
				}
			}
		}
	});
}
 
開發者ID:kayler-renslow,項目名稱:arma-dialog-creator,代碼行數:18,代碼來源:LanguageSelectionPane.java

示例9: addLanguage

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
private void addLanguage(@NotNull Language language) {
	if (containsLanguage(language)) {
		return;
	}
	Hyperlink hyperlinkLanguage = new Hyperlink(language.getName());
	links.add(hyperlinkLanguage);
	links.sort(hyperlinkComparator);
	hyperlinkLanguage.setUserData(language);
	hyperlinkLanguage.setOnAction(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent event) {
			hyperlinkLanguage.setVisited(false);
			chosenLanguageObserver.updateValue(language);
		}
	});

	getChildren().clear();
	getChildren().addAll(links);

}
 
開發者ID:kayler-renslow,項目名稱:arma-dialog-creator,代碼行數:21,代碼來源:LanguageSelectionPane.java

示例10: alertWithExpandableContentTest

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
@Test(timeout = 300000)
public void alertWithExpandableContentTest() throws Throwable {
    Wrap<? extends Node> button = parent.lookup(Button.class, new ByText<Button>(BUTTON_SHOW_EXP_TEXT)).wrap();
    for (StageStyle s : StageStyle.values()) {
        Wrap<? extends Node> styleToggleButton = parent.lookup(ToggleButton.class, new ByText<ToggleButton>(s.toString())).wrap();
        click(styleToggleButton, InputType.MOUSE);
        for (String c : content) {
            Wrap<? extends Node> contentToggleButton = parent.lookup(ToggleButton.class, new ByText<ToggleButton>(c)).wrap();
            click(contentToggleButton, InputType.MOUSE);
            click(button, InputType.MOUSE);
            Thread.sleep(DEFAULT_DELAY);
            SceneDock sd = new SceneDock();
            click(sd.asParent().lookup(Hyperlink.class, new ByText<Hyperlink>("Show Details")).wrap(), InputType.MOUSE);
            // checkScreenshot("alertWithExpandableContentTest" + s + "_" + c + "Test", scene);
            Thread.sleep(DEFAULT_DELAY);
            closeDialogWindowByClickingButton("OK");
            throwScreenshotError();
        }
    }
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:21,代碼來源:DialogTest.java

示例11: hyperlinkActionTest

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
/**
 * Test of user input processing
 */
@ScreenshotCheck
@Test(timeout = 300000)
public void hyperlinkActionTest() throws InterruptedException {
    openPage(Pages.Action.name());
    try {
        Thread.sleep(1000); // ugly workaround to be removed ASAP
    } catch (InterruptedException ex) {
    }
    Parent<Node> parent = getScene().as(Parent.class, Node.class);
    Wrap<? extends Hyperlink> label = parent.lookup(Hyperlink.class, new ByID<Hyperlink>(IDs.Target.name())).wrap();
    final Wrap<? extends Hyperlink> hyperlink = parent.lookup(Hyperlink.class, new ByID<Hyperlink>(IDs.Hyperlink.name())).wrap();
    hyperlink.mouse().click();
    label.waitProperty(Wrap.TEXT_PROP_NAME, HyperlinkApp.HYPER_LINK_IS_FIRED);
    assertTrue(new GetAction<Boolean>() {
        @Override
        public void run(Object... os) throws Exception {
            setResult(hyperlink.getControl().isVisited());
        }
    }.dispatch(Root.ROOT.getEnvironment()));
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:24,代碼來源:HyperliksTest.java

示例12: generateHyperlink

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
Hyperlink generateHyperlink(String text, String url, String imagePath) {
    Hyperlink link = new Hyperlink(text);
    InputStream imageStream = Undertailor.class.getResourceAsStream("/assets/" + imagePath);
    if (imageStream != null) {
        ImageView img = new ImageView(new Image(imageStream));
        img.setFitHeight(24);
        img.setFitWidth(24);

        link.setGraphic(img);
        link.setGraphicTextGap(8D);
    }

    link.setOnMouseReleased(event -> {
        DesktopLauncher.instance.getHostServices().showDocument(url);
    });

    return link;
}
 
開發者ID:Xemiru,項目名稱:Undertailor,代碼行數:19,代碼來源:Launcher.java

示例13: initControls

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
@Override
public void initControls()
{
    this.projectRepoLabel = new Label("Project Repository");
    this.projectRepoValue = new Hyperlink("https://github.com/AstromechZA/bunkr");
    this.versionLabel = new Label("Version");
    this.versionValue = new Label(Version.versionString);
    this.compatVersionLabel = new Label("Compatible Version");
    this.compatVersionValue = new Label(Version.compatibleVersionString);
    this.gitCommitDateLabel = new Label("Git Commit Date");
    this.gitCommitDateValue = new Label(Version.gitDate);
    this.gitCommitHashLabel = new Label("Git Commit Hash");
    this.gitCommitHashValue = new Label(Version.gitHash);
    this.buildDateLabel = new Label("Build Date");
    this.buildDateValue = new Label(Version.builtDate);
}
 
開發者ID:AstromechZA,項目名稱:bunkr,代碼行數:17,代碼來源:AboutWindow.java

示例14: ItemDialog

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
public ItemDialog(ExileToolsHit item) {
	super(AlertType.INFORMATION);
	setTitle(item.getInfo().getFullName());
	setHeaderText("");
	
	String json = new GsonBuilder().setPrettyPrinting().create()
			.toJson(item.getHitJsonObject());
	
	TextArea textArea = new TextArea(json);
	textArea.setEditable(true);
	textArea.setWrapText(false);

	textArea.setMaxWidth(Double.MAX_VALUE);
	textArea.setMinWidth(650);
	textArea.setMinHeight(550);
	
	String shopUrl = "https://www.pathofexile.com/forum/view-thread/" + item.getShop().getThreadid();
	Hyperlink shopLink = new Hyperlink(shopUrl);
	shopLink.setOnAction(e -> openLink(shopUrl));
	
	getDialogPane().setContent(new VBox(textArea, shopLink));
	initModality(Modality.NONE);
}
 
開發者ID:thirdy,項目名稱:blackmarket,代碼行數:24,代碼來源:ItemDialog.java

示例15: buildFrom

import javafx.scene.control.Hyperlink; //導入依賴的package包/類
/**
 * @param title
 * @param url
 * @return
 * @since 2.10.0
 */
public static Hyperlink buildFrom(final String title, final String url) {
    final Hyperlink ret = new Hyperlink(title);
    ret.setOnMouseClicked(mouseEvent -> {
        if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
            try {
                final Desktop desktop = getDesktop();
                desktop.browse(new URI(url));
            } catch (final Exception e) {
                log.error("An error occurred trying to open the infolink in the default browser: ", e);
                showExceptionDialog(e);
            }
        }
    });
    return ret;
}
 
開發者ID:manami-project,項目名稱:manami,代碼行數:22,代碼來源:HyperlinkBuilder.java


注:本文中的javafx.scene.control.Hyperlink類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。