> Hi,
> I am displaying a big image within a smaller JcrollPane component like
[quoted text clipped - 20 lines]
>
> Any idea ??
I was going to make a snarky comment about the problem being in your
code, which we can't see. But I got to thinking about what you could
have done to cause it not to work and remembered just how complicated
updating Swing components can be. So I think your problem is that you
need to call revalidate() on your JLabel after you change the image in
your ImageIcon. But I'm just guessing without being able to see your
code :-).
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class test extends JFrame {
public test() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final Image newImage = getToolkit().createImage("kittens.jpg");
final ImageIcon i = new ImageIcon("saturn.jpg");
final JLabel l = new JLabel(i);
JScrollPane sp = new JScrollPane(l);
add(sp,BorderLayout.CENTER);
JButton b = new JButton("Change");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
i.setImage(newImage);
l.revalidate();
}
});
add(b,BorderLayout.NORTH);
setSize(400,300);
setVisible(true);
}
public static void main (String[] args) {
Runnable r = new Runnable() {
public void run() {
new test();
}
};
EventQueue.invokeLater(r);
}
}

Signature
Knute Johnson
email s/nospam/knute/
oliviergir@gmail.com - 11 Mar 2007 12:57 GMT
On 10 mar, 17:08, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> olivier...@gmail.com wrote:
> > Hi,
[quoted text clipped - 75 lines]
>
> - Afficher le texte des messages pr?c?dents -
thanks a lot, Knute this works !
now I have another subtil problem :
I want to capture mouse coordinates when it moves over the picture and
I need both coordinates :
-the ones that relates to the picture (the ones I get if I only add a
mousemotionlistener to the jLabel)
- the ones that relates to the jScrollPane (the ones I get if I only
add a mousemotionlistener to the jScrollPane)
The problem is that each listener works alone but when I add them both
at the same time, the first one hides the second one (the event does
not reach the second listener)
Lew - 11 Mar 2007 15:44 GMT
>> - Masquer le texte des messages précédents -
>>
>> - Afficher le texte des messages précédents -
What is the news client that inserts these comments? (This is the first time
I've seen it in French, though.)
It inserts them into the quoted block in a person's answer, and it never seems
to make sense.
Is it the same one that causes people's posts to appear twice, the second as a
reply to the first?
I want to know so as to be certain never to use it.
-- Lew
Lars Enderin - 11 Mar 2007 23:33 GMT
Lew skrev:
>>> - Masquer le texte des messages précédents -
>>>
[quoted text clipped - 10 lines]
>
> I want to know so as to be certain never to use it.
It's Google Groups.
Luc The Perverse - 12 Mar 2007 03:11 GMT
> Lew skrev:
>>>> - Masquer le texte des messages précédents -
[quoted text clipped - 13 lines]
>
> It's Google Groups.
Oh great. Google hopes to revamp usenet to make it work best with their
service. That is the kind of BS I was expecting from Microsoft.
--
LTP
:)