Output
Output
*;
import java.awt.*;
import javax.swing.border.EmptyBorder;
Output :
Exercise No1 :
import javax.swing.*;
import java.awt.*;
Output :
Exercise No 2 :
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
button.addActionListener(new ActionListener() {
private int progress = 0;
@Override
public void actionPerformed(ActionEvent e) {
if (progress < 100) {
progress += 10;
progressBar.setValue(progress);
}
}
});
frame.add(progressBar, BorderLayout.CENTER);
frame.add(button, BorderLayout.SOUTH);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
Output :