Results 1 to 2 of 2
  1. #1
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default Netbeans Swing Error ?

    Please watch this :

    package gui;
    import model.*;
    import java.sql.*;
    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    /*
    * JenisBarang.java
    *
    * Created on Aug 24, 2009, 7:26:08 AM
    */

    package gui;
    import model.*;
    import java.sql.*;
    /**
    *
    * @author admin
    */
    public class JenisBarang extends javax.swing.JFrame {

    String sql = "";
    Connection conn;
    Statement stmt;
    ResultSet rs;
    Connect A = new Connect();
    /** Creates new form JenisBarang */
    public JenisBarang(){
    initComponents();
    /*sql = "SELECT * FROM MsJenisBarang ORDER BY KdJenisBarang ASC";
    conn = A.getConnection();
    try {
    stmt = conn.createStatement();
    rs = stmt.executeQuery(sql);
    tabJenisBarang.setModel(null);
    } catch (SQLException ex) {
    Logger.getLogger(JenisBarang.class.getName()).log( Level.SEVERE, null, ex);
    }*/

    }

    /** 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() {

    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    cbField = new javax.swing.JComboBox();
    txtSearch = new javax.swing.JTextField();
    jScrollPane1 = new javax.swing.JScrollPane();
    tabJenisBarang = new javax.swing.JTable();
    jPanel2 = new javax.swing.JPanel();
    btnAdd = new javax.swing.JButton();
    btnEdit = new javax.swing.JButton();
    btnDelete = new javax.swing.JButton();
    btnRefresh = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstan ts.DISPOSE_ON_CLOSE);
    setTitle("Jenis Barang");
    setAlwaysOnTop(true);
    setBounds(new java.awt.Rectangle(5, 45, 0, 0));

    jPanel1.setName("jPanel1"); // NOI18N

    jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/search.png"))); // NOI18N
    jLabel1.setName("jLabel1"); // NOI18N

    cbField.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- Pilih --", "Kode Jenis", "Nama Jenis" }));
    cbField.setName("cbField"); // NOI18N

    txtSearch.setName("txtSearch"); // NOI18N

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addComponent(cbField, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.UNRELATED)
    .addComponent(txtSearch, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
    .addContainerGap())
    );
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(11, 11, 11)
    .addGroup(jPanel1Layout.createParallelGroup(javax. swing.GroupLayout.Alignment.BASELINE)
    .addComponent(cbField, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
    .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(11, 11, 11))
    );

    jScrollPane1.setName("jScrollPane1"); // NOI18N

    tabJenisBarang.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {

    },
    new String [] {
    "Kode Jenis", "Nama Jenis", "Tanggal Create"
    }
    ));
    tabJenisBarang.setName("tabJenisBarang"); // NOI18N
    jScrollPane1.setViewportView(tabJenisBarang);

    jPanel2.setName("jPanel2"); // NOI18N
    jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    btnAdd.setText("Tambah");
    btnAdd.setName("btnAdd"); // NOI18N
    btnAdd.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btnAddActionPerformed(evt);
    }
    });
    jPanel2.add(btnAdd, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 0, -1, -1));

    btnEdit.setText("Ubah Data");
    btnEdit.setName("btnEdit"); // NOI18N
    jPanel2.add(btnEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 0, -1, -1));

    btnDelete.setText("Hapus");
    btnDelete.setName("btnDelete"); // NOI18N
    jPanel2.add(btnDelete, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 0, -1, -1));

    btnRefresh.setText("Refresh");
    btnRefresh.setName("btnRefresh"); // NOI18N
    jPanel2.add(btnRefresh, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 0, -1, -1));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 462, Short.MAX_VALUE)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 462, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
    );

    pack();
    }// </editor-fold>

    private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new JenisBarang().setVisible(true);
    }
    });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnEdit;
    private javax.swing.JButton btnRefresh;
    private javax.swing.JComboBox cbField;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tabJenisBarang;
    private javax.swing.JTextField txtSearch;
    // End of variables declaration

    }
    Is this Swing Netbeans error?
    or my code?
    Please help me, I'm newbie :(

  2. #2
    sysout is offline Member
    Join Date
    Aug 2009
    Posts
    66
    Rep Power
    0

    Default

    solved palz..
    It's netbeans error, after I've uninstalled it, no bugs again

Similar Threads

  1. Netbeans Error?
    By makpandian in forum NetBeans
    Replies: 3
    Last Post: 05-07-2009, 08:22 AM
  2. Swing/SWT in NetBeans IDE
    By paluee in forum AWT / Swing
    Replies: 1
    Last Post: 03-26-2009, 11:26 PM
  3. netbeans+swing = painting program?
    By yuriythebest in forum New To Java
    Replies: 3
    Last Post: 12-14-2008, 09:55 PM
  4. Error using Swing
    By arpitvavadia in forum AWT / Swing
    Replies: 2
    Last Post: 09-08-2008, 07:16 PM
  5. NetBeans, Swing Initialization Event ?
    By Cero.Uno in forum New To Java
    Replies: 0
    Last Post: 02-09-2008, 04:29 PM

Posting Permissions

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