Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JButton;
- import javax.swing.JTextArea;
- import java.awt.TextArea;
- import java.util.Timer;
- import java.util.TimerTask;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- public class WTH {
- private JFrame frame;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- WTH window = new WTH();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public WTH() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.setBounds(100, 100, 588, 482);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- TextArea Result = new TextArea();
- Result.setBounds(29, 74, 515, 347);
- frame.getContentPane().add(Result);
- JButton btnNewButton = new JButton("New button");
- btnNewButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- Timer timer = new Timer();
- Process_PSP PSP = new Process_PSP();
- new Thread(()->{
- PSP.Process(50, 100000);
- }).start();
- timer.schedule(new TimerTask(){
- public void run(){
- Result.setText(Result.getText()+"\n"+"Obj:"+PSP.getBest_Obj());
- }
- }, 0, 100);
- /*Process_PSP PSP = new Process_PSP();
- PSP.Process(10, 100000);
- int x[] = PSP.getBest_Sol();
- Result.setText("Obj:"+PSP.getBest_Obj()+"\nSol(x_1, x_2, x_3, x_4):"+x[0]+""+x[1]+""+x[2]+""+x[3]);
- */
- }
- });
- btnNewButton.setBounds(29, 31, 87, 23);
- frame.getContentPane().add(btnNewButton);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement