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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:48:17+00:00 2026-06-15T16:48:17+00:00

I currently have a JApplet within which I add two objects that both extend

  • 0

I currently have a JApplet within which I add two objects that both extend JComponet.
Object A is basically a large square and object B is a small square, I need Object B to always be in front of Object A, however I cant work out how to set layering within the JApplet to do this.
Current I am using the follow code, which adds both the items and displays them how I want however sometimes Object A is front of Object B.

public void init() {
    add(myapplet, BorderLayout.CENTER);
    resize(200, 400);
    B = new Block(Color.green, 10, 10);
    myapplet.add(B);
    A = new Block(Color.red, 100, 100);
    myapplet.add(A);
    myapplet.addMouseListener(this);
    startTimer();
}
  • 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-15T16:48:19+00:00Added an answer on June 15, 2026 at 4:48 pm

    You might look at JLayeredPane, seen here, or OverlayLayout, seen here. Either should work in an applet, but this hybrid approach may offer additional flexibility.

    JLayeredPane

    OverlayLayout

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

Sidebar

Related Questions

Currently have a drop down menu that is activated on a hover (from display:none
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty
I currently have a table of concentrations, which are linked to a table of
I currently have one project that currently contains multiple packages. These packages make up
I currently have a deployed app (fortworth.herokuapp.com) that I am attempting to sort movies
I currently have the following code that retrieves data from the database and then
I currently have a webapp which draws points of interest using the maps api,
I currently have a PowerShell script that is used for complex automated Exchange mailbox
I created a JApplet which uses two external libraries ( JENA and JUNG ).
Currently I have the following code for a project that represents some probability trees

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.