신한은행 레이어팝업 


 



 

    
package test;
import java.awt.*;

public class Memo extends JFrame implements ActionListener {
    Menu file;
    MenuBar bar;
    MenuItem fileSave, fileOpen, fileExit;
    TextArea ta;
    FileDialog fd;
    FileWriter fw;
    String text;

    public Memo() {
        super("Menu example");

        file = new Menu("파일");

        fileSave = new MenuItem("저장하기");
        file.add(fileSave);
        fileOpen = new MenuItem("불러오기");
        file.add(fileOpen);
        fileExit = new MenuItem("종료");
        file.add(fileExit);

        fileSave.addActionListener(this);
        fileOpen.addActionListener(this);
        fileExit.addActionListener(this);

        bar = new MenuBar();
        setMenuBar(bar);
        bar.add(file);

        ta = new TextArea();
        add(ta);

        getContentPane();
        setSize(640, 480);
        setLocation(500, 300);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand() == "저장하기") {
            System.out.println("저장하기");
            fd = new FileDialog(this, "저장하기");
            fd.setMode(FileDialog.SAVE);
            fd.setVisible(true);
            text = ta.getText();
            try {
                char intxt[] = new char[text.length()];
                text.getChars(0, text.length(), intxt, 0);
                fw = new FileWriter(fd.getDirectory() + fd.getFile());
                BufferedWriter bw = new BufferedWriter(fw);
                bw.write(intxt);
                bw.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        } else if (e.getActionCommand() == "불러오기") {
            System.out.println("불러오기");
            fd = new FileDialog(this, "불러오기");
            fd.setMode(FileDialog.LOAD);
            fd.setVisible(true);
            try {
                FileReader fr = new FileReader(fd.getDirectory() + fd.getFile());
                BufferedReader br = new BufferedReader(fr);

                ta.setText("");
                for (String str; (str = br.readLine()) != null;) {
                    ta.append(str + "\n");
                }
                br.close();

            } catch (FileNotFoundException e1) {
                e1.printStackTrace();
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        } else if (e.getActionCommand() == "종료") {
            System.out.println("종료");
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        Memo memo = new Memo();
        memo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}



    
package test;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

public class RSS_reader {
    private static String url ="http://blog.rss.naver.com/dark861007.xml";

    @SuppressWarnings("unchecked")
    public static void main(String[] args) throws Exception {
        
        URL feedUrl = new URL(url);
        SyndFeedInput input = new SyndFeedInput();
        SyndFeed syndFeed = input.build(new XmlReader(feedUrl));
        
        /*RSS*/
        System.out.println("### getFeedType [" + syndFeed.getFeedType() +"]");
        System.out.println("### getLanguage [" + syndFeed.getLanguage() +"]");
        System.out.println("### getTitle [" + syndFeed.getTitle() +"]");
        System.out.println("### getPublishedDate [" + syndFeed.getPublishedDate() +"]");

        List entries = syndFeed.getEntries();        
        SyndEntry entry = null;
        
        /*발행정보*/
        for(int i=0, j=entries.size(); i0){
             for(int ii=0,jj=entry.getCategories().size(); ii","").trim();
    } else {
    return "";
    }
    }
}

+ Recent posts