Пример #1
0
  public ShowComp() throws InterruptedException, IOException {
    super("CONNECTED COMPUTERS");
    int x = 0, d = 20;
    mb = new JMenuBar();
    File = new JMenu("File");
    mb.add(File);
    exit = new JMenuItem("Exit");
    exit.addActionListener(this);
    File.add(exit);
    ta = new JTextArea();
    ta.setBounds(20, 30, 315, 470);
    ta.setEditable(false);
    add(ta);

    setJMenuBar(mb);

    sel = new JLabel("The connected computers are..");
    sel.setBounds(15, 5, 300, 30);
    add(sel);
    b1 = new JButton("<< BACK");
    b1.setBounds(140, 510, 100, 30);
    b1.setToolTipText("Back to main page");
    b1.addActionListener(this);
    add(b1);
    setLayout(null);
    while (x < 360) {
      x = x + d;
      setBounds(675, 50, x, 600);
      this.show();
    }
    // setVisible(true);
    String s = "192.168.0.", temp = null;
    Printer printer = new Printer();
    printer.start();
    Connector connector = new Connector(printer);
    connector.start();

    LinkedList targets = new LinkedList();
    for (int i = 1; i <= 255; i++) {
      temp = s + Integer.toString(i);
      Target t = new Target(temp);
      targets.add(t);
      connector.add(t);
    }
    Thread.sleep(2000);
    connector.shutdown();
    connector.join();

    for (Iterator i = targets.iterator(); i.hasNext(); ) {
      Target t = (Target) i.next();
      if (!t.shown) t.show();
    }

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  }
Пример #2
0
    public HelpFrame(JFrame f) {
      super("Help menu");
      setSize(320, 240);
      setLocationRelativeTo(f);
      setResizable(false);

      JTextArea message = new JTextArea();
      message.setEditable(false);
      message.setText(
          "Default keybindings:\n     -Cmd+e to toggle terminal\n     -Cmd+k to run\n     -Cmd+/ to show help\n     -Cmd+o for options\n\n"
              + "Special keywords: \n     -'import' can be typed anywhere \n     -'method' and then a method will compile\n\n"
              + "Other: \n     -You can also use this for normal Java editing!");

      add(message, "Center");
      setVisible(true);
    }
Пример #3
0
 void show() {
   if (connectFinish != 0) ta.setText(ta.getText() + "\n" + add);
   shown = true;
 }