• We just launched and are currently in beta. Join us as we build and grow the community.

Whois Gui Application

prispo

Cloud Security Coder
P Rep
0
0
0
Rep
0
P Vouches
0
0
0
Vouches
0
Posts
154
Likes
36
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
  1. import

    java.awt.*

    ;
  2. import

    javax.swing.*

    ;
  3. import

    java.awt.event.*

    ;
  4. import

    java.net.*

    ;
  5. import

    java.io.*

    ;

  6. public

    class

    Whois extends

    JFrame


  7. {
  8. JTextField

    t1;
  9. TextArea

    t2;
  10. JButton

    b1;
  11. FlowLayout

    f;
  12. JProgressBar

    pb;
  13. Timer

    timer;
  14. final

    static

    int

    interval =

    1000

    ;
  15. int

    cc=

    0

    ;
  16. Whois(

    String

    s)
  17. {

    super

    (

    s)

    ;
  18. t1=

    new

    JTextField

    (

    30

    )

    ;
  19. t2=

    new

    TextArea

    (

    )

    ;


  20. b1=

    new

    JButton

    (

    "Submit"

    )

    ;
  21. t2.setEditable

    (

    false

    )

    ;
  22. f=

    new

    FlowLayout

    (

    )

    ;
  23. pb =

    new

    JProgressBar

    (

    0

    ,1

    )

    ;
  24. pb.setValue

    (

    0

    )

    ;
  25. pb.setStringPainted

    (

    true

    )

    ;
  26. pb.setPreferredSize

    (

    new

    Dimension

    (

    350

    ,20

    )

    )

    ;
  27. setLayout(

    f)

    ;

  28. add(

    t1)

    ;
  29. add(

    b1)

    ;
  30. add(

    pb)

    ;
  31. add(

    t2)

    ;

  32. b1.addActionListener

    (

    new

    ButtonListener(

    )

    )

    ;
  33. setDefaultCloseOperation(

    JFrame

    .DISPOSE_ON_CLOSE

    )

    ;
  34. setResizable(

    false

    )

    ;
  35. setLocation(

    250

    ,250

    )

    ;
  36. resize(

    400

    ,255

    )

    ;
  37. show(

    )

    ;


  38. timer =

    new

    Timer

    (

    interval, new

    ActionListener

    (

    )

    {
  39. public

    void

    actionPerformed(

    ActionEvent

    ae)
  40. {
  41. try

    {

  42. int

    c;
  43. Socket

    s=

    new

    Socket

    (

    "whois.geektools.com"

    ,43

    )

    ;
  44. InputStream

    in=

    s.getInputStream

    (

    )

    ;
  45. OutputStream

    out=

    s.getOutputStream

    (

    )

    ;
  46. String

    args[

    ]

    =

    new

    String

    [

    200

    ]

    ;
  47. String

    st=

    t1.getText

    (

    )

    ;
  48. args[

    0

    ]

    =

    t1.getText

    (

    )

    ;
  49. String

    str=

    (

    args.length

    ==

    0

    ?

    st:

    args[

    0

    ]

    )

    +

    "\n

    "

    ;
  50. byte

    buf[

    ]

    =

    str.getBytes

    (

    )

    ;
  51. out.write

    (

    buf)

    ;
  52. String

    st1=

    ""

    ;
  53. while

    (

    (

    c=

    in.read

    (

    )

    )

    !=

    -

    1

    )
  54. {
  55. st1=

    st1+

    (

    char

    )

    c+

    ""

    ;
  56. cc=

    cc+

    1

    ;
  57. pb.setValue

    (

    cc)

    ;

  58. }

  59. t2.setText

    (

    st1)

    ;
  60. timer.stop

    (

    )

    ;
  61. b1.setEnabled

    (

    true

    )

    ;
  62. s.close

    (

    )

    ;
  63. }
  64. catch

    (

    UnknownHostException

    e)
  65. {
  66. }
  67. catch

    (

    IOException

    e)
  68. {
  69. }

  70. }

    }

    )

    ;

    }

  71. class

    ButtonListener implements

    ActionListener

    {
  72. public

    void

    actionPerformed(

    ActionEvent

    ae)

    {
  73. b1.setEnabled

    (

    false

    )

    ;
  74. pb.setValue

    (

    0

    )

    ;
  75. cc=

    0

    ;
  76. timer.start

    (

    )

    ;
  77. }
  78. }
  79. public

    static

    void

    main(

    String

    args[

    ]

    )
  80. {


  81. SwingUtilities

    .invokeLater

    (

    new

    Runnable

    (

    )

    {

  82. @Override
  83. public

    void

    run(

    )

    {

  84. try

    {
  85. UIManager

    .setLookAndFeel

    (

    UIManager

    .
  86. getSystemLookAndFeelClassName

    (

    )

    )

    ;
  87. }

    catch

    (

    ClassNotFoundException

    e)

    {
  88. }

    catch

    (

    InstantiationException

    e)

    {
  89. }

    catch

    (

    IllegalAccessException

    e)

    {
  90. }

    catch

    (

    UnsupportedLookAndFeelException

    e)

    {
  91. }

  92. Whois ob =

    new

    Whois(

    "Whois"

    )

    ;
  93. }
  94. }

    )

    ;

  95. }
  96. }

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.

2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,526

323,535

Top