当前位置: 首页>>代码示例>>Java>>正文


Java Hyperlink.setOnAction方法代码示例

本文整理汇总了Java中javafx.scene.control.Hyperlink.setOnAction方法的典型用法代码示例。如果您正苦于以下问题:Java Hyperlink.setOnAction方法的具体用法?Java Hyperlink.setOnAction怎么用?Java Hyperlink.setOnAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Hyperlink的用法示例。


在下文中一共展示了Hyperlink.setOnAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: StartUpView

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
public StartUpView( HostServices hostServices,
                    Stage stage,
                    Consumer<File> openFile ) {
    VBox box = new AboutLogFXView( hostServices ).createNode();

    String metaKey = FxUtils.isMac() ? "⌘" : "Ctrl+";

    Hyperlink link = new Hyperlink( String.format( "Open file (%sO)", metaKey ) );
    link.getStyleClass().add( "large-background-text" );
    link.setOnAction( ( event ) -> new FileOpener( stage, openFile ) );

    Text dropText = new Text( "Or drop files here" );
    dropText.getStyleClass().add( "large-background-text" );

    StackPane fileDropPane = new StackPane( dropText );
    fileDropPane.getStyleClass().add("drop-file-pane");

    FileDragAndDrop.install( fileDropPane, openFile );

    box.getChildren().addAll( link, fileDropPane );
    getChildren().addAll( box );
}
 
开发者ID:renatoathaydes,项目名称:LogFX,代码行数:23,代码来源:StartUpView.java

示例7: BottomPane

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
public BottomPane() {
	Hyperlink bottomLabel = new Hyperlink("http://bluemarlinexile.github.io/");
	bottomLabel.setOnAction(e -> {
		try {
			SwingUtil.openUrlViaBrowser(bottomLabel.getText());
		} catch (Exception e1) {
			e1.printStackTrace();
		}
	});
	
	Label indexerLastUpdateText = new Label("Indexer Last Update: ");
	Label indexerLastUpdateValueText = new Label();
	indexerLastUpdateValueText.textProperty().bind(lastIndexUpdateService.messageProperty());
	indexerLastUpdateText.textProperty().bind(lastIndexUpdateService.countdownProperty());
	
	getChildren().addAll(bottomLabel, new HBoxSpacer(), indexerLastUpdateText, indexerLastUpdateValueText);
	
	lastIndexUpdateService.setOnSucceeded(e -> lastIndexUpdateService.restart());
	lastIndexUpdateService.setOnFailed	 (e -> lastIndexUpdateService.restart());
	lastIndexUpdateService.restart();
}
 
开发者ID:bluemarlinexile,项目名称:bluemarlin,代码行数:22,代码来源:BottomPane.java

示例8: addBrowser

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
/**
 *
 *
 * @param fileEntry
 * @param contentSearch
 * @param nodesToAdd
 * @param idToShow
 *
 * @throws Exception
 */
