Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1.  
  2. public class Display extends JPanel{
  3. static JFrame frame = null;
  4. static String location;
  5.  
  6. // Create a constructor method
  7. public Display(){
  8. super();
  9. }
  10.  
  11. public void paintComponent(Graphics g){
  12.  
  13. BufferedImage ap = null;
  14. BufferedImage laptop = null;
  15.  
  16.  
  17. try {
  18. ap = ImageIO.read(new File("/home/arosen/ap.png"));
  19. laptop = ImageIO.read(new File("/home/arosen/laptop.jpg"));
  20. } catch (IOException e) {
  21. // TODO Auto-generated catch block
  22. e.printStackTrace();
  23. }
  24.  
  25. ImageObserver observer = null;
  26. g.drawImage(ap, 10, 10, 55, 60, observer);
  27.  
  28. g.drawImage(laptop, 350, 300, 90, 80, observer);
  29. System.out.println("aa"+ location);
  30.  
  31. if(location == "60100")
  32. g.drawLine(30,30,390,300);
  33.  
  34.  
  35. }
  36.  
  37. public static void main(String arg[]){
  38.  
  39.  
  40. BufferedReader in = null;
  41.  
  42. frame = new JFrame("Wireless connection");
  43. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  44. frame.setSize(850,450);
  45.  
  46. Display panel = new Display();
  47. frame.setContentPane(panel);
  48. frame.setVisible(true);
  49. while (true) {
  50. try {
  51. Thread.sleep(2000);
  52. in = new BufferedReader(new FileReader("/tmp/nodes"));
  53. while ((location = in.readLine()) != null) {
  54. System.out.println(location);
  55. }
  56. in.close();
  57.  
  58.  
  59. } catch (InterruptedException e) {
  60. e.printStackTrace();
  61. } catch (IOException e) {
  62. }
  63.  
  64. frame.repaint();
  65. }
  66.  
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement