Membuat Default File Name Di JFileChooser
JFileChooserExample.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 | /** * @(#)JFileChooserExample.java * * * @author * @version 1.00 2010/12/15 */ import java.io.File; import javax.swing.JFileChooser; import javax.swing.SwingUtilities; import javax.swing.UIManager; public class JFileChooserExample { public static void main (String[] args) { JFileChooser choose = new JFileChooser(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(choose); } catch(Exception e) { e.printStackTrace(); } choose.setSelectedFile(new File("Nama File.ext")); //Disini default file name-nya dibuat. int pilihan = choose.showSaveDialog(null); } } |
Categories: Praktikum Sistem Operasi