Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6691289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:44:04+00:00 2026-05-26T05:44:04+00:00

I have class PrintUtilities , which has the following method to print JPanel and

  • 0

I have class PrintUtilities, which has the following method to print JPanel and its sub components:

public int print(Graphics g, PageFormat pageFormat, int pageIndex)

There is JLabel within the JPanel, which is right justified and the problem is the printed copy is chopping last digit in the JLabel. I can justify it to Center and the printing works but I don’t want to change how it is displayed on the screen.

So, is there a way that I tell the class to display it one way and print it another way? I tried paint(Graphics g) but it will effect the painting the component on the screen.

In short I want to define a way to print JLabel printer without affecting it looks and layout on the screen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:44:04+00:00Added an answer on May 26, 2026 at 5:44 am

    Try placing a border around the JPanel to see if the entire panel gets cut somehow.

    Previously, I had a similiar experience and it turned out that my paper size didn’t match that in the printer.

    Failing that, you might need to investigate scaling your output just a bit so that it fits on the page.

    Hope that helps,
    Ewald

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class which has a method that needs to return three DataTables. I
I have class Window. This class has method onClick which gets argument the id
I have class Fred { public: void inspect() const {}; void modify(){}; }; int
I have class which implements Countable, ArrayAccess, Iterator and Serializable. I have a public
I have class A which has ISerializable implemented for custom serialization. Now i need
I have class: static class AnotherClass { int number; String isPrime; public int getNumber()
i have class method which returns an associative array with a single value in
I have: class first{ private: int *array; public: first(int x){ array = new int[x][10];
I have class method: public object MyMethod(object obj) { // I want to add
I have class Country which has collections of Cities. At client I use webmethod

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.