コード例 #1
0
  private void startSlave() {
    try {
      hostConn.connect(
          new InetSocketAddress(ConnectionSettings.HOST, ConnectionSettings.HOST_PORT));
      L.dbg("Slave connected to " + ConnectionSettings.HOST + " : " + ConnectionSettings.HOST_PORT);
    } catch (IOException e) {
      e.printStackTrace();
    }

    BufferedReader serverReader = null;
    try {
      serverReader = new BufferedReader(new InputStreamReader(hostConn.getInputStream()));
    } catch (IOException e1) {
      e1.printStackTrace();
    }

    String incoming = "first null message";

    try {
      while ((incoming = serverReader.readLine()) != null) {
        L.dbg("Got from server: " + incoming);
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
ファイル: LGuiStream.java プロジェクト: CyanoJayWorks/L
  @Override
  public void streamOpen() {
    if (isStreamOpen) {
      L.og("INTERNAL L ERROR: trying to re-open alreadyopen stream ");
      return;
    }

    logFrame = new JFrame("Logging Window");
    logArea = new JTextArea();
    logArea.setEditable(false);

    logFrame.setSize(width, height);
    logFrame.setResizable(false);
    logFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    JScrollPane logAreaScroller = new JScrollPane(logArea);
    logAreaScroller.setSize(logFrame.getSize());
    logAreaScroller.setPreferredSize(
        new Dimension((logFrame.getWidth() * 3) / 4, (logFrame.getHeight() * 3) / 4));

    logPanel.add(logAreaScroller);
    logFrame.getContentPane().add(logPanel);

    logFrame.setVisible(true);

    isStreamOpen = true;
  }
コード例 #3
0
ファイル: LGuiStream.java プロジェクト: CyanoJayWorks/L
  public LGuiStream(int width, int height) {
    if (GraphicsEnvironment.isHeadless()) {
      L.og("INTERNAL L ERROR: creating new LGuiStream on headless system ");
    }

    this.width = width;
    this.height = height;
  }