I want to display an image as welll as some text on my JFrame in a way that both get displayed simultaneously part by part. I have implemented it but not able to perform it the right way.Is there anyone who could help me in solving this problem such that after certain portion of image some text shoulg get displayed and then image then text till my requirement but in a single JFrame. Thnx
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Show1 extends JFrame implements Runnable
{
ImageIcon i1;
JLabel j1;
Thread t;
JTextField jt;
boolean value=true;
Show1()
{
setSize(1100,800);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
getContentPane().setBackground(Color.black);
setLayout(null);
i1=new ImageIcon("Sunset.jpg");
j1=new JLabel("",i1,JLabel.CENTER);
jt=new JTextField(50);
jt.setBounds(250,750,100,50);
t=new Thread(this,"Main");
/* try
{
SwingUtilities.invokeLater(
new Runnable()
{
public void run()
{
makeGUI();
makeGSI();
}
});
}
catch(Exception exc)
{
System.out.println("can't create because of"+exc);
}
}
private void makeGUI()
{*/
while(!value)
{
new Thread(this,"Image").start;
public void run()
{
int i,j;
try
{
for(i=-50;i<=500;i+=50)
{
j1.setBounds(200,100,700,i);
add(j1);
Thread.sleep(1000);
}
}
catch(InterruptedException e)
{
System.out.println(e);
}
}
}
public void makeGSI()
{
t1=new Thread(this,"Message");
t1.setPriority(4);
t1.start();
}
public void run()
{
try
{
String msg[]={"Customer"," Care"," Services"};
int x=msg.length;
for(int i=0;i<=x-1;i++)
{
jt.setText(msg[i]);
Thread.sleep(1000);
}
}
catch(InterruptedException e)
{
System.out.println(e);
}
}
}
class Show
{
public static void main(String args[])
{
Show1 sh=new Show1();
}}