Bonjour,

je vais essayer d'expliquer correctement mon problème:

J'ai des pannel translucide sur la couche superieur de mon application.
Ils sont bien translucide sauf que ce que je vois en transparence n'est pas toujours ce qu'il y a en dessous. et je n'ai pas vraiment d'idée sur la provenance du problème. Y a t'il quelqu'un qui a déjà rencontré ce genre de chose ? ou une idée sur l'origine du problème ?

au cas ou ca aiderais le code du panel :

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
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
 
package BestAlignement;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
 
import javax.swing.BorderFactory;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.border.Border;
 
 
public class BAAFloatingPane extends JPanel{
 
	int _width;
	int _height;
	int _startWidth;
	int _startHeight;
	int _x;
	int _y;
	int _startx;
	int _starty;
	Point _startdrag;
	JPanel _header;
	int _transparency;
	JPanel _resize;
	BestAlignementArea _area;
	Border _border;
	BAAreaInfoPan _paramPane;
	BAAFloatingPane(BestAlignementArea area, BAAreaInfoPan paramPane)
	{
		_x = 100;
		_y=100;
		_width =450;
		_height =100;
		_transparency = 50;
 
		_border = BorderFactory.createLineBorder(Color.GRAY, 1);
		_area = area;
		_paramPane = paramPane;
		this.setLayout(null);
		this.setBounds(_x,_y,_width,_height);
		this.setVisible(true);
 
		//this.setBackground(Color.BLUE);
		this.addMouseListener(new ml());
		_header = new JPanel();
		_header.addMouseListener(new MovestartListener());
		_header.addMouseMotionListener(new MoveListener());
		this.add(_header);
 
		this.add(_paramPane);
 
		_resize = new JPanel();
		_resize.addMouseListener(new ResizestartListener());
		_resize.addMouseMotionListener(new ResizeListener());
		this.add(_resize);
 
		modifTransparency();
 
 
	}
 
 
	class ResizestartListener implements MouseListener
	{
 
		public void mouseClicked(MouseEvent event) {
			processMouseEvent(event);
		}
 
		public void mouseEntered(MouseEvent event) {
			processMouseEvent(event);
		}
 
		public void mouseExited(MouseEvent event) {
			processMouseEvent(event);
		}
 
		public void mousePressed(MouseEvent event) {
			_startWidth = _width;
			_startHeight = _height;
			_startdrag = MouseInfo.getPointerInfo().getLocation();
			processMouseEvent(event);
		}
 
		public void mouseReleased(MouseEvent event) {
			processMouseEvent(event);
		}
 
 
	}
 
 
	private void modifTransparency()
	{
		this.setBackground(new Color(245,245,245,_transparency));
		_header.setBackground(new Color(154,202,215,_transparency));
		_resize.setBackground(new Color(154,202,215,_transparency));
	}
 
	public void setSelected(boolean selected)
	{
		if (selected)
		{
		_transparency = 200;
		_border = BorderFactory.createLineBorder(Color.BLACK,1);
		}
		else 
			{
			_transparency = 20;
			_border = BorderFactory.createLineBorder(Color.GRAY, 1);
			}
		modifTransparency();
		repaint();
	}
 
 
	class ResizeListener implements MouseMotionListener
	{
 
		public void mouseDragged(MouseEvent event) {
			_width = _startWidth + (int)(MouseInfo.getPointerInfo().getLocation().getX() - _startdrag.getX());
			if (_width < 30) _width = 30;
			_height = _startHeight + (int)(MouseInfo.getPointerInfo().getLocation().getY() - _startdrag.getY());
			if (_height < 30) _height = 30;
			repaint();
			processMouseEvent(event);
		}
 
		public void mouseMoved(MouseEvent event) {
			// TODO Auto-generated method stub
			processMouseEvent(event);
		}
 
	}
 
 
	class MovestartListener implements MouseListener
	{
 
		public void mouseClicked(MouseEvent event) {
			processMouseEvent(event);
		}
 
		public void mouseEntered(MouseEvent event) {
			processMouseEvent(event);
		}
 
		public void mouseExited(MouseEvent event) {
			processMouseEvent(event);
		}
 
		public void mousePressed(MouseEvent event) {
			_startx = _x;
			_starty = _y;
			_startdrag = MouseInfo.getPointerInfo().getLocation();
			processMouseEvent(event);
		}
 
		public void mouseReleased(MouseEvent event) {
			processMouseEvent(event);
		}
 
 
	}
 
	class MoveListener implements MouseMotionListener
	{
 
		public void mouseDragged(MouseEvent event) {
			_x = _startx + (int)(MouseInfo.getPointerInfo().getLocation().getX() - _startdrag.getX());
			_y = _starty + (int)(MouseInfo.getPointerInfo().getLocation().getY() - _startdrag.getY());
			repaint();
			processMouseEvent(event);
		}
 
		public void mouseMoved(MouseEvent event) {
			processMouseEvent(event);
		}
 
	}
 
 
	class ml implements MouseListener
	{
 
		public void mouseClicked(MouseEvent event) {
			if (event.getClickCount()==2)
			{
				_area.Select();
				repaint();
			}
		}
 
		public void mouseEntered(MouseEvent event) {}
 
		public void mouseExited(MouseEvent event) {}
 
		public void mousePressed(MouseEvent event) {}
 
		public void mouseReleased(MouseEvent event) {}
 
	}
 
	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
 
		this.setBounds(_x,_y,_width,_height);
		if (_border != null) this.setBorder(_border);
		else this.setBorder(null);
		_header.setBounds(1,1,_width-2,14);
		_resize.setBounds(_width-11,_height-10,10,10);
		_paramPane.setBounds(1,15,_width-2,55);
	}
}