import javax.swing.*; import java.awt.*; import java.awt.event.*; public class NumberGameFrame extends JFrame implements ActionListener { private JButton okButton; private JLabel outPutLabel; private JTextField inputTextField; private JProgressBar progressBar; public NumberGameFrame () { okButton = new JButton ("O.K."); inputTextField = new JTextField(5); outPutLabel = new JLabel("Raten Sie ein Zahl zwischen 1 und 100"); progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, 10); JPanel panel = new JPanel(); panel.add(inputTextField); panel.add(okButton); Container c = getContentPane(); c.add(outPutLabel, BorderLayout.NORTH); c.add(panel, BorderLayout.CENTER); c.add(progressBar, BorderLayout.SOUTH); okButton.addActionListener(this); } public static void main (String[] args) { NumberGameFrame f = new NumberGameFrame(); f.pack(); f.setVisible(true); } public void actionPerformed (ActionEvent e) { int value = progressBar.getValue(); value++; progressBar.setValue(value); } }