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

  • Home
  • SEARCH
  • 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 9093015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:58:54+00:00 2026-06-16T22:58:54+00:00

I have made a simple Java game, when I load the game a start-up

  • 0

I have made a simple Java game, when I load the game a start-up menu pops up with a simple play button and a close button, if I press the start button Java changes to another class which takes the user to the game, if I press close the game shuts down. At the moment the game menu is very boring I wish to add a video to the start-up menu, is this possible using Java code and if so, is it complicated?

My code so far for my menu is shown bellow, the main two methods are the render and update methods, the render tells java what to add to the screen and the update method tells java what to do if a button is pressed:

    package javagame;

import org.lwjgl.input.Mouse;
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Menu extends BasicGameState{

    //public String mouse= "no input yet";//COORDS if needed

    Image bg;

    public Menu(int state){
    }

    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
    bg = new Image("res/croftbg.png");
    }

    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{ 
    bg.draw(0,0);
    //g.drawString(mouse, 10, 50);//COORDS if needed
    }

    public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException{
    int posX = Mouse.getX();
    int posY = Mouse.getY();
    //mouse = "mouse pos:" +posX+"  " +posY;//Coords if needed
    //play now button
    if((posX>110 && posX<140) && (posY>5 && posY<25)){//checks if mouse is inside play now button
        if(Mouse.isButtonDown(0)){//checks if left mouse pressed
            sbg.enterState(1);//change to play state ie(1)
        }
    }
    //exit button
    if((posX>510 && posX<535) && (posY>5 && posY<25)){
        if(Mouse.isButtonDown(0)){
            System.exit(0);//closes the widow
        }
    }
}

    public int getID(){
        return 0;
    }

Also, I do not require any audio, I only need the video.

Thank you in advance.

  • 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-16T22:58:56+00:00Added an answer on June 16, 2026 at 10:58 pm

    I would suggest you taking a look at Xuggler, as I think JMF is not widely used anymore.

    I would also take a look at this Stack Overflow Question/Answer as it really does answer your question quite nicely.

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

Sidebar

Related Questions

I have a simple game I made in java. Essentially, my programming ability is
I have made a very simple 2D Java game class made up of the
I have a simple game animation made in java. It is of three planets
Beginner in Android development. My code crashes. I have made a simple Java method
I have coded a simple Java game where there are two rectangles on the
I have made a simple game, it is a state based game meaning I
I have coded a simple 2D Java game where there is a overhead view
I have two java applications, one is web app and another is simple java
I made simple java application which has a submit button on clicking which the
I'm programming a simple game in java. I've made a collision test with 30

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.