I have just made a banner in java applets and in status window also i have used a banner but in reverse direction to that of the other banner but the banner in status window does not make use of the whole space of the window and just runs in a small space and it's the case wherever i run that banner in that particular direction....
Here's my code

import java.awt.*;
import java.applet.*;

/*
<applet code="Hello" width=300 height=50>
</applet>
*/

public class Hello extends Applet implements Runnable
{
String msg=" Hello";
String msg1=" hello";
Thread t=null;
boolean stopFlag;
public void init()
{
setBackground(Color.cyan);
setForeground(Color.red);

}

public void start()
{
t=new Thread(this);
stopFlag=false;
t.start();
}

public void run()
{
char ch,ch1;
for(; ;)
{
try{
repaint();
Thread.sleep(100);
ch=msg.charAt(5);
msg=msg.substring(0,msg.length());
msg=ch+msg;
ch1=msg1.charAt(0);
msg1=msg1.substring(1,msg1.length());
msg1+=ch;
showStatus(msg1);
if(stopFlag)
break;
}
catch(InterruptedException e){}
}}
public void stop()
{
stopFlag=true;
t=null;
}
public void paint(Graphics g)
{
g.drawString(msg,10,30);
}}

I asked the same thing from my teacher and he said that your even your banner is not correct..The way its running its all right..
And to make it use the whole space , its not in your hand but i don't believe him , i guess..

any one????????

some one help please!!

Well you only have the trouble when you let it write in reverse.
So its nicer to read the text.

But thats also the problem you tell the string and showstatus to start at the end. So showStatus will be as big as your initial string.

So if you make msg1 longer the showStatus field will be bigger as well.
I mean the initial length of msg1 thats now hello. If you make it "Welcome at my website" it will be as big as this string.

Lets leave status bar apart!! even if i print it in reverse direction in the applet window..its just using a small space of the window while in the normal direction its using the whole space

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.