JXHyperlink extends JButton { public boolean isClicked() { return hasBeenVisited; } JXHyperlink();  JXHyperlink(Action action); void setURI(URI uri); Color getUnclickedColor(); void setClickedColor(Color color); Color getClickedColor(); void setUnclickedColor(Color color); void setClicked(boolean clicked); boolean isClicked(); void setOverrulesActionOnClick(boolean overrule); boolean getOverrulesActionOnClick(); @Override String getUIClassID(); @Override void updateUI(); static final String uiClassID; }
@Test public void testLinkActionSetTarget() { AbstractHyperlinkAction<Object> linkAction = createEmptyLinkAction(); linkAction.setVisited(true); JXHyperlink hyperlink = new JXHyperlink(linkAction); Object target = new Object(); linkAction.setTarget(target); assertEquals(linkAction.getName(), hyperlink.getText()); assertFalse(hyperlink.isClicked()); }
@Test public void testListeningVisited() { AbstractHyperlinkAction<Object> linkAction = createEmptyLinkAction(); JXHyperlink hyperlink = new JXHyperlink(linkAction); assertEquals(linkAction.isVisited(), hyperlink.isClicked()); assertFalse(linkAction.isVisited()); linkAction.setVisited(!linkAction.isVisited()); assertEquals(linkAction.isVisited(), hyperlink.isClicked()); }
@Test public void testInitialVisitedSynched() { AbstractHyperlinkAction<Object> linkAction = createEmptyLinkAction(); linkAction.setVisited(true); assertTrue(linkAction.isVisited()); JXHyperlink hyperlink = new JXHyperlink(linkAction); assertEquals(linkAction.isVisited(), hyperlink.isClicked()); }