Précédent   Forum du club des développeurs et IT Pro > Java > Interfaces Graphiques en Java > AWT/SWING
AWT/SWING
Forum d'entraide pour les API Swing et AWT. Avant de poster -> FAQ AWT/SWING
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 09/11/2012, 21h12   #1
oussama.elhadri
Invité de passage
 
Inscription : novembre 2012
Messages : 8
Détails du profil
Informations forums :
Inscription : novembre 2012
Messages : 8
Points : 1
Points : 1
Bonjour,

Je suis en train de créer un éditeur de texte en utilisant JSyntaxPane pour la coloration de code.

Le problème est que l'affichage de JScrollPane est très minimisé, en une ligne, comme un JTextField.
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
public class WindowIDE extends JFrame {    
    private Container globalContenu ;
 
    public WindowIDE() {
 
        globalContenu = getContentPane();                    
 
        globalContenu.setLayout(new BorderLayout());
 
        JTabbedPane tabbedPane = new JTabbedPane();
 
        //onglet1
        JPanel panneau1=new JPanel ();        
        JSyntaxPane synpan1=new JSyntaxPane(panneau1);
        tabbedPane.addTab("onglet1",  panneau1);
 
        //onglet2   
        JPanel panneau2= new JPanel();    
        JSyntaxPane synpan2 = new JSyntaxPane(panneau2);
        tabbedPane.addTab("onglets2",  panneau2);          
 
        globalContenu.add( tabbedPane, BorderLayout.CENTER);
 
        setSize(800, 600);
        setResizable(true);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);        
    }
}
Et voici l'autre classe
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class JSyntaxPane extends JPanel { 
 
    public JSyntaxPane(JPanel contenu) {
 
        DefaultSyntaxKit.initKit();
 
        final JEditorPane codeEditor = new JEditorPane();
        JScrollPane scrPane = new JScrollPane(codeEditor);
        contenu.add(scrPane);
 
        codeEditor.setContentType("text/java");
        codeEditor.setText("public static void main(String[] args)" );
    }
}
Quelqu'un saurait-il m'indiquer comment résoudre ce problème ?

Merci d'avance pour votre aide.
oussama.elhadri est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/11/2012, 11h47   #2
sinok
Modérateur
 
Avatar de sinok
 
Inscription : août 2004
Messages : 8 640
Détails du profil
Informations personnelles :
Âge : 33
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : août 2004
Messages : 8 640
Points : 12 444
Points : 12 444
Utilise un BorderLayout pour tes JPanel panneau1 et panneau2.
__________________
Hey, this is mine. That's mine. All this is mine. I'm claiming all this as mine. Except that bit. I don't want that bit. But all the rest of this is mine. Hey, this has been a really good day. I've eaten five times, I've slept six times, and I've made a lot of things mine. Tomorrow, I'm gonna see if I can't have sex with something.
sinok est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/11/2012, 15h11   #3
oussama.elhadri
Invité de passage
 
Inscription : novembre 2012
Messages : 8
Détails du profil
Informations forums :
Inscription : novembre 2012
Messages : 8
Points : 1
Points : 1
merci beaucoup SINOK
hey this all yours
oussama.elhadri est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/11/2012, 16h39   #4
oussama.elhadri
Invité de passage
 
Inscription : novembre 2012
Messages : 8
Détails du profil
Informations forums :
Inscription : novembre 2012
Messages : 8
Points : 1
Points : 1
Par défaut ongelt remove &jsyntaxpane

bonjour
j'au un autre probleme , c est que j'arrive pas à ajouter le "X" pour fermer l'onglet.
oussama.elhadri est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/11/2012, 16h53   #5
wax78
Modérateur
 
Avatar de wax78
 
Homme Renaud Warnotte
Développeur informatique
Inscription : août 2006
Messages : 2 138
Détails du profil
Informations personnelles :
Nom : Homme Renaud Warnotte
Âge : 32
Localisation : Belgique

Informations professionnelles :
Activité : Développeur informatique
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : août 2006
Messages : 2 138
Points : 4 088
Points : 4 088
Envoyer un message via MSN à wax78
Je ne penses pas (sans être 100% certain) que tu puisses rajouter un bouton pour "fermer" un onglet en utilisant un tabbedpane de base.
wax78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/11/2012, 17h48   #6
oussama.elhadri
Invité de passage
 
Inscription : novembre 2012
Messages : 8
Détails du profil
Informations forums :
Inscription : novembre 2012
Messages : 8
Points : 1
Points : 1
Par défaut Close Button

et comment faire ??
oussama.elhadri est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/11/2012, 17h53   #7
sinok
Modérateur
 
Avatar de sinok
 
Inscription : août 2004
Messages : 8 640
Détails du profil
Informations personnelles :
Âge : 33
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : août 2004
Messages : 8 640
Points : 12 444
Points : 12 444
Si, c'est tout à fait possible depuis java 6 avec la méthode setTabComponentAt

Il te suffit de lui passer un JButton sur lequel tu auras placé un ActionListener qui fermera l'onglet.

(ensuite, pour la croix, une icône fera l'affaire).
__________________
Hey, this is mine. That's mine. All this is mine. I'm claiming all this as mine. Except that bit. I don't want that bit. But all the rest of this is mine. Hey, this has been a really good day. I've eaten five times, I've slept six times, and I've made a lot of things mine. Tomorrow, I'm gonna see if I can't have sex with something.
sinok est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 20/11/2012, 18h27   #8
wax78
Modérateur
 
Avatar de wax78
 
Homme Renaud Warnotte
Développeur informatique
Inscription : août 2006
Messages : 2 138
Détails du profil
Informations personnelles :
Nom : Homme Renaud Warnotte
Âge : 32
Localisation : Belgique

Informations professionnelles :
Activité : Développeur informatique
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : août 2006
Messages : 2 138
Points : 4 088
Points : 4 088
Envoyer un message via MSN à wax78
Bien vu !

Comme quoi un 2 ème avis peut tout changer.
wax78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/11/2012, 14h58   #9
oussama.elhadri
Invité de passage
 
Inscription : novembre 2012
Messages : 8
Détails du profil
Informations forums :
Inscription : novembre 2012
Messages : 8
Points : 1
Points : 1
biensur
merci
oussama.elhadri est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Cette discussion est résolue.
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 00h14.


 
 
 
 
Partenaires

Hébergement Web