run:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.nimbus.NimbusStyle.init(NimbusStyle.java:418)
at com.sun.java.swing.plaf.nimbus.NimbusStyle.validate(NimbusStyle.java:359)
at com.sun.java.swing.plaf.nimbus.NimbusStyle.getValues(NimbusStyle.java:927)
at com.sun.java.swing.plaf.nimbus.NimbusStyle.getInsets(NimbusStyle.java:605)
at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:896)
at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:275)
at javax.swing.plaf.synth.SynthLabelUI.updateStyle(SynthLabelUI.java:53)
at javax.swing.plaf.synth.SynthLabelUI.propertyChange(SynthLabelUI.java:232)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
at java.awt.Component.firePropertyChange(Component.java:8128)
at java.awt.Component.setName(Component.java:935)
at javax.swing.plaf.synth.SynthComboBoxUI$SynthComboBoxRenderer.getListCellRendererComponent(SynthComboBoxUI.java:409)
at javax.swing.plaf.basic.BasicComboBoxUI.getDisplaySize(BasicComboBoxUI.java:1334)
at javax.swing.plaf.basic.BasicComboBoxUI.getMinimumSize(BasicComboBoxUI.java:903)
at javax.swing.plaf.basic.BasicComboBoxUI.getPreferredSize(BasicComboBoxUI.java:892)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
at javax.swing.GroupLayout$ComponentSpring.calculateNonlinkedPreferredSize(GroupLayout.java:2944)
at javax.swing.GroupLayout$ComponentSpring.calculateNonlinkedMinimumSize(GroupLayout.java:2930)
at javax.swing.GroupLayout$ComponentSpring.calculateMinimumSize(GroupLayout.java:2897)
at javax.swing.GroupLayout$Spring.getMinimumSize(GroupLayout.java:1315)
at javax.swing.GroupLayout$ComponentSpring.calculatePreferredSize(GroupLayout.java:2904)
at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325)
at javax.swing.GroupLayout$ComponentSpring.getBaseline(GroupLayout.java:2998)
at javax.swing.GroupLayout$BaselineGroup.calculateBaselineAndResizeBehavior(GroupLayout.java:2657)
at javax.swing.GroupLayout$BaselineGroup.calculateSize(GroupLayout.java:2633)
at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568)
at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325)
at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1604)
at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1593)
at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568)
at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325)
at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1604)
at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1588)
at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568)
at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325)
at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1604)
at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1588)
at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1568)
at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1325)
at javax.swing.GroupLayout$SequentialGroup.setValidSize(GroupLayout.java:1972)
at javax.swing.GroupLayout$Group.setSize(GroupLayout.java:1553)
at javax.swing.GroupLayout.calculateAutopadding(GroupLayout.java:1058)
at javax.swing.GroupLayout.layoutContainer(GroupLayout.java:899)
at java.awt.Container.layout(Container.java:1421)
at java.awt.Container.doLayout(Container.java:1410)
at java.awt.Container.validateTree(Container.java:1507)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validateTree(Container.java:1513)
at java.awt.Container.validate(Container.java:1480)
at java.awt.Window.show(Window.java:861)
at java.awt.Component.show(Component.java:1563)
at java.awt.Component.setVisible(Component.java:1515)
at java.awt.Window.setVisible(Window.java:842)
at inventory.RemoveSupplier$3.run(RemoveSupplier.java:203)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
BUILD STOPPED (total time: 12 seconds)

THIS IS THE CODE

java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * RemoveSupplier.java
 *
 * Created on Feb 16, 2012, 11:09:24 AM
 */
package inventory;

import java.sql.*;
import javax.swing.JOptionPane;

/**
 *
 * @author Administrator
 */
public class RemoveSupplier extends javax.swing.JFrame {

    Connection con;
    Statement stmt1;
    ResultSet rs1;

