Impulse zum Angelusgebet

Hier steht ein netter Text

  • Hier soll einen Bibliothek von seinen Schriften in deutscher Sprache entstehen

package guitest1;

import java.awt.EventQueue;

import javax.swing.JFrame;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;

public class Counter {

private JFrame frame;
private JTextField txtEinText;
private JTextField txtHierKommtDie;
private static int counter;

/**
 * Launch the application.
 */
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                Counter window = new Counter();
                window.frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

/**
 * Create the application.
 */
public Counter() {
    initialize();
}

/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[]{434, 0};
    gridBagLayout.rowHeights = new int[]{26, 26, 26, 0, 0};
    gridBagLayout.columnWeights = new double[]{0.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    frame.getContentPane().setLayout(gridBagLayout);

    txtEinText = new JTextField();
    txtEinText.setText("ein Text");
    GridBagConstraints gbc_txtEinText = new GridBagConstraints();
    gbc_txtEinText.fill = GridBagConstraints.VERTICAL;
    gbc_txtEinText.insets = new Insets(0, 0, 5, 0);
    gbc_txtEinText.gridx = 0;
    gbc_txtEinText.gridy = 0;
    frame.getContentPane().add(txtEinText, gbc_txtEinText);
    txtEinText.setColumns(10);

    txtHierKommtDie = new JTextField();
    txtHierKommtDie.setText("hier kommt die Zahl...");
    GridBagConstraints gbc_txtHierKommtDie = new GridBagConstraints();
    gbc_txtHierKommtDie.anchor = GridBagConstraints.NORTHEAST;
    gbc_txtHierKommtDie.insets = new Insets(0, 0, 5, 0);
    gbc_txtHierKommtDie.gridx = 0;
    gbc_txtHierKommtDie.gridy = 1;
    frame.getContentPane().add(txtHierKommtDie, gbc_txtHierKommtDie);
    txtHierKommtDie.setColumns(10);

    JButton btnNewButton = new JButton("nächste Nummer");
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            txtHierKommtDie.setText(""+ ++counter);
        }
    });
    GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
    gbc_btnNewButton.anchor = GridBagConstraints.NORTHWEST;
    gbc_btnNewButton.gridx = 0;
    gbc_btnNewButton.gridy = 3;
    frame.getContentPane().add(btnNewButton, gbc_btnNewButton);
}

}