Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.EventQueue;
- import javax.swing.JOptionPane;
- import javax.swing.JFrame;
- import javax.swing.JButton;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import java.awt.Button;
- import javax.swing.JProgressBar;
- public class main {
- private JFrame frame;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- main window = new main();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public main() {
- 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);
- frame.getContentPane().setLayout(null);
- JButton allButton = new JButton("Klick Mich!");
- allButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- progress1.setValue(50);
- main.infoBox("Hallo Welt!", "Hallo Welt!");
- }
- });
- allButton.setBounds(10, 11, 418, 111);
- frame.getContentPane().add(allButton);
- Button button = new Button("Beenden!");
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- System.exit(0);
- }
- });
- button.setBounds(10, 153, 418, 96);
- frame.getContentPane().add(button);
- JProgressBar progress1 = new JProgressBar();
- progress1.setStringPainted(true);
- progress1.setBounds(20, 124, 408, 23);
- frame.getContentPane().add(progress1);
- }
- public static void infoBox(String infoMessage, String titleBar)
- {
- JOptionPane.showMessageDialog(null, infoMessage, titleBar, JOptionPane.INFORMATION_MESSAGE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement