java/rozsirene-atributy/src/cz/frantovo/rozsireneAtributy/Startér.java
author František Kučera <franta-hg@frantovo.cz>
Wed Dec 15 20:07:14 2010 +0100 (2010-12-15)
changeset 6 734f104f2869
parent 5 8171c6c30613
child 7 48d5fdb68798
permissions -rw-r--r--
První GUI.
     1 package cz.frantovo.rozsireneAtributy;
     2 
     3 import cz.frantovo.rozsireneAtributy.gui.Panel;
     4 import java.awt.BorderLayout;
     5 import java.io.File;
     6 import java.io.IOException;
     7 import java.util.logging.Level;
     8 import java.util.logging.Logger;
     9 import javax.swing.JFrame;
    10 
    11 /**
    12  * Spouštěč programu
    13  *
    14  * http://freedesktop.org/wiki/CommonExtendedAttributes
    15  * http://download.oracle.com/javase/tutorial/essential/io/fileAttr.html#user
    16  * http://today.java.net/pub/a/today/2008/07/03/jsr-203-new-file-apis.html#so-what-is-a-path-really
    17  *
    18  * $ setfattr -n "user.fiki.pozdrav" -v 'Dobrý den!' pokus.txt
    19  * (v javě pak pracujeme s klíči bez předpony „user.“)
    20  *
    21  * @author fiki
    22  */
    23 public class Startér {
    24 
    25 	private static final Logger log = Logger.getLogger(Startér.class.getSimpleName());
    26 
    27 	public static void main(String[] args) throws IOException {
    28 
    29 		if (args.length == 1) {
    30 			File soubor = new File(args[0]);
    31 
    32 			log.log(Level.INFO, "Pracuji se souborem: {0}", soubor);
    33 
    34 			Model model = new Model(soubor);
    35 
    36 			JFrame f = new JFrame();
    37 			Panel p = new Panel(model);
    38 
    39 			f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    40 			f.setTitle("Rozšířené stributy souboru: " + soubor);
    41 			f.setLayout(new BorderLayout());
    42 			f.add(p, BorderLayout.CENTER);
    43 
    44 			f.setSize(640, 240);
    45 			f.setLocationRelativeTo(null);
    46 			f.setVisible(true);
    47 		} else {
    48 			log.log(Level.SEVERE, "Chyba: Očekávám právě jeden parametr – název souboru.");
    49 			System.exit(1);
    50 		}
    51 	}
    52 }