Bonjour.
Bon si certain sont tombé sur d'autres de mes topis ils sauront que je ne suis pas une adèpte des layoutManager ....
Voici mon problème : je cherche à faire une représentation graphique qui seras dans une JInternalFrame (et pour l'instant je la crée dans un Jframe) et dans cette frame dans un panel et sur ce panel decomposé en trois sous panel .. jusque la pas de problème ... ca s'affiche bien, ca fait ce que je veux MAIS:
le redimentionnement ca clignote Horriblement , passant de l'état 2 px sur 2 px à fenetre entière à chaque redimentsonnement.
Je n'utilisais pas de layout donc je me suis dit que le problème venais de là (?) je suis donc repartie à la source et ai au moins voulu afficher les premier panel correctement mais la même dans un borderlayout.center le panel ne prend pas toute la place (c'est pourtant ce que j'avais crus comprendre que dans le borderlayout tout la place etait prise non ??)
Enfin du coup je pose un question de débutante ... OScour comment on fait ?
mon main ma frame
mon panel bas niveau :
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 import java.awt.BorderLayout; import java.awt.Color; import java.util.ArrayList; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JWindow; /** * MainFrame.java */ public class BAMain extends JFrame{ BAMain() { super("MAFBASA :"); this.setSize(800, 600); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); java.awt.Toolkit toolkit=java.awt.Toolkit.getDefaultToolkit(); java.awt.Dimension tailleEcran=toolkit.getScreenSize(); java.awt.Dimension tailleFrame=this.getSize(); this.setLocation((tailleEcran.width-tailleFrame.width)/2,(tailleEcran.height-tailleFrame.height)/2); //this.setLayout(null); ArrayList list = new ArrayList(); list.add(new GenePoint("toto", 1000)); list.add(new GenePoint("titi", 2000)); list.add(new GenePoint("tutu", 5000)); list.add(new GenePoint("a", 8213)); list.add(new GenePoint("b", 5540)); list.add(new GenePoint("c", 46)); JPanel pan = new JPanel(); this.add(pan, BorderLayout.CENTER ); System.out.println(pan.getSize()); BestAlignement ba = new BestAlignement(list,9900,100,(float)0.1,(float)0.1,false,pan); pan.add(ba); this.setVisible(true); } public static void main(String[] args) { BAMain mf = new BAMain(); System.out.println(1+(-2.1%1)); //DbGestion dbg = new DbGestion(); //mf.setdbg(dbg); } }
j'ai donc ma fenetre 800*600 et au milieu en haut un petit truc bleu ridicule ....
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 import java.awt.Color; import java.awt.Graphics; import java.awt.Window; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JWindow; public class BestAlignement extends JPanel{ private int _period; private float _phase; private float _error; private int _size; private boolean _circular; private ArrayList _geneList; private JComponent _parent; BestAlignement(ArrayList list,int size, int period, float phase, float error, boolean circular , JComponent parent) { super(); _geneList = list; _period = period; _phase = phase; _size = size; _error = error; _circular = circular; _parent = parent; this.setBackground(Color.BLUE); //this.setBounds(0, 0, _parent.getWidth(), _parent.getHeight()); //this.setBorder(BorderFactory.createLineBorder(Color.black)); //this.add(new BAGraph(list, size, period, phase, error, circular, this)); //System.out.println("create"); } /* public void paintComponent (Graphics g) { super.paintComponent(g); //this.setBounds(0, 0, _parent.getWidth(), _parent.getHeight()); }*/ }





Répondre avec citation








Partager