    /** Creates new form RemoveSupplier */
    public RemoveSupplier() {
        initComponents();
        try {
            con = new database().connect();
            stmt1 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

            rs1 = stmt1.executeQuery("SELECT SName FROM SupplierData ORDER BY ID");
            while (rs1.next()) {
                supSelect.addItem(rs1.getString(1));
            }
            rs1.close();

            con.close();

        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, e.toString());
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        supDel = new javax.swing.JButton();
        supCan = new javax.swing.JButton();
        supSelect = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(inventory.InventoryApp.class).getContext().getResourceMap(RemoveSupplier.class);
        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        supDel.setFont(resourceMap.getFont("supCan.font")); // NOI18N
        supDel.setText(resourceMap.getString("supDel.text")); // NOI18N
        supDel.setName("supDel"); // NOI18N
        supDel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                supDelActionPerformed(evt);
            }
        });

        supCan.setFont(resourceMap.getFont("supCan.font")); // NOI18N
        supCan.setText(resourceMap.getString("supCan.text")); // NOI18N
        supCan.setName("supCan"); // NOI18N
        supCan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                supCanActionPerformed(evt);
            }
        });

        supSelect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Select Here" }));
        supSelect.setName("supSelect"); // NOI18N

        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(123, 123, 123)
                        .addComponent(supDel)
                        .addGap(119, 119, 119)
                        .addComponent(supCan)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(59, 59, 59))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
                        .addComponent(supSelect, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(43, 43, 43))
                    .addComponent(jLabel1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(supSelect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(supDel)
                    .addComponent(supCan))
                .addGap(18, 18, 18)
                .addComponent(jLabel3)
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-530)/2, (screenSize.height-275)/2, 530, 275);
    }// </editor-fold>                        

private void supDelActionPerformed(java.awt.event.ActionEvent evt) {                                       
    try {
        con = new database().connect();
        String delItem = (String) supSelect.getSelectedItem();
        PreparedStatement ps1 = con.prepareStatement("delete from SupplierData where SName='" + delItem + "'");
        int i = ps1.executeUpdate();
        if (i == 1) {
            JOptionPane.showMessageDialog(this, "Deleted");
        }

    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, e.toString());
    }
    this.dispose();

}                                      

private void supCanActionPerformed(java.awt.event.ActionEvent evt) {                                       
    int conf = JOptionPane.showConfirmDialog(this, "Are you sure ?");
    if (conf == 0) {
        this.dispose();
    } else {
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);

    }
}                                      

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(RemoveSupplier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(RemoveSupplier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(RemoveSupplier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(RemoveSupplier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new RemoveSupplier().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JButton supCan;
    private javax.swing.JButton supDel;
    private javax.swing.JComboBox supSelect;
    // End of variables declaration                   
}

I'd add a call to printStackTrace to the catch block line 43 to show the full text of the error message.

Comments
Yup, that'll give a clearer idea about the exception. *AGREE*

Thanks for taking time and replying NormR1..

But actually the stupidest thing happed with this code..

I just changed the JDK from 1.6 to 1.7 and then tried this code and it worked with no errors...

And since, all other are working flawlessly...

Thanks for taking time and replying NormR1..

But actually the stupidest thing happed with this code..

I just changed the JDK from 1.6 to 1.7 and then tried this code and it worked with no errors...

And since, all other are working flawlessly...

I think thats because the Nimbus style is only supported by JDK 7... So running that code on a JDK 6/jre 6 will throw an error

but thats is the other problem...
i never selected NIMBUS !!!
m coding in windows xp as such but i displays some code as nimbus and some as XP

Read lines 178 onwards in the code you posted. That's where your program explicitly selects Nimbus.
Yet another good example of why an IDE is dangerous for less experienced users - you probably didn't know that your IDE did that behind your back.

i know it is doing that .. i tried to change it.. its not happening..
can u suggest me steps or something..

"i never selected NIMBUS !!!"
"i know it is doing that "
make your mind up.

"i tried to change it.. its not happening" - change what to what exactly? How can anyone possibly comment on some change that you don't tell us about.

"can u suggest me steps or something." Yes - think about what you are posting and give accurate, consistent and most of all complete info to those who are trying to help you.

I m sorry to confuse u sir.
looking at the code i know it is automatically selecting Nimbus..
all i want to know is ..
how can i change it....

That code was generated by your IDE, so you'll need to look in the IDE for the option to set the L&F. You could just delete that block of code, but your IDE will probably recreate it next time unless you change the option in your IDE.

This article has been dead for over six months. Start a new discussion instead.