Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Topics

Recent Status Updates

View All Updates

- - - - -

how do I print my console output into a GUI Textbox

java gui

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 AdamDewhurst


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 17 February 2017 - 09:37 AM

I'm trying to scan my IP for open ports and print the open ports into the gui ive created , I'm managed to get to the GUI to pop up everytime the program is ran but every time it still seems to still print out in the netbeans console and not my GUI , the code I have at the moment is as follows :

import java.io.; import java.net.; import javax.swing.*;

public class Scanner { private static Object jTextField1;

public static void main(String[] args) throws Exception {
   String host = "MY IP";
   InetAddress ipAddress = InetAddress.getByName(host);
   GUI2 GUI = new GUI2();

   String hostName = "MY IP";
   for (int port = 0; port <= 65535; port++){
       try {
           Socket socket = new Socket (hostName, port );
           String listen = hostName + "is listening on port" + port ;
       }catch (IOException e) {
           String ignore = hostName + "is not listening on port " + port;





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download