Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. forcing java functions to execute in sequence??

forcing java functions to execute in sequence??

Scheduled Pinned Locked Moved Java
javahelptutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alok Sharma ji
    wrote on last edited by
    #1

    any idea how to do it , as i have a main Jframe and another data frame which previews and print the data in JTable ,now my problem is when i execute my code to print then flush the jtable data, it works vice-versa, as it flushes all the data in jtable then shows the preview frame. it is as:

    {
    functionshow_print_preview();
    functionflush_table_and_refresh();
    }

    G 1 Reply Last reply
    0
    • A Alok Sharma ji

      any idea how to do it , as i have a main Jframe and another data frame which previews and print the data in JTable ,now my problem is when i execute my code to print then flush the jtable data, it works vice-versa, as it flushes all the data in jtable then shows the preview frame. it is as:

      {
      functionshow_print_preview();
      functionflush_table_and_refresh();
      }

      G Offline
      G Offline
      Gerben Jongerius
      wrote on last edited by
      #2

      Java will execute the code in the exact same order as you write it. So if you have the calls to those two functions below one and other like: { functionshow_print_preview(); functionflush_table_and_refresh(); } then they will be called in the following order:

      1. functionshow_print_preview
      2. functionflush_table_and_refresh

      The only thing I can think of is that you start a seperate thread somewhere within either of these two functions causing them to be executed out of sync.

      A T 2 Replies Last reply
      0
      • G Gerben Jongerius

        Java will execute the code in the exact same order as you write it. So if you have the calls to those two functions below one and other like: { functionshow_print_preview(); functionflush_table_and_refresh(); } then they will be called in the following order:

        1. functionshow_print_preview
        2. functionflush_table_and_refresh

        The only thing I can think of is that you start a seperate thread somewhere within either of these two functions causing them to be executed out of sync.

        A Offline
        A Offline
        Alok Sharma ji
        wrote on last edited by
        #3

        see that is the problem , i know it has to be this way but priview shows as a blank jtable as the number 2 executes while first is in middle of execution (taking the jtable data of mainframe), any solution??......

        1 Reply Last reply
        0
        • G Gerben Jongerius

          Java will execute the code in the exact same order as you write it. So if you have the calls to those two functions below one and other like: { functionshow_print_preview(); functionflush_table_and_refresh(); } then they will be called in the following order:

          1. functionshow_print_preview
          2. functionflush_table_and_refresh

          The only thing I can think of is that you start a seperate thread somewhere within either of these two functions causing them to be executed out of sync.

          T Offline
          T Offline
          TorstenH
          wrote on last edited by
          #4

          you're right - and not right. The methods are called in this order, but the printer job takes some more time. In the meanwhile the table is deleted. @ Alok try to return a value from the print job, a signal to mark when the job is done. Set up a loop (or use another thread) which interrupts the code as long as the print job takes. regards Torsten

          I never finish anyth...

          A 1 Reply Last reply
          0
          • T TorstenH

            you're right - and not right. The methods are called in this order, but the printer job takes some more time. In the meanwhile the table is deleted. @ Alok try to return a value from the print job, a signal to mark when the job is done. Set up a loop (or use another thread) which interrupts the code as long as the print job takes. regards Torsten

            I never finish anyth...

            A Offline
            A Offline
            Alok Sharma ji
            wrote on last edited by
            #5

            k i will try that.......

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups