import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

import java.util.ResourceBundle;
import java.util.MissingResourceException;

// Resourcendatei muss im Class-Verzeichnis stehen

public class res1 extends JFrame {
  public static ResourceBundle  resourcen;
  JTextArea _edit;


  //Frame konstruieren
  public res1() {
     setSize(800, 600);
     setTitle("Resource1");
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
     setGUI();
  }

  void setGUI() {
     JButton BnAction;

    this.getContentPane().setLayout ( new BorderLayout() );

    _edit = new JTextArea("");
    _edit.setFont( new Font("Arial", Font.BOLD,24));
    BnAction = new JButton( "Ok" );
    BnAction.setFont( new Font("Arial", Font.BOLD,32));

    JScrollPane scrollpane = new JScrollPane(_edit);
    this.getContentPane().add(scrollpane, BorderLayout.CENTER);
    JPanel panel = new JPanel();
    panel.setLayout( new FlowLayout() );
    panel.add(BnAction);
    this.getContentPane().add(panel, BorderLayout.SOUTH);


    BnAction.addActionListener(new java.awt.event.ActionListener() {
       public void actionPerformed(ActionEvent e) {
        BnAction_Click();
       }
    });

    getResource();

  } // setGUI


  private void getResource() {
    try {
      resourcen = ResourceBundle.getBundle("res2");  // res2.properties
    }
    catch (MissingResourceException e) {
      System.out.println("Resourcendatei res2.properties nicht gefunden");
    //  System.exit(1);
    }
  }

  private void BnAction_Click() {
    String s1 = resourcen.getString("FM_Test1");
    String s2 = resourcen.getString("FM_Test2");
    String s3 = resourcen.getString("FMZuGross");
    _edit.setText("Ausgabe aus der Ini-Datei: "+"\n"+s1+"\n"+s2+"\n"+s3);
  }



  public static void main(String[] args) {
    res1 frame = new res1();
    frame.setVisible(true);
  }


}


