1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| public class Liens extends JFrame implements HyperlinkListener{
private JDesktopPane desktop = null;
private JEditorPane liensLabel = null;
public Liens(int posWidth,int posHeight) {
super();
initialize(posWidth,posHeight);
}
private void initialize(int posWidth,int posHeight) {
this.setResizable(false);
this.setContentPane(getDesktop());
this.setSize(336, 200);
this.setTitle("Liens sur Wow");
this.setLocation(posWidth + 50, posHeight + 50);
}
private JDesktopPane getDesktop(){
if (desktop == null) {
liensLabel = new JEditorPane();
liensLabel.setBounds(new java.awt.Rectangle(17,5,304,158));
System.out.println(liensLabel.getEditorKit());
liensLabel.setContentType("text/html");
liensLabel.setText("<html>Voici des liens qui peuvent vous aider dans vos calculs : <br>" +
" <a href=\"http://worldofwarcraft.judgehype.com\">Judgehype, pour les compétences et talents</a><br>" +
" <a href=\"http://www.wowdbu.com\">WoWDbu, pour voir les différents équipements</a><br>" +
" <a href=\"http://www.wow-europe.com/fr\">Le site officiel</a><br>" +
" </html>");
liensLabel.addHyperlinkListener(this);
liensLabel.setEditable(false);
desktop = new JDesktopPane();
desktop.add(liensLabel, null);
}
return desktop;
}
public void hyperlinkUpdate(HyperlinkEvent e){
if(e.getEventType()==HyperlinkEvent.EventType.ACTIVATED){
try {
Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + e.getURL());
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
} |