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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:39:48+00:00 2026-05-23T00:39:48+00:00

I had created a basic calculator using Java Swing. The question I have is

  • 0

I had created a basic calculator using Java Swing. The question I have is how to print each calculation on the panel. for example, I have added two numbers, my panel should look something like 2 + 4 = 6, and if I perform another operation it should append another operation in the panel.

My idea: I know I can do with the labels and change the value of the labels, but this is not a good idea since as the operations increase I cannot keep on adding the labels, I believe there should be a way but since I am learning Swing, I need some help from experts.

  • 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-23T00:39:49+00:00Added an answer on May 23, 2026 at 12:39 am

    There are two possibilities:

    1. Use a JTextArea and set it to be non-editable. The text area control will allow you to add multiple lines of text so that you can keep appending operations as you like.

      textArea.setEditable(false);

    2. Draw the text as graphics on a Canvas. This is a little more involved but you have more control over the way the text look and how it is formatted.

      g.drawString(“a + b = c”, x, y);

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

Sidebar

Related Questions

Had a basic WinForm question: By default a resx file is created for every
I have a Tab Bar application for iPad, created using the basic Tab Bar
I have a smallish utility library I made that I had created in TFS
If a set of controls on a WinForm have had DataBindings created and attached
On my previous machine I had IIS6 installed and created a web project using
I have created a basic unlock slider like you use to unlock the iPhone.
I have acquired a DLL that was created in Visual Basic from a third
All, I have just reinstalled Java on my machine because I found I had
Evening all. I have created a basic HTML5 site. It validates in W3C validator.
I have a basic ASP.Net project created in Visual Studio 2008 on Windows Server

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.