Java Açık Artırma Sistemi
HAYVAN PAZARI
Bu projede canlı hayvan pazarı simülasyonu yapmanız istenmektedir. Yapılacak yazılımda iki tür kullanıcı bulunacaktır; hayvan satıcıları ve müşteriler. Sistem açıldığında kullanıcı adı ve şifresi ile giriş yapması istenecek sisteme kayıtlı değilse sistem kaydı için bilgileri girmesi istenecektir. Kullanıcıdan istenen bilgiler şöyledir: adı, soyadı, kullanıcı adı, şifre, kullanıcı tipi (satıcı veya müşteri) . Kullanıcı sisteme üye olurken aynı kullanıcı adına sahip başka müşterilerin olup olmadığı kontrol edilmelidir. Kullanıcı sisteme girdiğinde;
# Eğer Satıcı ise aşağıdaki eylemleri gerçekleştirebilmelidir:
o Bilgileri Güncelleme
o Sistemden çıkma (silme)
o Sisteme yeni bir hayvan yükleme
o Teklifleri görebilme, onaylama veya reddetme
o Hayvanlarının listesini görme
#Eğer Müşteri ise aşağıdaki eylemleri gerçekleştirebilmelidir:
o Bilgileri Güncelleme
o Sistemden çıkma (silme)
o Hayvan arama: Arama kriterleri şu şekilde olmalıdır:
Fiyat aralıklarında arama
Türe göre arama (Büyükbaş, küçükbaş vb.)
Cinsine göre arama (İnek, koyun, keçi vb.)
Yaşına göre arama (2 yaşından büyük olanlar gibi)
o Teklifte bulunma
o Tekliflerim menüsü
Tekliflerini görüntüleme
Cevapları görüntüleme
Tekrar teklif verebilme (Satılmış olan hayvanlara teklif vermemelidir.)
Satın alma (eğer satıcı teklifi onaylamışsa)
Sisteme yeni bir hayvan yüklenirken hayvana ait olan şu özellikler eklenmelidir:
Hayvan ID (1,2,100 vb. bir tekil sayı, yani her hayvan farklı ID ye sahip olmalı)
Türü (Büyükbaş (1) veya küçükbaş (2))
Cinsi (Büyükbaşlar için inek (1), dana (2), tosun (3), camış (4); küçükbaşlar için koyun (1), koç (2) ve keçi (3))
Yaşı
Geldiği yöre (Kars, Muğla vb.)
Fiyatı
Durumu (Teklif var (1), teklif yok (2), satıldı (3))
Tekifi veren kullanıcıAdı
Teklif miktarı
Programdaki bilgiler iki farklı dosyadan alınacak ve program sonlandığında tekrar bu iki dosyaya kaydedilecektir. Program çalışma esnasında dosyalara kayıt yapmaya gerek yoktur (örn. Yeni kullanıcı veya hayvan eklendiğinde). Bu dosyalardan birisi kullanıcı bilgilerini tutan binary dosya (“kullanıcılar.dat”) diğeri ise hayvan bilgilerini tutan bir karakter dosyası (“hayvanlar.txt”) olacaktır. Ayrıca “hayvanlar.txt” dosyasında hangi kullanıcı tarafından eklendiği bilgisi de olmalıdır. Örnek bir “hayvanlar.txt” aşağıdaki gibi olabilir:
Bu dosyaya göre örneğin 1 nolu hayvanı satici23 kullanıcı adında birisi eklemiştir. Türü büyükbaş (1), cinsi dana (2), yaşı 3, yöresi Kars, Fiyatı 2500 tl dir. Durumu teklif var (1) konumunda olup yapılan teklif kullanici21 den gelmiş ve 2350 tl dir.
Kullanıcıları ve hayvanları programda Vector veri yapısı kullanarak tasarlayabilirsiniz.
Frame1.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
package hayvanpazari; import java.awt.*; import java.io.*; import java.util.Arrays; import javax.swing.JOptionPane; /** * * @author asus */ public class Frame1 extends javax.swing.JFrame { //Genel Değişkenler public static int userID; public static int kLimit; //Hayvanlar.txt dosyası için değişkenler public String gecici; public String gecici2; public static int[ ] hID=new int[100]; public static String[ ] hUser=new String[100]; public static int[ ] hTur=new int[100]; public static int[ ] hCins=new int[100]; public static int[ ] hYas=new int[100]; public static String[ ] hYore=new String[100]; public static int[ ] hFiyat=new int[100]; public static int[ ] hDurum=new int[100]; public static String[ ] hTuser=new String[100]; public static int[ ] hTfiyat=new int[100]; public int i=0,k=0; //Kullanicilar.dat dosyası için değişkenler public static int[ ] kID=new int[100]; public static String[ ] kUser=new String[100]; public static String[ ] kSifre=new String[100]; public static String[ ] kAd=new String[100]; public static String[ ] kSoyad=new String[100]; public static int[ ] kYas=new int[100]; public static int[ ] kTip=new int[100]; private Component controllingFrame; public Frame1() { initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buton1 = new javax.swing.JButton(); textBox1 = new javax.swing.JTextField(); buton2 = new javax.swing.JButton(); text1 = new javax.swing.JLabel(); text2 = new javax.swing.JLabel(); text3 = new javax.swing.JLabel(); password1 = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Hayvan Pazarı"); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setLocationByPlatform(true); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } public void windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt); } }); buton1.setText("Kayıt Ol"); buton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buton1ActionPerformed(evt); } }); buton2.setText("Giriş"); buton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buton2ActionPerformed(evt); } }); text1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N text1.setText("Hayvan Pazarı"); text2.setText("Kullanıcı Adı"); text3.setText("Şifre"); 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, false) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(text1) .addGap(31, 31, 31)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(buton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE) .addComponent(buton2, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(text2) .addGap(43, 43, 43)) .addGroup(layout.createSequentialGroup() .addComponent(text3) .addGap(76, 76, 76))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(textBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE) .addComponent(password1)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(text1) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(textBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(text2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(text3) .addComponent(password1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(buton2) .addComponent(buton1)) .addGap(0, 13, Short.MAX_VALUE)) ); getAccessibleContext().setAccessibleDescription(""); pack(); }// </editor-fold>//GEN-END:initComponents int n; private void buton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buton2ActionPerformed //Parola Kontrolü boolean bak=userKontrol(); if(bak) { char[] input = password1.getPassword(); if (isPasswordCorrect(input)) { JOptionPane.showMessageDialog(controllingFrame, "Doğru Parola."); Frame3 araYuzM = new Frame3(); Toolkit kit = araYuzM.getToolkit(); Dimension screenSize = kit.getScreenSize(); int screenWidth = screenSize.width; int screenHeight = screenSize.height; Dimension windowSize = araYuzM.getSize(); int windowWidth = windowSize.width; int windowHeight = windowSize.height; int upperLeftX = (screenWidth - windowWidth)/2; int upperLeftY = (screenHeight - windowHeight)/2; araYuzM.setLocation(upperLeftX, upperLeftY); araYuzM.show(); setVisible(false); } else { JOptionPane.showMessageDialog(controllingFrame, "Yanlış Paralo. Tekrar Deneyiniz.", "Error Message", JOptionPane.ERROR_MESSAGE); } //Zero out the possible password, for security. Arrays.fill(input, '0'); password1.selectAll(); } else { JOptionPane.showMessageDialog(controllingFrame, "Kullanıcı İsmi Bulunamadı", "Error Message", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_buton2ActionPerformed private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated }//GEN-LAST:event_formWindowActivated private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened try { File file = new File("d://hayvanlar.txt"); FileInputStream fis = new FileInputStream(file); InputStreamReader isr = new InputStreamReader(fis, "ISO-8859-9"); /*Başlangıç Değerlerinin Dizilerin Belirliyoruz Çünkü Aşağıda += işlemiyle üzerine yazdırıcaz ilk değer şart */ gecici=""; hUser[0]=""; hTuser[0]=""; hYore[0]=""; int c; boolean kontrol=true; // dosya sonuna kadar yani -1'e kadar yazdiralim while ((c = isr.read()) != -1) { if((char)c=='\t') { kontrol=false; k++; gecici2=gecici; gecici=""; } else if((char)c=='\n') { kontrol=false; k=0; i++; gecici2=gecici; /*Dizi boyutu artığında Başlangıç Değerlerinin Dizilerin Belirliyoruz Çünkü Aşağıda += işlemiyle üzerine yazdırıcaz ilk değer şart */ gecici=""; hUser[i]=""; hYore[i]=""; hTuser[i]=""; } if(kontrol) { if(k==0) gecici+=(char)c; else if(k==1) { hID[i]=Integer.parseInt(gecici2); hUser[i]+=(char)c; } else if(k==2) { gecici+=(char)c; } else if(k==3) { hTur[i]=Integer.parseInt(gecici2); gecici+=(char)c; } else if(k==4) { hCins[i]=Integer.parseInt(gecici2); gecici+=(char)c; } else if(k==5) { hYas[i]=Integer.parseInt(gecici2); hYore[i]+=(char)c; } else if(k==6) { gecici+=(char)c; } else if(k==7) { hFiyat[i]=Integer.parseInt(gecici2); gecici+=(char)c; } else if(k==8) { hDurum[i]=Integer.parseInt(gecici2); hTuser[i]+=(char)c; } else if(k==9) { gecici+=(char)c; } } if(k==10) { hTfiyat[i]=Integer.parseInt(gecici2); } kontrol=true; } isr.close(); fis.close(); } catch (FileNotFoundException fnfe) { } catch (IOException ioe) { } for(int j=0;j<5;j++) { System.out.print(hID[j]+ " "); System.out.print(hUser[j]+ " "); System.out.print(hTur[j]+ " "); System.out.print(hCins[j]+ " "); System.out.print(hYas[j]+ " "); System.out.print(hYore[j]+ " "); System.out.print(hFiyat[j]+ " "); System.out.print(hDurum[j]+ " "); System.out.print(hTuser[j]+ " "); System.out.print(hTfiyat[j]+ " "); System.out.println("\n"); } try { File file2 = new File("d://kullanici.dat"); FileInputStream fis2 = new FileInputStream(file2); InputStreamReader isr2 = new InputStreamReader(fis2, "ISO-8859-9"); /*Başlangıç Değerlerinin Dizilerin Belirliyoruz Çünkü Aşağıda += işlemiyle üzerine yazdırıcaz ilk değer şart */ gecici=""; kUser[0]=""; kSifre[0]=""; kAd[0]=""; kSoyad[0]=""; k=0; i=0; int c; boolean kontrol=true; // dosya sonuna kadar yani -1'e kadar yazdiralim while ((c = isr2.read()) != -1) { if((char)c=='\t') { kontrol=false; k++; gecici2=gecici; gecici=""; } else if((char)c=='\n') { kontrol=false; k=0; i++; gecici2=gecici; /*Dizi boyutu artığında Başlangıç Değerlerinin Dizilerin Belirliyoruz Çünkü Aşağıda += işlemiyle üzerine yazdırıcaz ilk değer şart */ gecici=""; kUser[i]=""; kSifre[i]=""; kAd[i]=""; kSoyad[i]=""; } if(kontrol) { if(k==0) gecici+=(char)c; else if(k==1) { kID[i]=Integer.parseInt(gecici2); kUser[i]+=(char)c; } else if(k==2) { kSifre[i]+=(char)c; } else if(k==3) { kAd[i]+=(char)c; } else if(k==4) { kSoyad[i]+=(char)c; } else if(k==5) { gecici+=(char)c; } else if(k==6) { kYas[i]=Integer.parseInt(gecici2); gecici+=(char)c; } } if(k==7) { kTip[i]=Integer.parseInt(gecici2); } kontrol=true; } kLimit=i+1; isr2.close(); fis2.close(); } catch (FileNotFoundException fnfe) { } catch (IOException ioe) { } for(int j=0;j<5;j++) { System.out.print(kID[j]+ " "); System.out.print(kUser[j]+ " "); System.out.print(kSifre[j]+ " "); System.out.print(kAd[j]+ " "); System.out.print(kSoyad[j]+ " "); System.out.print(kYas[j]+ " "); System.out.print(kTip[j]+ " "); System.out.println("\n"); } }//GEN-LAST:event_formWindowOpened private void buton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buton1ActionPerformed Frame2 kayit = new Frame2(); Toolkit kit = kayit.getToolkit(); Dimension screenSize = kit.getScreenSize(); int screenWidth = screenSize.width; int screenHeight = screenSize.height; Dimension windowSize = kayit.getSize(); int windowWidth = windowSize.width; int windowHeight = windowSize.height; int upperLeftX = (screenWidth - windowWidth)/2; int upperLeftY = (screenHeight - windowHeight)/2; kayit.setLocation(upperLeftX, upperLeftY); kayit.show(); }//GEN-LAST:event_buton1ActionPerformed 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(Frame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Frame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Frame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Frame1.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 Frame1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buton1; private javax.swing.JButton buton2; private javax.swing.JPasswordField password1; private javax.swing.JLabel text1; private javax.swing.JLabel text2; private javax.swing.JLabel text3; private javax.swing.JTextField textBox1; // End of variables declaration//GEN-END:variables private boolean isPasswordCorrect(char[] input) { boolean isCorrect = true; char[] correctPassword = kSifre[userID].toCharArray(); //String'ten Char tipine çevirme if (input.length != correctPassword.length) { isCorrect = false; } else { isCorrect = Arrays.equals (input, correctPassword); } //Zero out the password. Arrays.fill(correctPassword,'0'); return isCorrect; } //Kullanıcı Kontrolü Gerçekleştiriliyor private boolean userKontrol() { String user = textBox1.getText(); boolean kontrolUser=false; for(int a=0;a<kLimit;a++) { if(user.equals(kUser[a])) { kontrolUser=true; userID=a; break; } } return kontrolUser; //Kullanıcı bulunduysa true değeri yukarı döndürülerek şifre kontrolüde yapılması sağlanır } } |
Frame2.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
package hayvanpazari; import java.awt.Toolkit; import javax.swing.JOptionPane; import javax.swing.SpinnerModel; import javax.swing.SpinnerNumberModel; /** * * @author asus */ public class Frame2 extends javax.swing.JFrame { /** * Creates new form Frame2 */ public Frame2() { initComponents(); } /** * 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">//GEN-BEGIN:initComponents private void initComponents() { rButonGrup = new javax.swing.ButtonGroup(); jPanel2 = new javax.swing.JPanel(); ySifre1 = new javax.swing.JLabel(); ySifre2 = new javax.swing.JLabel(); yYas = new javax.swing.JLabel(); yAd = new javax.swing.JLabel(); tSoyad = new javax.swing.JTextField(); ySoyad = new javax.swing.JLabel(); sYas = new javax.swing.JSpinner(); tUser = new javax.swing.JTextField(); tAd = new javax.swing.JTextField(); yUser = new javax.swing.JLabel(); rButon1 = new javax.swing.JRadioButton(); f1 = new javax.swing.JLabel(); rButon2 = new javax.swing.JRadioButton(); f2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); tSifre1 = new javax.swing.JPasswordField(); tSifre2 = new javax.swing.JPasswordField(); jRadioButton1 = new javax.swing.JRadioButton(); rButonGrup.add(rButon1); rButonGrup.add(rButon2); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Hayvan Pazarı"); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Bilgiler", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("AbakuTLSymSans", 1, 24))); // NOI18N jPanel2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); ySifre1.setText("Şifre*"); ySifre2.setText("Şifre Tekrar*"); yYas.setText("Yaş*"); yAd.setText("İsim*"); ySoyad.setText("Soyisim*"); tUser.setToolTipText(""); yUser.setText("Kullanıcı Adı*"); rButon1.setSelected(true); rButon1.setText("Müşteri"); f1.setText("f1"); rButon2.setText("Satıcı"); f2.setText("f2"); jButton1.setText("Kayıt Ol"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jRadioButton1.setText("jRadioButton1"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(yUser) .addComponent(ySifre1) .addComponent(yAd)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(tUser, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tAd, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE) .addComponent(tSifre1)) .addGap(36, 36, 36)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(70, 70, 70) .addComponent(f1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(rButon1, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ySifre2) .addComponent(yYas) .addComponent(ySoyad)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(tSoyad) .addComponent(sYas, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE) .addComponent(tSifre2))) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(f2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(rButon2, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 2, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jRadioButton1) .addGap(90, 90, 90) .addComponent(jButton1))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(yUser) .addComponent(sYas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(yYas)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ySifre2) .addComponent(tSifre1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(tSifre2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(ySifre1)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tAd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(yAd) .addComponent(ySoyad) .addComponent(tSoyad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(rButon1) .addComponent(f1) .addComponent(rButon2) .addComponent(f2)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(22, 22, 22) .addComponent(jRadioButton1))) .addContainerGap(23, Short.MAX_VALUE)) ); 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() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(18, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened f1.setText(""); f2.setText(""); f1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hayvanpazari/resources/musteriS.png"))); f2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hayvanpazari/resources/saticiS.png"))); SpinnerModel model = new SpinnerNumberModel(18, //başlangıç değeri 18, //minumun miktar 120, //maksimum miktar 1); // artış miktarı sYas.setModel(model); }//GEN-LAST:event_formWindowOpened private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed if(kontrol()) { int b=Frame1.kLimit; Frame1.kLimit++; Frame1.kUser[b]=tUser.getText(); Frame1.kAd[b]=tAd.getText(); Frame1.kSoyad[b]=tSoyad.getText(); Frame1.kSifre[b]=tSifre1.getText(); int yas = (Integer)sYas.getValue(); Frame1.kYas[b]=yas; if(rButon1.isSelected()) Frame1.kTip[b]=1; else if(rButon2.isSelected()) Frame1.kTip[b]=2; setVisible(false); } }//GEN-LAST:event_jButton1ActionPerformed private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton1ActionPerformed /** * @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(Frame2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Frame2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Frame2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Frame2.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 Frame2().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel f1; private javax.swing.JLabel f2; private javax.swing.JButton jButton1; private javax.swing.JPanel jPanel2; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton rButon1; private javax.swing.JRadioButton rButon2; private javax.swing.ButtonGroup rButonGrup; private javax.swing.JSpinner sYas; private javax.swing.JTextField tAd; private javax.swing.JPasswordField tSifre1; private javax.swing.JPasswordField tSifre2; private javax.swing.JTextField tSoyad; private javax.swing.JTextField tUser; private javax.swing.JLabel yAd; private javax.swing.JLabel ySifre1; private javax.swing.JLabel ySifre2; private javax.swing.JLabel ySoyad; private javax.swing.JLabel yUser; private javax.swing.JLabel yYas; // End of variables declaration//GEN-END:variables private boolean kontrol() { boolean sonDurum=false; //Şifre Değişkenleri String sifre1 = tSifre1.getText(); String sifre2 = tSifre2.getText(); //Kullanıcı Adı Kontrolü String user = tUser.getText(); boolean kontrolUser=false; for(int a=0;a<Frame1.kLimit;a++) { if(user.equals(Frame1.kUser[a])) { kontrolUser=true; break; } } //Yas Kontrolü int yas = (Integer)sYas.getValue(); if(tUser.getText().equals("")) { JOptionPane.showMessageDialog(null, "İsim Kısmı Boş Bırakılamaz!", "Boş Bırakıldı", JOptionPane.WARNING_MESSAGE); } else if(tAd.getText().equals("")) { JOptionPane.showMessageDialog(null, "İsim Kısmı Boş Bırakılamaz!", "Boş Bırakıldı", JOptionPane.WARNING_MESSAGE); } else if(tSoyad.getText().equals("")) { JOptionPane.showMessageDialog(null, "Soyisim Kısmı Boş Bırakılamaz!", "Boş Bırakıldı", JOptionPane.WARNING_MESSAGE); } else if(tAd.getText().equals("")) { JOptionPane.showMessageDialog(null, "İsim Kısmı Boş Bırakılamaz!", "Boş Bırakıldı", JOptionPane.WARNING_MESSAGE); } else if(tSifre1.getText().equals("")) { JOptionPane.showMessageDialog(null, "Şifre Kısmı Boş Bırakılamaz!", "Boş Bırakıldı", JOptionPane.WARNING_MESSAGE); } else if(yas>120||yas<18) JOptionPane.showMessageDialog(null, "Yaş 18-120 Arasından Başka Değer Alamaz!", "HATA", JOptionPane.WARNING_MESSAGE); else if(kontrolUser) JOptionPane.showMessageDialog(null, "Kullanıcı Adı Sistemde Mevcut!", "HATA", JOptionPane.WARNING_MESSAGE); else if(!sifre1.equals(sifre2)) JOptionPane.showMessageDialog(null, "Şifreler Eşleşmiyor!", "HATA", JOptionPane.WARNING_MESSAGE); else sonDurum=true; return sonDurum; } } |
Frame3.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
package hayvanpazari; /** * * @author asus */ public class Frame3 extends javax.swing.JFrame { /** * Creates new form Frame3 */ public Frame3() { initComponents(); } /** * 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">//GEN-BEGIN:initComponents private void initComponents() { pBilgi = new javax.swing.JPanel(); tSoyad = new javax.swing.JLabel(); tAd = new javax.swing.JLabel(); tYas = new javax.swing.JLabel(); tTip = new javax.swing.JLabel(); tUser = new javax.swing.JLabel(); yAd = new javax.swing.JLabel(); ySoyad = new javax.swing.JLabel(); yUser = new javax.swing.JLabel(); yTip = new javax.swing.JLabel(); yYas = new javax.swing.JLabel(); pProfil = new javax.swing.JPanel(); rKisi = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollPane(); jTable2 = new javax.swing.JTable(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Hayvan Pazarı"); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt); } }); pBilgi.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Bilgiler", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("AbakuTLSymSans", 0, 18))); // NOI18N tSoyad.setText("tSoyad"); tAd.setText("tAd"); tYas.setText("tYas"); tTip.setText("tTip"); tUser.setText("tUser"); yAd.setText("İsim"); ySoyad.setText("Soyisim"); yUser.setText("Kullanıcı Adı"); yTip.setText("Tipi"); yYas.setText("Yaş"); javax.swing.GroupLayout pBilgiLayout = new javax.swing.GroupLayout(pBilgi); pBilgi.setLayout(pBilgiLayout); pBilgiLayout.setHorizontalGroup( pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pBilgiLayout.createSequentialGroup() .addContainerGap() .addGroup(pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(yUser) .addComponent(yTip) .addComponent(yYas) .addComponent(ySoyad) .addComponent(yAd)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tYas) .addComponent(tTip) .addComponent(tUser) .addComponent(tAd) .addComponent(tSoyad)) .addGap(354, 354, 354)) ); pBilgiLayout.setVerticalGroup( pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pBilgiLayout.createSequentialGroup() .addGap(61, 61, 61) .addGroup(pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pBilgiLayout.createSequentialGroup() .addComponent(yAd, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ySoyad, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(yYas, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(yTip, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(yUser)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pBilgiLayout.createSequentialGroup() .addComponent(tAd) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tSoyad) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tYas) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tTip) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tUser))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); yAd.getAccessibleContext().setAccessibleName("yAd"); yTip.getAccessibleContext().setAccessibleName("yTip"); pProfil.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); rKisi.setText("Resim"); javax.swing.GroupLayout pProfilLayout = new javax.swing.GroupLayout(pProfil); pProfil.setLayout(pProfilLayout); pProfilLayout.setHorizontalGroup( pProfilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pProfilLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(rKisi)) ); pProfilLayout.setVerticalGroup( pProfilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pProfilLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(rKisi)) ); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Hayvan Listesi")); jTable2.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null} }, new String [] { "ID", "Satıcı", "Tür", "Cins", "Yöre", "Yaş", "Fiyat", "Durum", "Teklif Veren", "Teklif Fiyatı" } ) { Class[] types = new Class [] { java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class }; boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false, false, false, false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jTable2.setColumnSelectionAllowed(true); jScrollPane3.setViewportView(jTable2); jTable2.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jTable2.getColumnModel().getColumn(0).setResizable(false); jTable2.getColumnModel().getColumn(0).setPreferredWidth(30); jTable2.getColumnModel().getColumn(1).setResizable(false); jTable2.getColumnModel().getColumn(1).setPreferredWidth(100); jTable2.getColumnModel().getColumn(2).setResizable(false); jTable2.getColumnModel().getColumn(2).setPreferredWidth(100); jTable2.getColumnModel().getColumn(3).setResizable(false); jTable2.getColumnModel().getColumn(3).setPreferredWidth(100); jTable2.getColumnModel().getColumn(4).setResizable(false); jTable2.getColumnModel().getColumn(4).setPreferredWidth(100); jTable2.getColumnModel().getColumn(5).setResizable(false); jTable2.getColumnModel().getColumn(5).setPreferredWidth(35); jTable2.getColumnModel().getColumn(6).setResizable(false); jTable2.getColumnModel().getColumn(6).setPreferredWidth(50); jTable2.getColumnModel().getColumn(7).setResizable(false); jTable2.getColumnModel().getColumn(7).setPreferredWidth(75); jTable2.getColumnModel().getColumn(8).setResizable(false); jTable2.getColumnModel().getColumn(8).setPreferredWidth(100); jTable2.getColumnModel().getColumn(9).setResizable(false); jTable2.getColumnModel().getColumn(9).setPreferredWidth(100); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 567, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 107, Short.MAX_VALUE)) ); jMenu1.setText("Dosya"); jMenuBar1.add(jMenu1); jMenu2.setText("Düzen"); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); 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() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pBilgi, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pProfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(18, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(pProfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pBilgi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(97, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated tAd.setText(Frame1.kAd[Frame1.userID]); tSoyad.setText(Frame1.kSoyad[Frame1.userID]); tUser.setText(Frame1.kUser[Frame1.userID]); tYas.setText(Integer.toString(Frame1.kYas[Frame1.userID])); //Int değişken tipini String e dönüştürdük rKisi.setText(""); if(Frame1.kTip[Frame1.userID]==1) { tTip.setText("Satıcı"); rKisi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hayvanpazari/resources/satici.png"))); } if(Frame1.kTip[Frame1.userID]==2) { tTip.setText("Müşteri"); rKisi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hayvanpazari/resources/musteri.png"))); } }//GEN-LAST:event_formWindowActivated /** * @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(Frame3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Frame3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Frame3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Frame3.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 Frame3().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JTable jTable2; private javax.swing.JPanel pBilgi; private javax.swing.JPanel pProfil; private javax.swing.JLabel rKisi; private javax.swing.JLabel tAd; private javax.swing.JLabel tSoyad; private javax.swing.JLabel tTip; private javax.swing.JLabel tUser; private javax.swing.JLabel tYas; private javax.swing.JLabel yAd; private javax.swing.JLabel ySoyad; private javax.swing.JLabel yTip; private javax.swing.JLabel yUser; private javax.swing.JLabel yYas; // End of variables declaration//GEN-END:variables } |
Frame4.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
package hayvanpazari; /** * * @author asus */ public class Frame4 extends javax.swing.JFrame { /** * Creates new form Frame4 */ public Frame4() { initComponents(); } /** * 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">//GEN-BEGIN:initComponents private void initComponents() { pProfil = new javax.swing.JPanel(); rKisi = new javax.swing.JLabel(); pBilgi = new javax.swing.JPanel(); tSoyad = new javax.swing.JLabel(); tAd = new javax.swing.JLabel(); tYas = new javax.swing.JLabel(); tTip = new javax.swing.JLabel(); tUser = new javax.swing.JLabel(); yAd = new javax.swing.JLabel(); ySoyad = new javax.swing.JLabel(); yUser = new javax.swing.JLabel(); yTip = new javax.swing.JLabel(); yYas = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt); } }); pProfil.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); rKisi.setText("Resim"); javax.swing.GroupLayout pProfilLayout = new javax.swing.GroupLayout(pProfil); pProfil.setLayout(pProfilLayout); pProfilLayout.setHorizontalGroup( pProfilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rKisi) ); pProfilLayout.setVerticalGroup( pProfilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rKisi) ); pBilgi.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Bilgiler", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("AbakuTLSymSans", 0, 18))); // NOI18N tSoyad.setText("tSoyad"); tAd.setText("tAd"); tYas.setText("tYas"); tTip.setText("tTip"); tUser.setText("tUser"); yAd.setText("İsim"); ySoyad.setText("Soyisim"); yUser.setText("Kullanıcı Adı"); yTip.setText("Tipi"); yYas.setText("Yaş"); javax.swing.GroupLayout pBilgiLayout = new javax.swing.GroupLayout(pBilgi); pBilgi.setLayout(pBilgiLayout); pBilgiLayout.setHorizontalGroup( pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pBilgiLayout.createSequentialGroup() .addContainerGap() .addGroup(pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(yUser) .addComponent(yTip) .addComponent(yYas) .addComponent(ySoyad) .addComponent(yAd)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE) .addGroup(pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tAd) .addComponent(tSoyad) .addComponent(tYas) .addComponent(tTip) .addComponent(tUser)) .addGap(35, 35, 35)) ); pBilgiLayout.setVerticalGroup( pBilgiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pBilgiLayout.createSequentialGroup() .addComponent(yAd, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ySoyad, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(yYas, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(yTip, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(yUser)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pBilgiLayout.createSequentialGroup() .addComponent(tAd) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tSoyad) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tYas) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tTip) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tUser)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(401, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(pProfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(132, 132, 132)) .addComponent(pBilgi, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(20, 20, 20)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(47, 47, 47) .addComponent(pProfil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(40, 40, 40) .addComponent(pBilgi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(61, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated tAd.setText(Frame1.kAd[Frame1.userID]); tSoyad.setText(Frame1.kSoyad[Frame1.userID]); tUser.setText(Frame1.kUser[Frame1.userID]); tYas.setText(Integer.toString(Frame1.kYas[Frame1.userID])); //Int değişken tipini String e dönüştürdük rKisi.setText(""); if(Frame1.kTip[Frame1.userID]==1) { tTip.setText("Satıcı"); rKisi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hayvanpazari/resources/satici.png"))); } if(Frame1.kTip[Frame1.userID]==2) { tTip.setText("Müşteri"); rKisi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hayvanpazari/resources/musteri.png"))); } }//GEN-LAST:event_formWindowActivated /** * @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(Frame4.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Frame4.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Frame4.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Frame4.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 Frame4().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel pBilgi; private javax.swing.JPanel pProfil; private javax.swing.JLabel rKisi; private javax.swing.JLabel tAd; private javax.swing.JLabel tSoyad; private javax.swing.JLabel tTip; private javax.swing.JLabel tUser; private javax.swing.JLabel tYas; private javax.swing.JLabel yAd; private javax.swing.JLabel ySoyad; private javax.swing.JLabel yTip; private javax.swing.JLabel yUser; private javax.swing.JLabel yYas; // End of variables declaration//GEN-END:variables } |
HayvanPazari.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
package hayvanpazari; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JFrame; /** * * @author asus */ public class HayvanPazari { /** * @param args the command line arguments */ public static void main(String[] args) { Frame1 giris = new Frame1(); Toolkit kit = giris.getToolkit(); Dimension screenSize = kit.getScreenSize(); int screenWidth = screenSize.width; int screenHeight = screenSize.height; Dimension windowSize = giris.getSize(); int windowWidth = windowSize.width; int windowHeight = windowSize.height; int upperLeftX = (screenWidth - windowWidth)/2; int upperLeftY = (screenHeight - windowHeight)/2; giris.setLocation(upperLeftX, upperLeftY); giris.show(); } } |
Projeyi BURDAN İndirebilirsiniz!
Leave a reply