Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hyperlink Not-Visited Color

BluewizardJun 21 2013 — edited Jun 24 2013

Hi,

I am test out my JavaFX application under JDK 8.  I notice that the initial text color of the Hyperlink is blue (as if it is show that the link has been visited).  Forcing the link to not-visited by using the "link.setVisited(false)" does not seem to help.

I am using : (build 1.8.0-ea-b94)

I found this JIRA : https://javafx-jira.kenai.com/browse/RT-30393

It says resolved - but the code below show shows the problem.

import javafx.application.Application;

import javafx.event.ActionEvent;

import javafx.event.EventHandler;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.control.Button;

import javafx.scene.control.Hyperlink;

import javafx.scene.control.ScrollPane;

import javafx.scene.image.Image;

import javafx.scene.image.ImageView;

import javafx.scene.layout.VBox;

import javafx.stage.Stage;

public class MyHyperlink extends Application

{

  final static String[] imageFiles = new String[]

  {

  "product.png", "education.png", "partners.png", "support.png"

  };

  final static String[] captions = new String[]

  {

  "Products", "Education", "Partners", "Support"

  };

  final ImageView selectedImage = new ImageView();

  final ScrollPane list = new ScrollPane();

  final Hyperlink[] hpls = new Hyperlink[captions.length];

  final Image[] images = new Image[imageFiles.length];

  public static void main(String[] args)

  {

  Application.launch(args);

  }

  @Override

  public void start(Stage stage)

  {

  Scene scene = new Scene(new Group());

  stage.setTitle("Hyperlink Sample");

  stage.setWidth(300);

  stage.setHeight(200);

  this.selectedImage.setLayoutX(100);

  this.selectedImage.setLayoutY(10);

  for (int i = 0; i < captions.length; i++)

  {

  final Hyperlink hpl = this.hpls[i] = new Hyperlink(captions[i]);

  //final Image image = this.images[i] = new Image(this.getClass().getResourceAsStream(imageFiles[i]));

  hpl.setOnAction(new EventHandler<ActionEvent>()

  {

  @Override

  public void handle(ActionEvent e)

  {

  //MyHyperlink.this.selectedImage.setImage(image);

  }

  });

  }

  final Button button = new Button("Refresh links");

  button.setOnAction(new EventHandler<ActionEvent>()

  {

  @Override

  public void handle(ActionEvent e)

  {

  for (int i = 0; i < captions.length; i++)

  {

  MyHyperlink.this.hpls[i].setVisited(false);

  MyHyperlink.this.selectedImage.setImage(null);

  }

  }

  });

  VBox vbox = new VBox();

  vbox.getChildren().addAll(this.hpls);

  vbox.getChildren().add(button);

  vbox.setSpacing(5);

  ((Group) scene.getRoot()).getChildren().addAll(vbox, this.selectedImage);

  stage.setScene(scene);

  stage.show();

  }

}

Thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2013
Added on Jun 21 2013
3 comments
816 views