14 Ocak 2016 Perşembe
11 Aralık 2015 Cuma
31 Ekim 2015 Cumartesi
Javada FileChooser kulanımı:
public static File dosyayiSec(String path) {
JFileChooser chooser = new JFileChooser(path);
chooser.setDialogTitle("Browse Directory");
chooser.setSize(new java.awt.Dimension(45, 37)); // Generated
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
File file = null;
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile();
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : " + chooser.getSelectedFile());
} else {
System.out.println("Seçim işlemi ");
}
return file;
}
public static File dosyayiSec(String path) {
JFileChooser chooser = new JFileChooser(path);
chooser.setDialogTitle("Browse Directory");
chooser.setSize(new java.awt.Dimension(45, 37)); // Generated
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
File file = null;
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile();
System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : " + chooser.getSelectedFile());
} else {
System.out.println("Seçim işlemi ");
}
return file;
}
11 Ekim 2015 Pazar
10 Ekim 2015 Cumartesi
9 Ekim 2015 Cuma
Thread çok kanallı programlama
class Gorev extends Thread {
int hiz=10;
synchronized void HizDicrement(){
hiz+=10;
}
synchronized void HizIncrement(){
hiz-=5;
}
synchronized public int GetValue(){
return hiz;
}
@Override
synchronized public void run(){
Gorev g=new Gorev();
try {
for (int i = 0; i < 10; i++) {
sleep(1000);
System.out.println(" islem:"+g.getName()+"="+ g.GetValue());
g.HizDicrement();
System.out.println(" islem:"+g.getName()+"="+ g.GetValue());
g.HizIncrement();
}
} catch (Exception e) {
System .out.println(e);
}
}
}
int hiz=10;
synchronized void HizDicrement(){
hiz+=10;
}
synchronized void HizIncrement(){
hiz-=5;
}
synchronized public int GetValue(){
return hiz;
}
@Override
synchronized public void run(){
Gorev g=new Gorev();
try {
for (int i = 0; i < 10; i++) {
sleep(1000);
System.out.println(" islem:"+g.getName()+"="+ g.GetValue());
g.HizDicrement();
System.out.println(" islem:"+g.getName()+"="+ g.GetValue());
g.HizIncrement();
}
} catch (Exception e) {
System .out.println(e);
}
}
}
Kaydol:
Kayıtlar (Atom)