eltoto13
Messages postés4Date d'inscriptionmardi 17 octobre 2006StatutMembreDernière intervention 3 février 2007
-
1 févr. 2007 à 18:43
eltoto13
Messages postés4Date d'inscriptionmardi 17 octobre 2006StatutMembreDernière intervention 3 février 2007
-
3 févr. 2007 à 14:02
voila
mon probleme et que jaffiche une page html dans un jEditorPane mais que la page et trop grande pour ma fenetre donc je voudrai mettre une scrollbar pour voir toute ma page mais impossible d'y parvenir jai essayé JScrollPane, JScrollBar et rien n'y fait je n'arrive pas a descendre dans ma page html...
public class Help extends JFrame {
// Builder of the view
public Help() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
// Initialize all the elements of the view
private void jbInit() throws Exception {
getContentPane().setLayout(null);
this.setBounds(100,100,405,530);
this.setResizable(false);
this.setTitle("Othello Help");
this.getContentPane().add(jEditorPane1);
this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
jEditorPane1.setBackground(new Color(204,204,204)); //#CCCCCC
jEditorPane1.setBounds(new Rectangle(10, 10, 380, 480));
jEditorPane1.setEditable(false);
// Link to the Help page in html
File file = new File("Othello_Help.html");
jEditorPane1.setPage(file.toURL());
}
JEditorPane jEditorPane1 = new JEditorPane();
JScrollPane jScrollPane1 = new JScrollPane(jEditorPane1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
eltoto13
Messages postés4Date d'inscriptionmardi 17 octobre 2006StatutMembreDernière intervention 3 février 2007 3 févr. 2007 à 12:00
voila mon probleme et que jaffiche une page html dans un jEditorPane mais que la page et trop grande pour ma fenetre donc je voudrai mettre une scrollbar pour voir toute ma page mais impossible d'y parvenir jai essayé JScrollPane, JScrollBar et rien n'y fait je n'arrive pas a descendre dans ma page html... voici mon code:
package othello_game;
import java.io.File;
import java.awt.*;
import javax.swing.*;
public class Help extends JFrame {
// Builder of the view
public Help() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
// Initialize all the elements of the view
private void jbInit() throws Exception {
getContentPane().setLayout(null);
this.setBounds(100,100,405,530);
this.setResizable(false);
this.setTitle("Othello Help");
this.getContentPane().add(jEditorPane1);
this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
jEditorPane1.setBackground(new Color(204,204,204)); //#CCCCCC
jEditorPane1.setBounds(new Rectangle(10, 10, 380, 480));
jEditorPane1.setEditable(false);
// Link to the Help page in html
File file = new File("Othello_Help.html");
jEditorPane1.setPage(file.toURL());
}
JEditorPane jEditorPane1 = new JEditorPane();
JScrollPane jScrollPane1 = new JScrollPane(jEditorPane1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
}
sheorogath
Messages postés2448Date d'inscriptionsamedi 21 février 2004StatutModérateurDernière intervention29 janvier 201017 3 févr. 2007 à 12:06
oula ben il me semble que c'est un peu normal tu tente d'ajouter ton JScrollPane avant meme de l'avoir declare
ca renifle l'autogeneration a plein nez ....
essai plutot de mettre ton code d'ajout dans la frame apres le code de parametrage et declaration
"n'est pas mort ce qui semble a jamais dormir et en d'etrange temps meme la mort peut mourrir"
eltoto13
Messages postés4Date d'inscriptionmardi 17 octobre 2006StatutMembreDernière intervention 3 février 2007 3 févr. 2007 à 14:02
J'ai fait ce que vous m'avais mais cela ne change rien la scrollbar ne s'affiche toujours
Effectivement j'utilise Jbuilder 2005 donc ajout automatique un peu nimprote ou... ^^
mais jusque la je n'avais jamais eu de probleme