How to put images on JPanel one at a time?

Hi, guys. I am trying to put 7 images to a panel one by one,each takes one second so that users can see the process each images being shown on the panel.
But the fact is the system freeze for 7 seconds and then display them all once. Altho the "one image has been dealt" showsin the console every one second.
Thank you
Here is the code :
for (int i=0;i<7 ;i++ )
               try
               thisTile[i] = new tiles(BBV.string,"BlackBack",100,100);
               thisTile.setBounds(x1,y1,27,49);               
               JP1.add(thisTile[i]);                              
               y1=y1+54;
               System.out.println("one image has been dealt");
               Thread.sleep(1000);
               catch (InterruptedException e)
                    System.out.println("this should not be printed");

for example, I want to print "all 7 images has been dealt" after the images have been put on the JPanel, by using swing timer it prints the "all 7 images has been dealt" during/before the images being put. Here is the code example(thisTile is a array of 7 images):
public void showImages()
t = new javax.swing.Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
               thisTile[j] = new tiles(BBV.string,"BlackBack",100,100);
               thisTile[j].setBounds(x1,y1,27,49);               
               JP1.add(thisTile[j]);
               JP1.validate();
               JP1.repaint();
               y1=y1+54;
               j++;
               if (j==7)
                    t.stop();
          //AI1 gets his tiles
          for (int i=0;i<7 ;i++ )
               t.start();               
          System.out.println("all images has been dealt");
          }

