Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2009
    Posts
    8
    Rep Power
    0

    Unhappy clear screen prompt using java code

    hi,
    i want implement clear screen function in menu item ...
    when click on clear screen menu then command prompt's all screen is clear . and command prompt display...

    if it possible then guide(hint)/code for solution for this problem ..

    as soon as possible...

    please i m in big trouble...."

  2. #2
    paul pasciak is offline Senior Member
    Join Date
    Jul 2008
    Posts
    125
    Rep Power
    0

    Default No java programmer understands this request.

    Nobody can help you because they do not
    know what you mean by a "screen."

    Maybe it's a panel,
    maybe it's a canvas,
    maybe it's a frame,
    maybe it's the console.

    People may be waiting for a clearer
    description of what you want to clear.
    Last edited by paul pasciak; 04-02-2009 at 11:20 PM. Reason: "Graphics g" missing everywhere

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    My guess is you are referring to a terminal window? If so, then the simplest approach is to use Runtime.exec to issue the command, since it is platform specific.

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    System.out.println() about 100 times.

  5. #5
    Join Date
    Apr 2009
    Posts
    8
    Rep Power
    0

    Default clear screen of applet

    hi,
    sorry i m not specify ..
    now...
    when ever click on clear button then it clear the applet screen and reload and the command prompt session continue..

    actually i m using command prompt in my applet ,,, i don't want to clear command prompt....but when clear button click then clear screen but prompt is running../
    if u help then please give me idea for implementation or how i start..

  6. #6
    paul pasciak is offline Senior Member
    Join Date
    Jul 2008
    Posts
    125
    Rep Power
    0

    Default This advice pertains only to the applet.

    I will assume you already know how to make
    your code respond to an actionEvent.

    A tricky part of applets to to know that
    they are ALWAYS clearing and repainting
    themselves.

    Your task is to interfer with this cycle somehow.
    The cycle begins when the applet is nudged into
    repainting itself.

    You don't see this in your code, but the applet
    jumps to code called "update(Graphics g)".
    This code clears the applet, then jumps to
    your "paint(Graphics g){ .. }" method.

    My advice is that you play with the "update(Graphics g)"
    method by overriding it. Try something like

    Java Code:
    public void update(Graphics g){
      setBackground(Color.orange);
      paint(g);
    }
    to get the feel of how it fits into the "paint(Graphics g)"
    process.


    Later, have your clearButton's actionListener set a

    Java Code:
    boolean eraseGraphics;
    flag and experiment by testing this flag within
    "the update(Graphics g)" method.
    Last edited by paul pasciak; 04-02-2009 at 11:19 PM.

  7. #7
    Join Date
    Apr 2009
    Posts
    8
    Rep Power
    0

    Default clear screen applet

    hi,
    thanks for giving this help..

    but if u give one example code then easily understand..

    menu is implemented in applet..

    help me i m in trouble and i m in beginner in applet ......

  8. #8
    paul pasciak is offline Senior Member
    Join Date
    Jul 2008
    Posts
    125
    Rep Power
    0

    Default There are too many details to cover. Here is the first one:

    You might have several BIG issues that need
    to be covered with your applet. I'm covering
    one detail that you can easily experiment on
    in your applet (by the way, I updated #6 in
    this thread because I left out some important
    parts).

    The "update(Graphics g)" method is responsible
    for clearing the applet's display. OVERRIDE IT
    with this code:

    Java Code:
    public void update(Graphics g){
      setBackground(Color.orange);
      paint(g);
    }
    Then override it with this code:
    Java Code:
    public void update(Graphics g){
      setBackground(Color.black);
      paint(g);
    }
    Then override it with this code:
    Java Code:
    public void update(Graphics g){
      setBackground(Color.cyan);
      paint(g);
    }
    Then override it with this code:
    Java Code:
    public void update(Graphics g){
      setBackground(Color.red);
      paint(g);
    }
    This underscores a pivitol concept in
    painting graphics in AWT. If you can't
    do the above and gain anything from
    it, this tells me something about you.

  9. #9
    Join Date
    Apr 2009
    Posts
    8
    Rep Power
    0

    Default clear screen applet

    hi,
    thanks for this help..
    i am join lots up forum ,but you give satisfy answer ..
    if u give me whole code then i easily implemented ...
    i m beginner.. i have no time to learn full applet stuff .....because.. i have dead line in my work...

    i want to combine this code with my applet class..
    which i m implement in my application which contain SSH/TELNET applet JTA26.jar file which provide facility for ssh connection to server.. with command prompt

    so that's why i need complaint code ..because here very complexity to combine this code ....

    i want to implement clear screen portion into my application menu...
    so.. if you give complete code then it is good for me.

  10. #10
    paul pasciak is offline Senior Member
    Join Date
    Jul 2008
    Posts
    125
    Rep Power
    0

    Default Show the basic part of your code.

    I'm confused.
    Your request sounds like this:

    "I am a giant, as big as a mountain.
    I need a bandage. I will not tell you
    where I need the bandage, but I
    insist that you find my wound and
    mend it."

    First I thought you referred to a simple
    applet, now it sounds like you are
    referring to complex, proprietary code.

Similar Threads

  1. Need For Clear Screen
    By adithya4u4ever in forum New To Java
    Replies: 8
    Last Post: 03-08-2009, 08:41 AM
  2. Blank Screen while navigating from one screen to another
    By mohana.krishna in forum Java Servlet
    Replies: 0
    Last Post: 03-03-2009, 05:03 PM
  3. Clear Screen in Console based programs
    By kirly in forum New To Java
    Replies: 5
    Last Post: 02-05-2009, 05:59 AM
  4. Connecting a splash screen to a code : HELP !!!
    By mobeenkhan in forum NetBeans
    Replies: 0
    Last Post: 08-02-2007, 05:15 PM
  5. Clear screen in java
    By lenny in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 09:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •