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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:45:10+00:00 2026-05-31T03:45:10+00:00

So I have two classes. One is a class called Main. The Main class

  • 0

So I have two classes.
One is a class called Main. The Main class is supposed to process some data.

Then I have another class called MainApplet, an Applet of course.
How can I display MainApplet from the Main class? This is what I have so far, but the applet does not show:

public class Main {
public static void main(String args[]) {
    System.out.println("Starting application.");

    MainApplet Main = new MainApplet();
    Main.setVisible(true);
    Main.show();
} }
  • 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-31T03:45:12+00:00Added an answer on May 31, 2026 at 3:45 am

    How can I display MainApplet from the Main class?

    You don’t. You display an applet from HTML code.

    Are you sure your GUI is in fact an applet? Does it extend JApplet or Applet? If so and you want to show it on the desktop through code, then don’t make it an applet but instead display a JFrame. The Java Swing tutorials will show you how to do this: How to use Swing Components

    Edit
    you state:

    Basically I have a Main class that is not an applet. It doesn’t extend anything. Then I have another class named MainApplet that is an applet (extends JApplet). I want to run Main first, then display MainApplet after… but I can do it the other way around if needed.

    You don’t sound like you’re running your code from a web page (for some reason you’re still keeping this information from us), so the solution is not to use applets for this. Instead create a JFrame. Please check out the tutorials that I’ve linked to above since an applet is not appropriate for your needs.

    You will have a main that creates your GUI, that passes any information into the GUI via constructor or method parameters, and then that tells the GUI to show itself (by calling setVisible(true) if it’s a JFrame).

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

Sidebar

Related Questions

I have two one-to-one relations here between a class called MailAccount and the classes
I have two classes, and want to include a static instance of one class
I have the following two classes, one inherits from the other Class A{ void
Let's say I have two models, Classes and People. A Class might have one
I have a class called Entity, with two child classes: Creature and Item. (I'm
Hi I have two classes, one called Instruction, one called LDI which inherits from
I have written two simple Java classes (one of them containing main(), and the
First, a little background (greatly simplified): I have two classes, one called Entity and
I have two classes. One is called Employee and the other EmployeeDetails that has
I have two abstract classes called Robot and GeometricElement . Each one of them

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.