Similar Messages

  • How to put two ipods on one computer

    how to put two ipods on one computer

    Set up the second exactly the same way as you set up the first. If iTunes is already installed, it doesn't need to be installed again.
    (64746)

  • I forgot my password for my apple ID. Any ideas on how to put in a new one without knowing the old one?

    I forgot my password for my Apple ID. Anyone have a solution on how to put in a new one without knowing the old one?
    Thanks

    Welcome to Apple Support Communities
    You have to reset your password. You can do this in this site > http://iforgot.apple.com

  • How to put selected videos in one place so I can only show those on my TV and not ALL of the videos I have ever taken.

    How to put SELECTED  videos in one place, so I can ONLY show the SELECTED videos on my TV and not ALL of the videos I have ever taken

    YYou have to describe your issue in more detail. Are you using iTunes? Trying to see it in Apple TV, etc, etc.

  • How to put a string from one Frame to another Frame?

    Dear all,
    How can I put a String from one Frame to another Frame?
    When the application started, the Frame 'WindowX' will be displayed. After you press the 'openButton', a whole new Frame (inputFrame) will be shown. In this Frame )(inputFrame) you can write a String in a TextField. After pressing the okButton, this String will be sent to the first Frame 'WindowX'.
    But does anyone know how to realize the sending part?
    I've tested this code on Win98 SE and JDK1.2.2.
    Hope someone can help me. Thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    public class WindowX extends Frame implements ActionListener, WindowListener
         private Button openButton;
         private TextField resultField;
         public static void main(String [] args)
              WindowX wx = new WindowX();
              wx.setSize(300,100);
              wx.setVisible(true);
         public WindowX()
              setLayout(new FlowLayout());
              openButton=new Button("open");
              add(openButton);
              openButton.addActionListener(this);
              resultField=new TextField(10);
              add(resultField);
              resultField.addActionListener(this);
              addWindowListener(this);     
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==openButton)
                   inputFrame ip=new inputFrame();
                   ip.setSize(200,80);
                   ip.show();
         public void place(String theString) //this doesn't work
              resultField.setText(theString);
         public void windowClosing(WindowEvent event)
              System.exit(0);
         public void windowIconi......
    class inputFrame extends Frame implements ActionListener,WindowListener
         String theString = "";
         Button okButton;
         TextField inputField;
         WindowX myWX=new WindowX();   //??
         public inputFrame()
              setLayout(new FlowLayout());
              inputField=new TextField(10);
              add(inputField);
              inputField.addActionListener(this);
              okButton=new Button("OK");
              add(okButton);
              okButton.addActionListener(this);     
              addWindowListener(this);     
         public static void main(String[] args)
              Frame f = new Frame();
              f.show();
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==okButton)
                   theString=inputField.getText();
                   myWX.place(theString);   //??
                   dispose();
        public void windowClosing(WindowEvent e) {
        dispose();
        public void windowIconi......
    }

    Thanks for your reply!
    But I got an other problem:
    I can't refer to the object (wx) made from the main Frame 'WindowX', because it's initialized in 'public static void main(String [] args)'...
    Hope you can help me again... Thanks!
    import java.awt.*;
    import java.awt.event.*;
    public class WindowX extends Frame implements ActionListener, WindowListener
         private Button openButton;
         private TextField resultField;
         public static void main(String [] args)
              WindowX wx = new WindowX();   //!!
              wx.setSize(300,100);
              wx.setVisible(true);
         public WindowX()
              setLayout(new FlowLayout());
              openButton=new Button("open");
              add(openButton);
              openButton.addActionListener(this);
              resultField=new TextField(10);
              add(resultField);
              resultField.addActionListener(this);
              addWindowListener(this);     
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==openButton)
                   inputFrame ip=new inputFrame(wx);
                   ip.setSize(200,80);
                   ip.show();
         public void place(String theString)
              resultField.setText(theString);
         public void windowClosing(WindowEvent event)
              System.exit(0);
         public void windowIconi....
    class inputFrame extends Frame implements ActionListener,WindowListener
         String theString = "";
         Button okButton;
         TextField inputField;
         WindowX parent;
         public inputFrame(WindowX parent)
              setLayout(new FlowLayout());
              this.parent=parent;
              inputField=new TextField(10);
              add(inputField);
              inputField.addActionListener(this);
              okButton=new Button("OK");
              add(okButton);
              okButton.addActionListener(this);     
              addWindowListener(this);     
         public static void main(String[] args)
              Frame f = new Frame();
              f.show();
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==okButton)
                   theString=inputField.getText();
                   parent.place(theString);
                   dispose();
        public void windowClosing(WindowEvent e) {
        dispose();
        public void windowIconi..........
    }          

  • How to put the data from one excel sheet in another excel sheet

    hi ,
    I want put the data from one excel sheet in another excel sheet in seq. order Eg: I have one excel sheet in which i have 3 col. Name , Sno. , Email along with data .I want to put data from this sheet to another excel sheet in the following orders of col. Sno,Name, Email .
    While loading data in another sheet , i have to perform validation like char field should n't contain numeric values and vice versa .
    Let me know on this soon ..
    regards
    Prashant

    Well, you can issue separate queries with the ordering you need from each tab in the spreadhseet. You can open an ODBC connection from a VBA macro, select a sheet, run a query, select another sheet and run another query. As for the validation, you can do this in Oracle via stored procedures or again in VBA code.

  • How to put selected videos into one place (File)

    How to put selected videos into a File so I can only show on TV the videos in that file

    YYou have to describe your issue in more detail. Are you using iTunes? Trying to see it in Apple TV, etc, etc.

  • How to put images on buttons?

    I am currently working a project and need to mount an image onto a button, so when the image is clicked on it makes the button event work?

    set icons? , do i have to have the image in the same
    folder as where the code is saved? I have not been
    able to find any code showing how to apply images
    onto buttons on a GUI.Did you atleast read reply 2 and 4?Have you ever read the JButton API?There's no necessity that the image has to be in the same folder.You use have to specify the absolute path of the image when you create an instance representing it.

  • How to put images on graph?

    Hello,
    I want to put images on graph whereever I want.
    I have TDMS file like this.
    My "x Axis" is (km) and "y axis" is MKTY.  If MKTY is 3 I want to put image3 on graph places in the y-axis. If MKTY is 2 then I put "image2" on graph.
    I uploaded my TDR file.
    Yasemin Barutçu
    Electrical And Electronics Engineer
    Attachments:
    graph.zip ‏5 KB

    For me, not. But yes I have to do this. Maybe I manual have a table which includes the y axis coordinates. X axis is dicrete then when I get the value 2 I will look at its y axis and take the coordinates of the y-axis corresponds to the table
    Is it difficult? 
    Yasemin Barutçu
    Electrical And Electronics Engineer

  • How to put many documents in one file with words count

    HHow to put many documents in one file with words count

    Pdfs have no concept of words. Combining pdfs cannot be done with Reader. You need either Acrobat on a Mac or PC or perhaps with the PDF Pack service.

  • Please tell me how to put Image on MDI window

    Brothers i am new in swings please help me in this matter that i want to put image an image on JdesktopPane in swings please give me some code or guide me in this matter. thanks in advance.

    public class MDIDesktopPane extends JDesktopPane {
    private ImageIcon DesktopImage;
    public MDIDesktopPane() {
    DesktopImage=new ImageIcon(new java.net.URL("http://80.96.36.11:8080/hq/RBMS.jpg"));
    public void paint(java.awt.Graphics g)
    Rectangle r = g.getClipBounds();
    Color c = getBackground();
    if(c == null)
    c = Color.black;
    g.setColor(c);
    g.fillRect(r.x, r.y, r.width, r.height);
    g.drawImage(DesktopImage.getImage(),this.getWidth()/2-DesktopImage.getIconWidth()/2,this.getHeight()/2-DesktopImage.getIconHeight()/2,c,null);
    super.paint(g);

  • How do i send mass emails one at a time, without using CC or BCC

    In other words, I have a mailing list for my band. When I send emails to myself and bcc a bunch of emails, many people don't receive them or they get bounced to their junk mails. Is there a way to automate Mail so that an email can be sent, one at a time, to a large list of people? I've tried looking through the help document but it doesnt' help. Thanks!

    I am also looking for this solution.
    I update my address book every so often and on my PC was doing this with a software that sent individual emails in small batches overnight.
    How may I do this now that I'm on a Mac?

  • HT204411 i am trying to purchase many songs at one time. i have added all songs to wish list , now to purchase it will only let me  do one at a time  please advise how i can purchase more than one at a time

    i am trying to purchase many songs at one time. i have added all songs to wish list , now to purchase it will only let me  do one at a time  please advise how i can purchase more than one at a time

    There used to be a 'buy all' button on the wish list screen but for some reason that has been removed from the current version of iTunes so you will need to buy each item individually. You can try leaving feedback for Apple and maybe it'll be added back in a future update : http://www.apple.com/feedback/itunesapp.html

  • How to put image in table selection column in advanced table

    i need to put some image(not a picture, its just a traingalur shape image with different colour which indicates some messages to the user if suppose user adds a data which is duplicate with other row or he may copy existing row and dont change it.) can any one give me an idea of how to achieve this

    Are you looking for image in selection column or as a separate column?
    --Shiv                                                                                                                                                                               

  • How to set image to JPanel

    Hi to all,
    How to set background image to panel in swing?
    If anyone knows tell me..

    Hi,
    Just modify and use this..
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import javax.swing.JCheckBox;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JViewport;
    import RboJComponents.RboJEmailTextField;
    import RboJComponents.RboJPanel;
    public class ImagePanel extends JPanel
    public static final int TILED = 0;
    public static final int SCALED = 1;
    public static final int ACTUAL = 2;
    private BufferedImage image;
    private int style;
    private float alignmentX = 0.5f;
    private float alignmentY = 0.5f;
    public ImagePanel(BufferedImage image)
    this(image, TILED);
    public ImagePanel(BufferedImage image, int style)
    this.image = image;
    this.style = style;
    setLayout( new BorderLayout() );
    public void setImageAlignmentX(float alignmentX)
    this.alignmentX = alignmentX > 1.0f ? 1.0f : alignmentX < 0.0f ? 0.0f : alignmentX;
    public void setImageAlignmentY(float alignmentY)
    this.alignmentY = alignmentY > 1.0f ? 1.0f : alignmentY < 0.0f ? 0.0f : alignmentY;
    public void add(JComponent component)
    add(component, null);
    public void add(JComponent component, Object constraints)
    component.setOpaque( false );
    if (component instanceof JScrollPane)
    JScrollPane scrollPane = (JScrollPane)component;
    JViewport viewport = scrollPane.getViewport();
    viewport.setOpaque( false );
    Component c = viewport.getView();
    if (c instanceof JComponent)
    ((JComponent)c).setOpaque( false );
    super.add(component, constraints);
    protected void paintComponent(Graphics g)
    super.paintComponent(g);
    if (image == null ) return;
    switch (style)
    case TILED :
    drawTiled(g);
    break;
    case SCALED :
    Dimension d = getSize();
    g.drawImage(image, 0, 0, d.width, d.height, null);
    break;
    case ACTUAL :
    drawActual(g);
    break;
    private void drawTiled(Graphics g)
    Dimension d = getSize();
    int width = image.getWidth( null );
    int height = image.getHeight( null );
    for (int x = 0; x < d.width; x += width)
    for (int y = 0; y < d.height; y += height)
    g.drawImage( image, x, y, null, null );
    private void drawActual(Graphics g)
    Dimension d = getSize();
    float x = (d.width - image.getWidth()) * alignmentX;
    float y = (d.height - image.getHeight()) * alignmentY;
    g.drawImage(image, (int)x, (int)y, this);
    public static void main(String [] args)throws Exception
    BufferedImage image = javax.imageio.ImageIO.read(new java.io.File("c:\\final.jpg"));
    //ImagePanel north = new ImagePanel(image, ImagePanel.ACTUAL);
    //north.setImageAlignmentY(1.0f);
    //JTextArea text = new JTextArea(5, 40);
    //JScrollPane scrollPane = new JScrollPane( text );
    //north.add( scrollPane );
    ImagePanel south = new ImagePanel(image, ImagePanel.SCALED);
    south.setPreferredSize(new Dimension(490, 340));
    south.setLayout(null);
    RboJPanel buttons = new RboJPanel();
    buttons.setBounds(15, 105, 350, 50);
    RboJEmailTextField toAddress = new RboJEmailTextField(28);
    //toAddress.setBounds(20,20,20,20);
    //toAddress.setCaretColor ( toAddress.getBackground () ) ;
    buttons.add(toAddress);
    //buttons.add(new JButton("Two"));
    /*JPanel boxes = new JPanel();
    boxes.add( new JCheckBox("One"));
    boxes.add( new JCheckBox("Two") );*/
    south.add(buttons);
    //south.add(boxes, BorderLayout.PAGE_END);
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //frame.getContentPane().add( north, BorderLayout.NORTH );
    frame.getContentPane().add( south);
    frame.pack();
    frame.setVisible(true);
    }Regards,
    Anees

Maybe you are looking for

  • Can I use USB 3 with my 2.8Ghz Quad-core

    I have an early 2008, 2.8 GHz Quad-Core Intel Xeon Mac Pro, can I use USB3 Devices with it?

  • Archive table -Procedure

    Hello Experts, I have developed a store procedure to archive of old data for a huge table. Before deleting a row from the table, inserts the same row in another table. I need to schedule the same through dbms_job for daily execution. CREATE OR REPLAC

  • BPM use in the view of Customer

    Hello All, I would like to know the usage of BPM in a customer point of view. I know how to use the BPM technically. How can we recommend the BPM to the customer that BPM will fit for their requirements? Please advice? Many Thanks for your help! Kind

  • On click at tree component it has to call SWF using XML

    Hi, I have created a flash file with name xmltoflash_tree. Incules a Tree component named "tree01". On my first frame of actions i have included "#include "test.as"". This is about my flash file In my Test.as : import mx.controls.Tree; var xmlLoader:

  • Can quicktime pro capture video stream?

    Can QT pro record video streams off the internet? I thought it was only able to capture embedded video files. Video streams aren't donwloaded into cache, so they have to be saved as they're received. Could someone clarify? Thank you.