-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
43 lines (41 loc) · 1.28 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package piper;
import javax.swing.*;
import java.awt.event.*;
public class Main extends JFrame implements ActionListener
{ private JButton host, join;
Main()
{ JPanel buttonPanel = new JPanel();
host = new JButton("HOST");
host.addActionListener(this);
join = new JButton("JOIN");
join.addActionListener(this);
buttonPanel.add(host);
buttonPanel.add(join);
this.add(buttonPanel);
}
public void actionPerformed(ActionEvent ae)
{ JButton buttonClicked = (JButton)ae.getSource();
boolean host_ = false;
if(buttonClicked.equals(host))
host_ = true;
this.setVisible(false);
JFrame frame = new ProcessFrame(host_);
frame.setTitle("File Transferer");
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(250,70);
frame.setVisible(true);
}
public static void main(String[] args)
{ try
{ Thread.sleep(2000);
}
catch(Exception e){}
JFrame frame = new Main();
frame.setTitle("File Transferer");
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(250,70);
frame.setVisible(true);
}
}