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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:42:38+00:00 2026-05-22T14:42:38+00:00

I have wrote a program that simulates memory allocation with first fit and best

  • 0

I have wrote a program that simulates memory allocation with first fit and best fit algorithms .

Now I want to associate my program with a drawing of set of boxes representing available memory segments

Before Allocation

enter image description here

After Allocation
enter image description here

So it just redraws but resizes one box and colors it … What is the easiest way to do so ?
I have a set of boxes with different sizes that will be drawn dynamically according to input when the user does some action one of the boxes will be resized and recolored and so on.

  • 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-22T14:42:38+00:00Added an answer on May 22, 2026 at 2:42 pm

    I think this is best approached using graphics.

    1. Instantiate a BufferedImage of a size to fit all boxes.
    2. Get a Graphics instance by calling either of getGraphics() or createGraphics().
    3. For each memory block:
      1. Call Graphics.setColor(Color) according to allocation status, then..
      2. Graphics.fillRect(int,int,int,int) or fillPolygon(Polygon) to draw the memory block.
    4. If needed, use an AffineTransform to scale the sizes. This would require a Graphics2D object to draw on.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a program with java and mysql and now i want to have
I have been looking at Reflection.Emit recently. I wrote a simple program that generates
I wrote a program that employs multithreading for parallel computing. I have verified that
I have a finished program that I wrote with Objective-C in XCode 3.2.3. I
I have a C++ program that I wrote, and I would like to give
I currently have a program that i wrote that is divided up into 3
I have wrote a server program that can handle multiple client by using fork().
I have a program that I want to start at Windows start up. So
I have to write a program that read from a file that contains the
I have to write a program that sniffs network packets (part1-the simple part). And

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.