private void addBrowser(final FileEntry fileEntry, final List<Node> nodesToAdd) throws Exception {
  // TODO: text
  final Hyperlink fulltextButton = new Hyperlink(g.getText("SEARCH_RESULT.SHOW_FULLTEXT"));
  fulltextButton.setStyle("-fx-font-size:15px");
  Platform.runLater(new Runnable() {
    @Override
    public void run() {
      addTooltip(fulltextButton, g.getText("SEARCH_RESULT.SHOW_FULLTEXT_TOOLTIP"), -50, 35);
    }
  });

  // ------------------------------------------------ //

  fulltextButton.setOnAction(new EventHandler<ActionEvent>() {
    @Override
    public void handle(ActionEvent event) {
      outTransition();
      executeWorker(saveToXhtmlWorker(fileEntry));
    }
  });

  // ------------------------------------------------ //
  nodesToAdd.add(fulltextButton);
  nodesToAdd.add(new Text("  "));
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:36,代码来源:SearchResult.java

示例9: addDirectoryButton

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
/**
 *
 *
 * @param fileEntry
 * @param nodesToAdd
 *
 * @throws Exception
 */
private void addDirectoryButton(final FileEntry fileEntry, final List<Node> nodesToAdd)
    throws Exception {
  Hyperlink openDirButton = new Hyperlink(g.getText("SEARCH_RESULT.SHOW_FILE"));
  openDirButton.setStyle("-fx-font-size:15px");
  // addImageIcon(openDirButton, Icon.FOLDER_OPEN, 0);
  openDirButton.setOnAction(new EventHandler<ActionEvent>() {
    @Override
    public void handle(ActionEvent event) {
      outTransition();
      inTransitionAsWorker(1000);
      executeWorker(openFileWorker(fileEntry.getPath(), true, 1));
    }
  });
  nodesToAdd.add(openDirButton);
  nodesToAdd.add(new Text("  "));

  Platform.runLater(new Runnable() {
    @Override
    public void run() {
      Thread.currentThread().setName(Config.APP_NAME + "JavaFX: Open dir tooltip");
      addTooltip(openDirButton, g.getText("SEARCH_RESULT.OPEN_DIR_TOOLTIP"), -50, 35);
    }
  });
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:33,代码来源:SearchResult.java

示例10: StartSplashStage

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
public StartSplashStage(Window owner) {
    initModality(Modality.WINDOW_MODAL);
    initOwner(owner);
    initStyle(StageStyle.UTILITY);

    Text windowTitle = new Text("LPDS Parking");
    Hyperlink openLink = new Hyperlink("Open scenario");
    Hyperlink newLink = new Hyperlink("New scenario");
    Hyperlink exitLink = new Hyperlink("Exit");

    windowTitle.setFont(Font.font("Arial", FontWeight.BOLD, 14));
    exitLink.setOnAction(event -> setResult(0));
    openLink.setOnAction(event -> setResult(1));
    newLink.setOnAction(event -> setResult(2));

    VBox vbox = new VBox(windowTitle, newLink, openLink, exitLink);
    vbox.setPadding(new Insets(10));
    vbox.setSpacing(8);

    for (Node node : vbox.getChildren())
        VBox.setMargin(node, new Insets(0, 0, 0, 8));

    setScene(new Scene(vbox));
    sizeToScene();
}
 
开发者ID:SKNZ,项目名称:LesPatternsDuSwag,代码行数:26,代码来源:StartSplashStage.java

示例11: populate

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
public void populate(Script script) {
        this.flow = new TextFlow();
        Text name = new Text(script.getName());
        name.getStyleClass().add("subtitle");
        this.getChildren().add(name);
        

        RootNode node = mdProcessor.parseMarkdown(script.getDescription().toCharArray());
        //Text desc = new Text(script.getDescription());
        //this.getChildren().add(desc);
        node.accept(this.mdToFx);
        //add description flow
        this.getChildren().add(flow);
        
        
        final String documentationPage = script.getXProcScript().getHomepage();
        
        if (documentationPage != null && documentationPage.isEmpty() == false) { 
                Hyperlink link = new Hyperlink();
                link.setText("Read online documentation");

                link.setOnAction(Links.getEventHander(main.getHostServices(),documentationPage));
                this.getChildren().add(link);
        }
}
 
开发者ID:daisy,项目名称:pipeline-gui,代码行数:26,代码来源:ScriptInfoHeaderVBox.java

示例12: addFinderLinkRow

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
public void addFinderLinkRow(String label, final String path) {
        Hyperlink link = new Hyperlink();
    link.setText(label);
    link.setTooltip(new Tooltip(path));
link.setOnAction(new EventHandler<ActionEvent>() {

    public void handle(ActionEvent t) {
        try {
                String cmd = PlatformUtils.getFileBrowserCommand() + " " + path;
                                Runtime.getRuntime().exec(cmd);
                        } catch (IOException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                        }
    }
});

addRow(link);
}
 
开发者ID:daisy,项目名称:pipeline-gui,代码行数:20,代码来源:GridPaneHelper.java

示例13: checkForUpdateOnStartupCheckbox

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
private Node checkForUpdateOnStartupCheckbox() {
  HBox result = new HBox(15);
  result.paddingProperty().setValue(new Insets(10, 0, 0, 0));

  CheckBox checkBox = new CheckBox();
  checkBox.selectedProperty().bindBidirectional(userPreferences.searchUpdateAtStartupProperty());
  result.getChildren().add(checkBox);

  Label label = new Label(bundle.getString("ui.about.update.message.checkOnStartup"));
  label.getStyleClass().add("legend");
  result.getChildren().add(label);

  Hyperlink preferencesLink = new Hyperlink(bundle.getString("ui.menu.file.preferences"));
  preferencesLink.setOnAction((actionEvent) -> new PreferencesWindow(bundle, userPreferences, applicationData).show());
  preferencesLink.getStyleClass().add("legend");
  result.getChildren().add(preferencesLink);

  return result;
}
 
开发者ID:nwaldispuehl,项目名称:interval-music-compositor,代码行数:20,代码来源:UpdateCheckDialog.java

示例14: onStart

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
@Override
public void onStart() {
	stuffBox.prefWidthProperty().bind(Main.mainController.contentBox.widthProperty());
	stuffBox.prefHeightProperty().bind(Main.mainController.contentBox.heightProperty());
	if (credits.getChildren().isEmpty()) {
		String yearString = "2017";
		int year = Calendar.getInstance().get(Calendar.YEAR);
		if (year > 2017) {
			yearString += "-" + year;
		}
		Text text = new Text("©" + yearString + " - HEARTH PROJECT");
		text.setStyle("-fx-fill: #FFFFFF; -fx-font-family:  'Lato', sans-serif; -fx-font-size: 12;");
		Hyperlink hyperlink = new Hyperlink("http://hearthproject.uk/");
		hyperlink.setStyle("-fx-text-fill: #FFFFFF; -fx-font-family:  'Lato', sans-serif; -fx-font-size: 12;");
		hyperlink.setOnAction(e -> openHearthSite());
		hyperlink.focusTraversableProperty().setValue(false);
		Text creditsText = new Text("\nCredits:");
		creditsText.setStyle("-fx-fill: #FFFFFF; -fx-font-family:  'Lato', sans-serif; -fx-font-size: 14; -fx-font-weight: bold");
		credits.getChildren().addAll(text, hyperlink, creditsText);
		addCredit("modmuss50 - Lead Developer", "https://twitter.com/modmuss50");
		addCredit("Prospector - UX Manager", "https://twitter.com/ProfProspector");
		addCredit("primetoxinz - Various Contributions", "https://github.com/primetoxinz");
		addCredit("loading.io - Splash Loading .gif", "https://loading.io/");
		addCredit("Yannick - Home, About, Download, Instances, and Update icons", "https://www.flaticon.com/authors/yannick");
		addCredit("Gregor Cresnar - Package icon", "https://www.flaticon.com/authors/gregor-cresnar");
		addCredit("Egor Rumyantsev - Settings icon", "https://www.flaticon.com/authors/egor-rumyantsev");
		addCredit("Icomoon - Log Out icon", "https://www.flaticon.com/authors/icomoon");
	}
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:30,代码来源:AboutPane.java

示例15: addCredit

import javafx.scene.control.Hyperlink; //导入方法依赖的package包/类
public void addCredit(String credit, String url) {
	Hyperlink hyperlink = new Hyperlink(credit);
	hyperlink.setStyle("-fx-text-fill: #FFFFFF; -fx-font-family:  'Lato', sans-serif; -fx-font-size: 12;");
	hyperlink.setOnAction((actionEvent) -> OperatingSystem.browseURI(url));
	hyperlink.focusTraversableProperty().setValue(false);
	credits.getChildren().add(hyperlink);
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:8,代码来源:AboutPane.java


注:本文中的javafx.scene.control.Hyperlink.setOnAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。