I'm not getting any errors, just i can't seem to stop the music from playing after clicking the jbutton "Sound On" / "Sound Off" again. I've tried a few methods but it just isn't working for me.
I'm not getting any errors, just i can't seem to stop the music from playing after clicking the jbutton "Sound On" / "Sound Off" again. I've tried a few methods but it just isn't working for me.
I'm doing a little game in Java and I would like to insert a background music managed by a JButton. When the button is pressed, the music starts and then, to stop it, the button is pressed again. If you don't press the button to stop the music remains in the loop until the player plays.
I'm making a karaoke/DJ program for a DJ friend and one of the features she wants is the ability to change the pitch of a song (some singers ask for this).
I have to write a program that allows the user to enter a number in a text field and starts a count down in seconds to ultimately play a music file. I am having a problem getting my text from the text field parsed into an integer so my count down can use it.
I am doing a simple program, just to find multiples of 7 all the way to 125. But the loop its not stopping at 125 and is going to 126.
public class Assingment2B { public static void main(String[] args) { int number = 0; while (number <= 125) { number += 7; if (number % 7 == 0) { System.out.println(number);
I am doing an assignment which involves creating a maze and a ball that needs to go through the maze to an end tile then stop the scenario. The maze is made up of 208 buttons in a Jbutton Grid layout. I am replacing certain buttons with a brown tile icon to make up the maze. The ball needs to run along those brown tiles as its path and not be able to move off the brown tile icon images.
I have built the maze and have got quite far with this but now I am stumped on the concept of keeping the ball within the boundary edges and on the brown tiles. I have been told to use if statements, but not had the process explained to me in a way I can understand.
I am currently in the process of making a game in java. it's going fairly well, however, one problem that i am having is that i cant seem to get my enemy sprites not stack up onto one another. What i want to happen is if two enemy sprites come in contact with one another i want them to touch but not to overlap. However, i cant seem to get this to work.
This is the enemy class:
import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.util.ArrayList; import javax.swing.ImageIcon; public class Enemy extends Base { int x; int y;
I am trying to have a Jbutton (blocker02) act like a wall that will not allow a moving Jbutton to pass through. I tried using " if (blocker02. getBounds (). intersects(r_wall)) but it hasn't been successful.
I have a properties file with key values in it, now when I use my search box to search for a key in the properties file to check whether or not it is there - I can't get it to check and return the key value if it is theere. I've tried a few methods but keep getting a null pointer exception when it hits line 15 in the code all the time so I'm stumped at the minute.
So I'm trying to make an applet that displays images of playing cards. The applet should load a deck of 52 playing card images (the folder is called "images"). The applet should shuffle the deck (using a random number generator) and display the first 10 cards of the shuffled deck. I then have to display the cards in two rows of five cards each.
With this code I have about 100 errors and I'm not sure what I'm doing wrong:
I'm building app using Javafx Webview, but I have problems with running any Youtube video in Webview. The strange thing is that rarely it plays ok but more often it shows info "An error occurred, please try again later".
I tried to figure it out, so I made simple app using Youtube iframe API and firebug lite to show where is the problem:
Here is source of Main.java
Here is source of video.html
When I run it on my PC I see the result as below:
Error state 5 means "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.".
When I run this video.html file in firefox, chrome, or internal eclipse browser, everything is ok and always work.
I use JRE and JDK 1.8.20 but tried also with older versions, Windows 7 64 bit. I've also installed DivX - did not work. I tried on different PC (also win7 64 bit) and asked 2 people with similar config to run this - and it is not working. As far as I know there is everything ok on Mac.
I was testing my JavaFX2.2.7 based media player code in a current Java 6 application when I discovered that HTTP Live Streaming does not seem to work. I can play a local file of the supported format (Sintel trailor mp4 h264) but when I try and use an HTTP Live Stream instead, nothing plays. (for example [URL] ). I end up with a blank player, and no exceptions or errors.
private static final String MEDIA_URL = "http://download.oracle.com/otndocs/products/javafx/JavaRap/prog_index.m3u8"; Media media = new Media(MEDIA_URL); MediaException ex = media.getError(); if (ex != null){ System.out.println("Media Error" + ex.getMessage()); } else{ System.out.println("No Media Error"); }
Program console output: "No Media Error"
I thought it was something wrong with my player code, so as a last resort, I went to JavaFX 2 - Ensemble and copied the source and put it directly into my application and ran it... Unfortunately the same result occurs. The player runs, but simply shows a blank video window. The controls are available, but no video plays.
Based on the Release notes for Java 2.2.7 I was under the impression that HLS was supported. Am I incorrect? I cannot upgrade to Java 7 as I am firmly stuck with Java 1.6.0.32 due to project constraints.
"In this assignment you will use an applet to display images of playing cards. The applet should load a deck of 52 playing card images from the "images" folder that you downloaded. The applet should shuffle the deck (use a random number generator) and display the first 10 cards of the shuffled deck. Display the cards in two rows of five cards each."
That is my goal for this assignment. I've got my code compiling and I will post it below and I've got an html page but when I try to open it I get an error
import java.applet.Applet; import java.awt.Graphics; import java.awt.Image; import java.util.Random; public class Assignment12 extends Applet { Image card1; Image card2;
I want to make a service like Spotify, where I can stream music that I have stored on my computer (in this case server) to my laptop or phone.
* What would be a suitable format for this? * How would I actually stream it? I want to stream, not download and then play, I want to play the music while downloading.
Web based program, basically a slide show template where the user uploads a series of photos, they are dumped into the pre-fabbed template of a predetermined set of transitions in sync with music. I will set the templates to transition based on the time stamp of the beat of the music at certain intervals. The end users will be able to then create their own slide show "movie" based on the templates.
Problems I see are the syncing between the music and the images loading. Wondering if it's doable client side or if I need to have it rendered server-side.
I am currently building a java music player and need getting the volume control to work. I want to be able to set the computers volume directly using an integer. I've created a slider and put the value into an integer. The part that I am having trouble with is getting the volume to work.
[attachment=38859:bcourt.jpg]I/m not used to Timers, so this will be my first time using it and I don't know how. I've been searching the internet for an hour but I can't find an answer into it. I'm currently doing a basketball game which has a Buttons (Shoot,Dribble,Hold) and I need those timers for my buttons to work. Her's the code:
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class BasketBall extends JPanel implements ActionListener { JButton shootButton = new JButton("SHOOT"); JButton drbblButton = new JButton("DRIBBLE"); JButton holdButton = new JButton("HOLD");
I have a Jbutton in my application named as SUBMIT,on clicking SUBMIT the text of jButton changes to ABORT. I wish to apply enter key listener on both the SUBMIT and ABORT button in my applcation, however I am not able to get the text of the button in key listener,so that i can apply my code based on the current text of Button.
I have a jButton that when the action perform runs it only does part of the tasks some of the code doe not appear to run and i just can not figure out why i have tried wrapping parts of it in an if statement and it still do not run so here is the code behind the button:
in the code the parts that do not run are jTextField10.setText("Working Please Wait"); and jButton15.setVisible(false);
what i am expecting to happen is the text field has the words Working Please Wait placed in it , this does not happen and the button should be hidden to prevent it being clicked a second time again this does not happen
the rest of the code works as expected
InputStream inStream; OutputStream outStream; try { File afile = new File("C://templates//amendments.xls"); File bfile = new File("C://amendments.xls"); inStream = new FileInputStream(afile); outStream = new FileOutputStream(bfile);
I am having right now is that I don't know how to stop my music from playing? I am making a Connect 4 game with some audio to make it intuitive. Below is my code. This is my Music method.
public static void Music() { try { File music = new File("C:\Users\Ken\workspace\Assignment1\src\Mario1.wav"); AudioInputStream audioIn = AudioSystem.getAudioInputStream(music); Clip clip = AudioSystem.getClip(); clip.open(audioIn);
[Code] ....
I called this method into a JButton i implemented into my main GUI.
if (e.getSource() == SoundOn){ Music();} if (e.getSource() == SoundOff){ //What do I put here? }
How do i parse a String of text in a JTable Cell to work as a button?For example lets say a row of IDs such as 1,2,3,4,5,6 id like the whole column to parse as JButtons that are titled 1,2,3,4,5,6..Id like to then use these buttons to call a function with the title as a parameter.Its just a simple row of entries where the button will open up an edit screen to edit the corresponding clicked entry.So how do i parse them as buttons for a start?
I'm not sure what I'm doing wrong but none of the buttons will show below. I tried using .add with the container name but it kept giving me an error. When I just put add.(); it seems fine but then nothing shows. Is there something I'm missing that's required?