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 8648027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:13:05+00:00 2026-06-12T13:13:05+00:00

In my application, I need to draw JTextArea on certain position on my panel,

  • 0

In my application, I need to draw JTextArea on certain position on my panel, and I need to be able to zoom in and out on it.

For positioning it, I can use absolute positioning, but scaling poses a challenge – I can easily scale it down by tweaking paintComponent method:

@Override
public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.scale(0.5,0.5);
    super.paintComponent(g2);
}

But scaling up doesn’t work – since I set the bounds of the component using setBounds explicitly, part of scaled up component ends up not being drawn. How can I solve it?

EDIT: A bit of explanation.

The application I maintain is a sort of a graphic editor, and I need to add a functionality of adding a something like a note to working area, so that user can directly type the text on that working area. As in most graphic editors, the working area can be moved and zoomed in/out, so the text area where user is typing the text should move and scale too.

  • 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-06-12T13:13:07+00:00Added an answer on June 12, 2026 at 1:13 pm

    If the text component must remain editable when scaled, you may be able to scale the Font used in (rough) proportion to the scale factor, as shown here.

    image

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

Sidebar

Related Questions

I need to draw charts in my application. For that i use RGraph (
I have a new mobile application I need to get out the door but
I'm making a BlackBerry OS 6+ application and I need to draw a solid
I have an application where I need to draw different graphics objects on the
I am developping an application where I need to draw a graph on the
I am writing a VCL/Delphi Application, and I need to draw text onto a
I am working on a application where i need to draw and save that
I am building a line graph application using Raphael.js and need to draw a
We are building a graphical application, we need to draw dots on the canvas
I've been working on a WPF application and need to be able to show

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.