Bonjour,
j'ai fait une petite application pour visualiser le code source et la page html pour une URL donnée.
J'ai ainsi deux onglets (JTabbedPane) dans mon Panel principal et je met un JLabel dans chaque Panel pour l'affichage.
Le problème c'est que je ne vois rien dans mes onglets..
Voici le code
Pour tester j'ai simplment construit mes JLabel avec un texte.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.ScrollPaneLayout; /** * * @author Nicolas * */ public class JEditorPane extends JPanel{ private JLabel urlLabel; private JLabel contentLabelSourceCode; private JLabel contentLabelHTMLPage; public JTextField urlField; private JButton goOn; private JEditorPaneControler jepc; private JTabbedPane ongletsPane; private JScrollPane scrollPaneSourceCode; private JScrollPane scrollPaneHTMLPage; private JPanel upPane; public JEditorPane(){ super(new BorderLayout()); this.upPane = new JPanel(); add(upPane,java.awt.BorderLayout.NORTH); this.urlLabel = new JLabel("URL : "); upPane.add(urlLabel); this.urlField = new JTextField("Rechercher...",40); upPane.add(urlField); this.goOn = new JButton("Go!"); upPane.add(goOn); this.scrollPaneSourceCode = new JScrollPane(); this.scrollPaneSourceCode.setLayout(new ScrollPaneLayout()); this.scrollPaneHTMLPage = new JScrollPane(); this.scrollPaneHTMLPage.setLayout(new ScrollPaneLayout()); this.ongletsPane = new JTabbedPane(); ongletsPane.addTab("Page HTML", scrollPaneHTMLPage); ongletsPane.addTab("Source Code", scrollPaneSourceCode); this.contentLabelSourceCode = new JLabel("test source"); this.contentLabelHTMLPage = new JLabel("test html"); this.scrollPaneHTMLPage.add(contentLabelHTMLPage); this.scrollPaneSourceCode.add(contentLabelSourceCode); add(ongletsPane,java.awt.BorderLayout.CENTER); Dimension panelDimension = new Dimension(800,600); setMinimumSize(panelDimension); setSize(panelDimension); setPreferredSize(panelDimension); jepc = new JEditorPaneControler(this); //urlField.addCaretListener(jepc); goOn.addMouseListener(jepc); } public void setContentLabelSourceCode(String contentLabelSourceCode) { this.contentLabelSourceCode.setText(contentLabelSourceCode); } public void setContentLabelHTMLPage(String contentLabelHTMLPage) { this.contentLabelHTMLPage.setText(contentLabelHTMLPage); } }
Si qqn a une idéemerci
Partager