Bonjours,
J'ai un problême, j'aimerai intégrer une image en fond dans chaque onglets, puis un code html dans dans chacun, j'ai beau chercher je ne trouve pas, aidez-moi please !
Voici mon code :
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
| import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
public class Fenetre extends JFrame {
private JTabbedPane onglet = new JTabbedPane();
private JMenuBar menuBar= new JMenuBar() ;
private JMenu Jeux = new JMenu("Jeux");
private JMenu Option = new JMenu("Option");
private JMenu Aide = new JMenu("Aide") ;
private JMenu DayZ = new JMenu("Lancer DayZ");
private JMenuItem DayZ_Mod = new JMenuItem("Lancer DayZ - Mod");
private JMenuItem DayZ_SA = new JMenuItem("Lancer Dayz - SA");
private JMenuItem Quitter = new JMenuItem("Quitter");
private JMenuItem option = new JMenuItem("Option");
private JMenuItem DayZ_Guide = new JMenuItem("DayZGuide");
private JMenuItem Forum = new JMenuItem("Forum");
private JMenuItem Credit = new JMenuItem("Crédit");
private JButton dayz_mod = new JButton("Lancer");
private JButton dayz_sa = new JButton("Lancer");
private JButton teamspeak_3 = new JButton("Rejoindre");
private JEditorPane onglet1;
public Fenetre()
{
onglet1 = new JEditorPane();
onglet1.setEditable(false);
this.setTitle("MartiusEtMojql Server 0.1 by iZyL2oSe");
this.setSize(590,400);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
Panneau[] tPan = { new Panneau(Color.WHITE), new Panneau(Color.WHITE), new Panneau(Color.WHITE)};
JPanel onglet1 = new JPanel();
JLabel titreOnglet1 = new JLabel("DayZ Mod");
onglet1.add(titreOnglet1);
onglet1.add(dayz_mod);
JPanel onglet2 = new JPanel();
JLabel titreOnglet2 = new JLabel("DayZ SA");
onglet2.add(titreOnglet2);
onglet2.add(dayz_sa);
JPanel onglet3 = new JPanel();
JLabel titreOnglet3 = new JLabel("TeamSpeak 3");
onglet3.add(titreOnglet3);
onglet3.add(teamspeak_3);
onglet.addTab("DayZ Mod", onglet1);
onglet.addTab("DayZ SA", onglet2);
onglet.addTab("TeamSpeak 3", onglet3);
JPanel b3 = new JPanel();
b3.setLayout(new BoxLayout(b3, BoxLayout.LINE_AXIS));
b3.add(onglet);
{
this.Jeux.add(DayZ);
this.Jeux.add(Quitter);
this.Option.add(option);
this.Aide.add(DayZ_Guide);
this.Aide.add(Forum);
this.Aide.add(Credit);
this.DayZ.add(DayZ_Mod);
this.DayZ.add(DayZ_SA);
}
this.menuBar.add(Jeux);
this.menuBar.add(Option);
this.menuBar.add(Aide);
this.setJMenuBar(menuBar);
/*steam://run/221100//-connect=37.59.90.87:2312*/
Quitter.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
System.exit(0);
}
});
DayZ_Mod.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Runtime r = Runtime.getRuntime();
try{
r.exec("cmd /c start steam://run/221100//-connect=37.59.90.87:2312");
}
catch (IOException ex){
ex.printStackTrace();
}
}
});
DayZ_SA.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Runtime r = Runtime.getRuntime();
try{
r.exec("cmd /c start steam://run/221100//-connect=62.210.177.24:2402");
}
catch (IOException ex){
ex.printStackTrace();
}
}
});
DayZ_Guide.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Runtime r = Runtime.getRuntime();
try{
r.exec("cmd /c start http://altis.aiekillu.fr/");
System.out.println("Ouverture réussi");
}
catch (IOException ex){
ex.printStackTrace();
System.out.println("Ouverture échoué");
}
}
});
Forum.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Runtime r = Runtime.getRuntime();
try{
r.exec("cmd /c start http://aiekillu.fr/forum/");
}
catch (IOException ex){
ex.printStackTrace();
}
}
});
Credit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Credit cre = new Credit();
}
});
dayz_mod.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Runtime r = Runtime.getRuntime();
try{
r.exec("cmd /c start steam://run/221100//-connect=37.59.90.87:2312");
}
catch (IOException ex){
ex.printStackTrace();
}
}
});
dayz_sa.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Runtime r = Runtime.getRuntime();
try{
r.exec("cmd /c start steam://run/221100//-connect=62.210.177.24:2402");
}
catch (IOException ex){
ex.printStackTrace();
}
}
});
teamspeak_3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
Runtime r = Runtime.getRuntime();
try{
r.exec("cmd /c start ts3server://ts3.dayzguide.fr/");
}
catch (IOException ex){
ex.printStackTrace();
}
}
});
JPanel b4 = new JPanel();
b4.setLayout(new BoxLayout(b4, BoxLayout.PAGE_AXIS));
b4.add(b3);
this.getContentPane().add(b4);
this.setVisible(true);
JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
java.net.URL helpURL = TextSamplerDemo.class.getResource(
"server_dayz_sa.html");
if (helpURL != null) {
try {
editorPane.setPage(helpURL);
} catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + helpURL);
}
} else {
System.err.println("Couldn't find file: server_dayz_sa.html");
}
}
} |
Dans le deuxieme onglets j'aimerai mettre :

Et en html :
<a href="http://www.gametracker.com/server_info/62.210.177.24:2402/" target="_blank"><img src="http://cache.www.gametracker.com/server_info/62.210.177.24:2402/b_160_400_1_ffffff_c5c5c5_ffffff_000000_0_1_0.png" border="0" width="160" height="248" alt=""/></a>
Est-ce que c'est possible ? En utilisant JEditorPane, JTextPane ou autre...
Merci d'avance. Cordielement, iZy.
Partager