当前位置: 首页>>代码示例>>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;未经允许,请勿转载。