Results 1 to 4 of 4
  1. #1
    sultanofswing is offline Member
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default Simple Swing throws Exception in thread "AWT-EventQueue-0"

    I am trying to learn Swing, so I purchased Herb Schildt's Beginner's guide, and the first simple program is :

    import javax.swing.*;

    class SwingDemo {

    SwingDemo() {
    JFrame jfrm = new JFrame("A Simple Swing Program");

    jfrm.setSize(275, 100);

    jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );

    JLabel jlab = new JLabel("Swing powers the modern Java GUI");

    jfrm.getContentPane().add(jlab);

    jfrm.setVisible(true);
    }

    /**
    * @param args
    */
    public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {

    @Override
    public void run() {
    new SwingDemo();
    }
    });


    }

    }

    I am using eclipse to try to run this as a Java application. It creates the frame, but the label is not there, and it generates the following runtime error:


    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: sun.awt.image.BufImgSurfaceData.initIDs()V
    at sun.awt.image.BufImgSurfaceData.initIDs(Native Method)
    at sun.awt.image.BufImgSurfaceData.<clinit>(Unknown Source)
    at sun.awt.image.VolatileSurfaceManager.getBackupSurf ace(Unknown Source)
    at sun.awt.image.VolatileSurfaceManager.initialize(Un known Source)
    at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    at sun.awt.windows.WComponentPeer.createVolatileImage (Unknown Source)
    at java.awt.Component.createVolatileImage(Unknown Source)
    at java.awt.Component$BltBufferStrategy.createBackBuf fers(Unknown Source)
    at java.awt.Component$BltBufferStrategy.<init>(Unknow n Source)
    at java.awt.Component$BltSubRegionBufferStrategy.<ini t>(Unknown Source)
    at java.awt.Component.createBufferStrategy(Unknown Source)
    at java.awt.Window.createBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager$BufferInfo. createBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager$BufferInfo. createBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager$BufferInfo. getBufferStrategy(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.prepare(Unk nown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unkno wn Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at java.awt.GraphicsCallback$PaintCallback.run(Unknow n Source)
    at sun.awt.SunGraphicsCallback.runOneComponent(Unknow n Source)
    at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    at java.awt.Container.paint(Unknown Source)
    at java.awt.Window.paint(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unkno wn Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unkno wn Source)
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Un known Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWor kRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    1. What OS?
    2. What does java -version report?

    db

    edit 3. Make sure you have the latest graphics drivers for your hardware.
    Last edited by DarrylBurke; 10-29-2010 at 07:44 PM.

  3. #3
    sultanofswing is offline Member
    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    Default OS and Java version

    Windows XP SP 3

    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

Similar Threads

  1. Replies: 3
    Last Post: 04-30-2010, 07:44 PM
  2. Replies: 5
    Last Post: 08-26-2009, 11:37 AM
  3. Replies: 4
    Last Post: 06-07-2009, 12:59 AM
  4. Replies: 3
    Last Post: 06-07-2009, 12:14 AM
  5. Replies: 10
    Last Post: 01-29-2009, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •