Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SwingUI extends JFrame implements IUpdater{
- @Override
- public void askPermission(String str) {
- int i = JOptionPane.showConfirmDialog(this, str);
- // (?)Send i back
- }
- }
- class Connection implements Runnable{
- IUpdater updater;
- Connection(IUpdater u){updater = u;}
- @Override
- public void run() {
- String command = "download_file"; //=getCommand(); from a socket
- if(command.equals("download_file")){
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- updater.askPermition(command);
- }
- });
- // (?)wait until user answers
- // int answ = getAnswer();
- // if answ == OK
- System.out.println("Sending_File");
- // if answ == DENY
- //System.out.println("Denied");
- }
- }
- }
- interface IUpdater{
- void askPermission(String str);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement