Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2004

Tip: Looking for answers? Try searching our database.

Linux & Win: Differencies when moving dialog on a screen

Thread view: 
maRIO5 - 02 Jan 2004 18:46 GMT
I have two classes:
1. Print class which is printable and also create a buttonPrint (with its
  actionListener) which open a printDialog. And
2. JFrame class with toolBar and buttonPrint in it.

When I moving PrintDialog through the screen it corectly moves in Linux
but it left a conture (or grey prints) from the dialog in a Windows.

What I must to do to remove that effect in a Windows?
When I open a dialog why my application permanently disapired and shows up
again,  after I press OK or cancel in a dialog?
---
Mario
maRIO5 - 06 Jan 2004 15:15 GMT
<posted & mailed>

> I have two classes:
> 1. Print class which is printable and also create a buttonPrint (with its
[quoted text clipped - 9 lines]
> ---
> Mario

I see that no one knows the answer on my question. Mybe
my english is so bad so I will ask on other way:
What happens when you move pageDialog (or printDialog) on a screen?
Is it really moving or left marks of the dialog on other opened windows?

Signature

dk

Steve W. Jackson - 06 Jan 2004 17:31 GMT
>:<posted & mailed>
>:
[quoted text clipped - 18 lines]
>:What happens when you move pageDialog (or printDialog) on a screen?
>:Is it really moving or left marks of the dialog on other opened windows?

It sounds very much like you're displaying the pageDialog (or
printDialog) from within the actionPerformed method.  But unless that
dialog is modal, so that it blocks (and the underlying Swing mechanisms
start a new event pump, etc., etc.), your Event Dispatching Thread will
be too busy to automatically redraw underlying windows/dialogs when you
move this page/print dialog.  My app uses the printDialog() method of
PrinterJob, which would appear to block (it returns a boolean).  If
true, it then calls the PrinterJob's print() method.  And we're not
experiencing any problems of that type.  But if this isn't working for
you, you may also want to consider whether you can spawn that section of
code into a separate thread.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

Mario_5 - 07 Jan 2004 23:10 GMT
> >:<posted & mailed>
> >:
[quoted text clipped - 35 lines]
> Steve W. Jackson
> Montgomery, Alabama

I didn't understand exactely. How to call pageDialog which returns
PageFormat
except that I press the button whic calls :

public void actionPerformed(ActionEvent e) {
   String label = e.getActionCommand();
   if (label.equals("Print")) {
    // Get a PrinterJob
     job = PrinterJob.getPrinterJob();
    // Create a landscape page format
//      PageFormat format = new PageFormat();
     PageFormat format = job.defaultPage();
     format.setOrientation(PageFormat.LANDSCAPE);
     papir = new Paper();
     papir.setSize(12*72,2*72);

     format = job.pageDialog(format);

    // Set up a book
     Book bk = new Book();
     pageIndex=0;
     bk.append(this, format);
    // Pass the book to the PrinterJob
     job.setPageable(bk);

     if (job.printDialog()) {
        // Print the job if the user didn't cancel printing
       try { job.print(); }
           catch (Exception exc) {
           /* Handle Exception */
             System.out.println("PrintGre?ka");
           }
    }
     }
 }
Steve W. Jackson - 08 Jan 2004 16:48 GMT
>:> In article <btejba$p5f$1@sunce.iskon.hr>, maRIO5 <mario_zupan@inet.hr>
>:> wrote:
[quoted text clipped - 74 lines]
>:      }
>:  }

Your code differs from the way I've done it mainly in that I don't use a
Book.  But your call to pageDialog() does in fact return a PageFormat.  
So far as I can tell, there's nothing in the code example here that
would block or take abnormally long to run.  I'm not really familiar
with the use of Book or Paper classes, but I don't see any place where
you're using the Paper once you create it.

So the only further suggestion I might have to prevent this from bogging
your GUI is to put most of that code there into a separate Thread, maybe
building a Runnable around it and using SwingUtilities.invokeLater() so
that it will immediately free up the Event Dispatching Thread and let
your actionPerformed method return.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

Mario_5 - 08 Jan 2004 18:01 GMT
> >:> In article <btejba$p5f$1@sunce.iskon.hr>, maRIO5 <mario_zupan@inet.hr>
> >:> wrote:
[quoted text clipped - 92 lines]
> Steve W. Jackson
> Montgomery, Alabama

And when you mentioned a Book, it isn't best solution for me.
I need to print some JTable separate on 4 pages for example.
I made print preview but now, I need to print on the same way on
four A4 format paper.
How to separate that table on 4 pages ?

Mario
Steve W. Jackson - 08 Jan 2004 18:53 GMT
>:> In article <bti3gj$7c8$1@sunce.iskon.hr>,
>:>  "Mario_5" <mario_zupan@inet.hr> wrote:
[quoted text clipped - 110 lines]
>:
>:Mario

In our case, we've created a class that implements both Printable and
Pageable.  In our app, there can be multiple "screens" of data, and each
one will print on a single page, regardless of actual size, by scaling
to fit.  Instead, we could've calculated a copy of the "screen" in
multiple pieces to fit on separate pages -- perhaps based on user
settings or other details.  We'll do that in some future release of our
product.  But for your use, the most likely idea would be to capture the
contents of your JTable and begin studying exactly how the Printable
and/or Pageable interfaces work.  My program creates a new instance of
that class I mentioned, then passes it to the PrinterJob via something
like a call to job.setPageable(myPageable) -- and it knows how to do the
work.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

Andrew Thompson - 09 Jan 2004 00:56 GMT
...
| How to separate that table on 4 pages ?

How to make that reply in <4Kb?
Make use the 'delete' key to trim
old text.  Please.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.