PropertiesEditor.java
Dosyayı İndir
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.io.IOException;
public class PropertiesEditor extends JFrame{
public PropertiesEditor() throws FileNotFoundException, IOException{
setBounds(10,10,300,300);
String path="/Users/zaferteker/Private/Books/Documents/test.properties";
PropertiesTableModel model=new PropertiesTableModel(path,
PropertiesTableModel.BOTH);
JTable table=new JTable(model);
JButton button=new JButton("Kaydet");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
model.store();
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
getContentPane().setLayout(new BorderLayout());
getContentPane().add(new JScrollPane(button), BorderLayout.NORTH);
getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
}
public static void main(String[] args) throws FileNotFoundException, IOException {
PropertiesEditor p=new PropertiesEditor();
p.setVisible(true);
}
}
Dosyayı İndir