Re:AWT/SWING classpath examples freezin g and not responding to window events

"ffileppo" <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
> Hi guys,
>
> I'm having some troubles when running AWT/SWING classpath examples.
> These examples freeze and crash as soon as any event is triggered (clicking on a button or even trying to resize the window).
>
> I'm doing this with gcj 4.3.0 on arm-linux and gcj 4.2.3 on x86.
>
> Googling around I found this:
> https://bugs.launchpad.net/debian/+source/gcj-4.2/+bug/160070
>
> Seems to be the same bug. They say that examples are working ok with icedtea and should be fixed in classpath upstream.
>
> Any thoughts on this?
>
> I read a message in java-patches mailing list about merging classpath 0.97.2, maybe this will fix the problem?
>
> Thank you,
>
> Francesco
>
>
>

Could anyone try to reproduce / confirm this issue?

For example this code compiled with gcj crashes (i.e. application stops printing numbers) as soon as the mouse pointer is moved on the application window.

I guess this bug is related to classpath and I hope it will be fixed in 0.97.2 merge.

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import java.util.Random;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;

public class TestCase extends JPanel implements ActionListener {
  private JLabel label;
  private NumberFormat formatter;
  private Timer t = new Timer(250, this);
  private Random r = new Random();
  public TestCase(JFrame f) {

    formatter = NumberFormat.getNumberInstance();
    formatter.setMinimumFractionDigits(3);
    formatter.setMaximumFractionDigits(3);
    label = new JLabel();
    label.setBounds(10, 10, 150, 50);
    add(label);
    t.start();
  }

  public void actionPerformed(ActionEvent e) {
    float num = r.nextFloat() * 1500;
    String str = formatter.format(num);
    label.setText(str);
  }

  private static void createAndShowGUI() {
    JFrame frame = new JFrame("TestCase");
    frame.getContentPane().setLayout(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final TestCase tc = new TestCase(frame);
    tc.setOpaque(true);
    frame.setContentPane(tc);
    frame.pack();
    frame.setSize(250, 100);
    frame.setVisible(true);
  }

  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        createAndShowGUI();
      }
    });
  }
}


Francesco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.