Professional Documents
Culture Documents
Shop N Drive
Shop N Drive
021-8308883
jkt.ps-rda@component.astra.co.id
021-72796764/65
021-7690509
Data Penjualan Outlet-outlet Shop & Drive Januari 2006 November 2006
(Pada file yang terpisah)
ex.printStackTrace();
}
}
public int getAttributCount(){
try{
ResultSet rs = stat.executeQuery("select count(*) from ms_att");
if(rs.next()){
attributCount = rs.getInt(1);
}else{
attributCount = 0;
}
}catch(Exception e){
e.printStackTrace();
}
return attributCount; }
public int getUnitCount(){
try{
ResultSet rs = stat.executeQuery("select count(*) from ms_unit");
if(rs.next()){
unitCount = rs.getInt(1);
}else{
unitCount = 0;
}
}catch(Exception e){
e.printStackTrace();
}
return unitCount; }
public void buatDatabase(){
try{
stat.executeUpdate("create table ms_att (codeAtt int identity(1,1) primary key,
descr nvarchar(200))");
stat.executeUpdate("create table ms_unit(codeUnit int identity(1,1) primary key,
descr nvarchar(200))");
stat.executeUpdate("create table tr_store(codeStore int identity(1,1) primary key,
codeAtt int,codeUnit int, value float, " +
"foreign key (codeAtt) references ms_att(codeAtt) on update cascade, " +
"foreign key (codeUnit) references ms_unit(codeUnit) on update cascade)");
}catch(Exception e){
e.printStackTrace();
System.exit(1);
} }
public void TambahUnitBaru(String unit_descr, double [] value){
try{
int codeUnit = 0;
stat.executeUpdate("insert into ms_unit(descr) values('"+ unit_descr +"')");
ResultSet rs = stat.executeQuery("select max(codeUnit) from ms_unit");
if(rs.next()){
codeUnit = rs.getInt(1);
int counter = 1;
for(int i=0; i<value.length; i++){
stat.executeUpdate("insert into tr_store(codeAtt, codeUnit, value)
values('"+counter+"','"+codeUnit+"',"+value[i]+")");
counter++;
}
}
}catch(Exception e){
e.printStackTrace();
System.exit(1);
} }
public void TambahAttributBaru(String att_descr, double [] value){
try{
int codeAtt = 0;
stat.executeUpdate("insert into ms_att(descr) values('"+ att_descr +"')");
ResultSet rs = stat.executeQuery("select max(codeAtt) from ms_att");
if(rs.next()){
codeAtt = rs.getInt(1);
int counter = 1;
for(int i=0; i<value.length; i++){
stat.executeUpdate("insert into tr_store(codeUnit, codeAtt, value)
values('"+counter+"','"+codeAtt+"',"+value[i]+")");
counter++;
}
}
}catch(Exception e){
e.printStackTrace();
System.exit(1);
} }
public double [][] getData(){
double [][] d = null;
try{
Statement stat =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs1 = stat.executeQuery("select codeAtt, codeUnit, value from
tr_store");
rs1.last();
int rowCount = rs1.getRow();
attributCount = getAttributCount();
unitCount = getUnitCount();
d = new double[attributCount][unitCount];
System.out.println("rowCount " + rowCount);
rs1.beforeFirst();
while(rs1.next()){
d[rs1.getInt(1)-1][rs1.getInt(2)-1] = rs1.getDouble(3);
}
}catch(Exception e){
e.printStackTrace();
System.exit(1);
}
return d; }
public String getUnitDescr(int index){
if(unitDesc == null)
setUnit();
else{
return unitDesc[index];
}
return unitDesc[index]; }
private void setUnit(){
try{
ResultSet rs = stat.executeQuery("select * from ms_unit");
rs.last();
int row = rs.getRow();
int counter = 0;
rs.beforeFirst();
unitDesc = new String[row];
while(rs.next()){
unitDesc[counter] = rs.getString(2);
counter++;
}
} catch(Exception e){
e.printStackTrace();
} }
public String getAtt(int index){
if(attDesc == null)
setAtt();
else{
return attDesc[index];
}
return attDesc[index]; }
private void setAtt(){
try{
ResultSet rs = stat.executeQuery("select * from ms_att");
rs.last();
int row = rs.getRow();
int counter = 0;
rs.beforeFirst();
attDesc = new String[row];
while(rs.next()){
attDesc[counter] = rs.getString(2);
counter++;
}
} catch(Exception e){
e.printStackTrace();
} }
private String [] unitDesc;
private String [] attDesc;
private int attributCount;
private int unitCount;
public static Connection conn;
public static Statement stat;}
* Frame.java
package skripsikojek;
import javax.swing.JOptionPane;
* @author Andhika
public class Frame extends javax.swing.JFrame implements Interf{
private Frame2 f2 ;
private Frame3 f3;
private Frame4 f4;
private GlobalVar g = new GlobalVar();
jLabel4.setText("jLabel4");
jLabel5.setText("jLabel5");
jLabel6.setText("Jumlah kluster yang diinginkan :");
jLabel7.setText(" :");
jTextField1.setText("7");
jLabel8.setText("Iterasi Maksimum :");
jLabel9.setText("Nilai error terkecil yang diharapkan :");
jTextField2.setText("1000");
jTextField3.setText("0.00001");
jButton3.setText("Keluar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
keluar(evt);
}
});
jButton4.setText("Bentuk Kluster");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hitung(evt);
}
});
jMenu1.setText("Menu");
jMenuItem1.setText("Create Db");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BuatDatabase(evt);
}
});
jMenu1.add(jMenuItem1);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
org.jdesktop.layout.GroupLayout layout = new
org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel1)
.add(jLabel2)
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 479,
Short.MAX_VALUE)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.add(121, 121, 121)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jButton2)
.add(jButton1))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(jLabel7, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel6))
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel8))
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel9)))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(jLabel5)
.add(jLabel4)
.add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
80, Short.MAX_VALUE)
.add(jTextField2)
.add(jTextField3))))
.addContainerGap())
.add(layout.createSequentialGroup()
.add(86, 86, 86)
.add(jButton3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 140,
Short.MAX_VALUE)
.add(jButton4)
.add(97, 97, 97))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(14, 14, 14)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton1)
.add(jLabel3)
.add(jLabel4))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton2)
.add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel5))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel6)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel8)
.add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel9)
.add(jTextField3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 19,
Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton3)
.add(jButton4))
.add(33, 33, 33))
);
pack();
}// </editor-fold>//GEN-END:initComponents
public void update(){
g.UnitCount = dp.getUnitCount();
g.AttributeCount = dp.getAttributCount();
this.jLabel4.setText("" + g.AttributeCount);
this.jLabel5.setText("" + g.UnitCount); }
private void BuatDatabase(java.awt.event.ActionEvent evt) {//GENFIRST:event_BuatDatabase
dp.buatDatabase();
}//GEN-LAST:event_BuatDatabase
private void hitung(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hitung
try{
g.ClusterCount = Integer.parseInt(this.jTextField1.getText());
g.MaxIterate = Integer.parseInt(this.jTextField2.getText());
g.MinError = Double.parseDouble(this.jTextField3.getText());
}catch(Exception e){
e.printStackTrace();
}
* Frame2.java
package skripsikojek;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
* @author Andhika
public class Frame2 extends javax.swing.JFrame implements Interf{
private JTextField text[];
private JLabel label[];
private Datapenjualan dp;
private GlobalVar g = new GlobalVar();
private Interf f;
public Frame2() {
initComponents();
dp = new Datapenjualan(); }
public Frame2(Interf i){
f = i;
initComponents();
dp = new Datapenjualan(); }
public void update(){
SwingUtilities.updateComponentTreeUI(this.jPanel1);
this.jPanel1.removeAll();
g.UnitCount = dp.getUnitCount();
label = new JLabel[g.UnitCount];
text = new JTextField[g.UnitCount];
for(int i=0; i < label.length; i++){
label[i]= new JLabel(dp.getUnitDescr(i));
text[i] = new JTextField();
this.jPanel1.add(this.label[i]);
this.jPanel1.add(this.text[i]);
} }
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GENBEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jSeparator2 = new javax.swing.JSeparator();
jLabel3 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel1.setText("Tambah Atribut");
jLabel2.setText("Masukan Nama Atribut");
.addContainerGap())))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(14, 14, 14)
.add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 242,
Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton1)
.add(jButton2))
.add(24, 24, 24))
);
pack(); }// </editor-fold>//GEN-END:initComponents
private void tambahatribut(java.awt.event.ActionEvent evt) {//GENFIRST:event_tambahatribut
double value [] = new double[text.length];
for(int i=0; i<text.length; i++){
try{
value[i] = Double.parseDouble(text[i].getText());
}catch(Exception e){
e.printStackTrace();
System.out.println("l " + g.UnitCount);
System.out.println("i " + i);
JOptionPane.showMessageDialog(null, "gak bisa pake nilai : " +
text[i].getText());
}
}
dp.TambahAttributBaru(this.jTextField1.getText(), value);
f.update();
this.setVisible(false);
}//GEN-LAST:event_tambahatribut
private void batal(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_batal
this.setVisible(false); }//GEN-LAST:event_batal
* @param args the command line arguments
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTextField jTextField1;
}
* Frame3.java
package skripsikojek;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
* @author Andhika
public class Frame3 extends javax.swing.JFrame implements Interf{
private GlobalVar g = new GlobalVar();
private JTextField text[];
private JLabel label[];
private Datapenjualan dp;
private Interf f;
public Frame3() {
initComponents();
dp = new Datapenjualan();
}
public Frame3(Interf i){
initComponents();
f = i;
dp = new Datapenjualan();
}
public void update(){
SwingUtilities.updateComponentTreeUI(this.jPanel1);
this.jPanel1.removeAll();
g.AttributeCount = dp.getAttributCount();
label = new JLabel[g.AttributeCount];
text = new JTextField[g.AttributeCount];
for(int i=0; i < label.length; i++){
label[i]= new JLabel(dp.getAtt(i));
text[i] = new JTextField();
this.jPanel1.add(this.label[i]);
this.jPanel1.add(this.text[i]);
} }
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField1,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 313, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
.add(layout.createSequentialGroup()
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
.add(org.jdesktop.layout.GroupLayout.TRAILING,
layout.createSequentialGroup()
.add(jSeparator2,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
.add(layout.createSequentialGroup()
.add(59, 59, 59)
.add(jButton1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 136,
Short.MAX_VALUE)
.add(jButton2)
.add(74, 74, 74)))
.addContainerGap())))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel2))
.add(layout.createSequentialGroup()
.add(6, 6, 6)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.add(9, 9, 9)
.add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 268,
Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton1)
.add(jButton2))
.add(28, 28, 28))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void tambahunit(java.awt.event.ActionEvent evt) {//GENFIRST:event_tambahunit
double value [] = new double[text.length];
for(int i=0; i<text.length; i++){
try{
value[i] = Double.parseDouble(text[i].getText());
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, "gak bisa pake nilai : " +
text[i].getText());
}
}
dp.TambahUnitBaru(this.jTextField1.getText(), value);
f.update();
this.setVisible(false);
}//GEN-LAST:event_tambahunit
private void batal2(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_batal2
this.setVisible(false);
}//GEN-LAST:event_batal2
* @param args the command line arguments
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTextField jTextField1;
}
* Frame4.java
package skripsikojek;
import javax.swing.JLabel;
import javax.swing.table.AbstractTableModel;
* @author Andhika
public class Frame4 extends javax.swing.JFrame implements Interf{
private Frame5 f5;
private double A1[][];
private double rand[][];
private double A4[][];
private double p[];
private double pt1[];
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.addContainerGap()
.add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 395,
Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.add(149, 149, 149)
.add(jLabel1))
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.addContainerGap()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel3))
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 395,
Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.addContainerGap()
.add(jLabel4)))
.addContainerGap())
.add(org.jdesktop.layout.GroupLayout.TRAILING,
layout.createSequentialGroup()
.add(74, 74, 74)
.add(jButton1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 38,
Short.MAX_VALUE)
.add(jButton3)
.add(29, 29, 29)
.add(jButton2)
.add(71, 71, 71))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel1)
.add(25, 25, 25)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(jLabel3))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 213,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(52, 52, 52)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton2)
.add(jButton1)
.add(jButton3))
.addContainerGap(140, Short.MAX_VALUE))
);
pack(); }// </editor-fold>//GEN-END:initComponents
private void data(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_data
f5 = new Frame5();
f5.setVisible(true); }//GEN-LAST:event_data
private void keluar(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keluar
System.exit(1); }//GEN-LAST:event_keluar
private void ulang(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ulang
this.setVisible(false); }//GEN-LAST:event_ulang
public void update() {
c = new Cluster[this.g.ClusterCount];
for(int i=0; i<c.length;i++){
c[i] = new Cluster();
}
rand2 = new double[g.ClusterCount][g.UnitCount];
p = new double[g.MaxIterate + 2];
System.out.println("min error " + g.MinError);
p[0] = 0.0;
createMatriksData();
randomData();
do{
this.kuadratRand1();
this.rand1_kali_A1();
this.total_rand1_kuadrat();
this.sigma_A2_bagi_total_rand1_kuadrat();
this.data_penjualan_kurang_sigma2_kuadrat();
this.total_A3();
this.A3_kali_rand1kuadrat();
this.Fungsi_Objektif_iterasi_ke_n();
this.A3_pangkat_min_satu();
this.total_sigmaA3();
this.randBaru();
jScrollPane1.setViewportView(jTable1);
org.jdesktop.layout.GroupLayout jPanel1Layout = new
org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING,
jPanel1Layout.createSequentialGroup()
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 385,
Short.MAX_VALUE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 275,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
jButton1.setText("Kembali ke Hasil");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hasil(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new
org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jSeparator1,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.add(layout.createSequentialGroup()
.add(150, 150, 150)
.add(jButton1)
.addContainerGap(156, Short.MAX_VALUE))
.add(layout.createSequentialGroup()
.add(185, 185, 185)
.add(jLabel1)
.addContainerGap(208, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton1)
.addContainerGap(15, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void hasil(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hasil
this.setVisible(false);
}//GEN-LAST:event_hasil
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Frame5().setVisible(true);
}
}); }
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
private class model extends AbstractTableModel{
private double [][] A1;
public model(){
A1 = dp.getData();
}
public int getRowCount() {
return g.UnitCount;
}
public int getColumnCount() {
return g.AttributeCount + 1;
}
public Object getValueAt(int rowIndex, int columnIndex) {
if(columnIndex == 0)
return dp.getUnitDescr(rowIndex);
return "" + A1[columnIndex-1][rowIndex];
}
public String getColumnName(int column){
if(column == 0){ return "";}
else { return dp.getAtt(column-1);}
} } }