JavaFX Media Player ConcurrentModificationException When Media Change

Dec 5, 2014

I am currently making a video player which allows users to open/play videos which are stored on their computer. I am using JavaFX for this.My problem, is that sometimes when I click the button to load a video, a java.util.ConcurrentModificationException is raised. Other times, it's perfectly fine.I put the calls to .loadAndPlayMediaA() and .prepareMedia() (see below) inside a .runLater(Runnable) to try to prevent this, but it has not worked. My Code (below) is called by a listener on a button, "testButton". I have a class called JfxMediaPlayer which holds the method loadAndPlayMediaA(), and a class called MixingDeck which holds the method prepareMedia()

testButton.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent arg0) {
Platform.runLater(new Runnable(){
@Override

[code]....

View Replies


ADVERTISEMENT

Java Media Player

Feb 24, 2014

I am using the Netbeans IDE for Java creations. What are the steps of creating a media player using Java thru Netbeans as i don't understand most of the jargon and the forms,classes,etc.I don't want to use JavaFx but plain Java Application.I am coming from a Delphi pascal background.

View Replies View Related

Designing Media Player - Program Cannot Play Any Song

Feb 24, 2014

i want to design a media player but my program can't play any song it is showing me error "Uncompilable source code - cannot find symbol

symbol: class MediaPanel
location: class media.Media
at media.Media.main(Media.java:28)"

This is my code.

package media;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JFileChooser;

[Code] .....

I got the code from [URL] .....

View Replies View Related

JavaFX 2.0 :: MediaPlayer Error - Media Invalid

Jul 11, 2014

I am having a problem with the JavaFX MediaPlayer playing videos with resolutions greater than 1920x1080px. For testing purpose I downloaded the example from [URL] ... and added the following error-handling:

mediaPlayer.setOnError(new Runnable) {
     @Override
     public void run() {
          System.out.println(mediaPlayer.getError.getMessage());
          System.out.println(mediaPlayer.getError.getType());
     }
});
 
When playing a video with a resolution of 1920x1168px, the window became black and I get this console output:

[com.sun.media.jfxmediaimpl.platform.gstreamer.GSTMediaPlayer@5482fb8f] ERROR_MEDIA_INVALID: ERROR_MEDIA_INVALIDUNKNOWN

The video is encoded with h264 and aac (for audio) and is having a resolution of 1920x1168px. The error occurs with each video with a resolution greater than 1920x1080px. Vidoes with a resolution of 1920x1080px or smalle are working fine. The playback of all videos is working with VLC-Player. I tried Java 7_51 and Java 8_5.

View Replies View Related

Javax Media Always Showing NoPlayerException For Videos

Feb 22, 2015

my program is working for mp3 files but for video file it shows error "player not found".i wanna know that how it is possible if my JMFStudio is able to play videos directly

View Replies View Related

Player One Type A Number And Player Two Suppose To Guess - Infinite Looping

Apr 2, 2014

Its a basic program that is played by 2 people. Player one is suppose to type a number and the second player is suppose to guess the number. However after I test it out, and if I guess too low or too high I get stuck in "Your guess is too low, try again." infinite loop, what is wrong.

import java.io.*;
class GuessingGame
{
public static void main (String[] args) throws IOException
{
BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
String firstPlayer, secondPlayer;
int firstInput, secondInput;
int guessCount = 0;

[Code] .....

View Replies View Related

Change Position Objects In JavaFX

Jun 4, 2014

I can't recolate and align the button, the circle or the line where i want it to on the canvas. I want to be able to move the line where i want it, now it seems like all objects are stuck in the middle of the scene or canvas.

package application;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;

[Code] ....

View Replies View Related

JavaFX 2.0 :: Only One Change Event On ObservableList?

Apr 9, 2015

I have a list of Row objects and want to listen to changes in the name property of a Row object.
 
public class Row implements Serializable {
    private final SimpleStringProperty name = new SimpleStringProperty(this, "name", "");
    public Row() {
        this("");
    }
    public Row(String name) {
        this.name.set(name);

[Code] ....
 
I would expect to be notified 4 times. Line 23: Added, Line25, 26, 27: Update

But there are only 2 change events. For Line 26 and 27 there is no change event.

View Replies View Related

JavaFX 2.0 :: Unable To Change Textfield Value

Jun 8, 2014

I am having a small JavaFX program where I try to set a value to TextField. Below is the part of FXML file and highlighted is the Textfield ....

fxml file  
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="185.0" prefWidth="598.0">
          <children>
            <TextField fx:id="actiontarget" editable="true" layoutX="146.0" layoutY="73.0" prefWidth="198.0" text="" />
           
[Code] ...
 
I want to display a string value to that text field.

So, I am using that fxid (actiontarget)

But actiontarget.setText (pathofFile) is not working .
 
Nothing displays and no value sets for the Text field.
 
How can I set value in that text field through above code.

View Replies View Related

JavaFX 2.0 :: TreeTable Can't Change Title

Mar 16, 2015

I change TreeTableColumn.text but I got a Exception
 
Exception in thread "JavaFX Application Thread" java.lang.ClassCastException:
javafx.scene.control.TreeTableColumn cannot be cast to javafx.scene.control.TableColumn
    at com.sun.javafx.scene.control.skin.TableHeaderRow$10.invalidated(TableHeaderRow.java:277)

so I check TableHeaderRow . I find this method
 
private final InvalidationListener columnTextListener = new InvalidationListener() {
        @Override public void invalidated(Observable observable) {
            TableColumn<?,?> column = (TableColumn<?,?>) ((StringProperty)observable).getBean();
            CheckMenuItem menuItem = columnMenuItems.get(column);
            if (menuItem != null) {
                menuItem.setText(getText(column.getText(), column));
            }
        }
    };

why don't they use this

TableColumnBase<?,?> column = (TableColumnBase<?,?>) ((StringProperty)observable).getBean();

View Replies View Related

JavaFX 2.0 :: Override A Theme To Change Colors

Jul 2, 2014

We have developed a theme called default.css that is extending of the default caspian.css. What we want to do is offer users the ability to override values from default.css to change colors etc. How can that be done?

View Replies View Related

JavaFX 2.0 :: How To Listen To Change In CheckBox In TableView

Dec 28, 2014

I created two CheckBox in 2 tableColumn and I want to listen theire change. I tried

col_orien.setOnEditCommit

But it doesn't work (col_orien is the name of the tablecolumn that contain the check box)

Here is my code :

     col_orien.setOnEditCommit(new EventHandler<CellEditEvent<Information,Boolean>>() {
       @Override
       public void handle(CellEditEvent<Information, Boolean> event) {
         System.out.println("Edit commit");
       }
     });

View Replies View Related

JavaFX 2.0 :: How To Add Text Change Listener To HTMLEditor

Mar 26, 2015

I am using javafx 2 in my project,After user change the text in HTMLEditor,i will save the context to database,if text wasn't changed,then i do nothing .so i want to know if the user have changed the text.
 
I only saw how to add text changed listener to HTML web viewer. So how to add text changed listener to htmleditor?

View Replies View Related

JavaFX 2.0 :: Change Justification Of TableColumn Headers?

May 26, 2014

I have a table column and I want to change the columns header justification from center justified to left justified. How do I do this, either via code or via CSS.

View Replies View Related

JavaFX 2.0 :: Change Arrow Color On Header Of TableView

May 20, 2014

is possibile to change the color of the sorting arrow that appears in the columns of the Table View by css? My attempts have failed and I have not found any documentation, nor is there any reference in the Modena css.

View Replies View Related

JavaFX 2.0 :: Combobox - Visible Count Row Not Applied And Doesn't Change

Oct 15, 2014

I have noticed a strange behavior of Combobox element. The number of visible rows is not the same established by setVisibleRowCount() method. It happens when changing the items list dynamically. The following example reproduces it. I think it is Javafx 8 bug. I have tried unsuccessfully to trigger some event indirectly to refresh the combobox drop down.

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TestComboBox extends Application {
    private int count;

[Code] .....

View Replies View Related

JavaFX 2.0 :: Dynamically Change CSS Class And Splash Screen Implementation

Jan 12, 2015

So it seems to reason that many JavaFX applications will want to dynamically change CSS styles.  Is the best way to do this via the <node>.getStyleClass().add("classname")?  The underlying data structure is an observable list.  So lets say one has 5 styles that simply change the fill color of a circle to 5 different colors respectively.  So if I have a condition in which I want to dynamically apply 1 of these 5 styles, the way I currently do this is by defining all 5 styles as strings in a list using a static initializer, then I call <node>.getStyleClass().removeAll(list), then getStyleClass().add("classname").  I do this to avoid adding the same style over and over and inflating the underlying list.  Is this the correct way to manage dynamic CSS styles?
 
So I know there is a few different way to implement a splash screen.  My app has definitely gotten larger over the last few months of development and I have noticed there is about a 5 second delay between when I run the application to when I see the main stage.  I was thinking a splash screen would be nice to fill this time period.  I have not had time to prototype using a Preloader and I fear that using an alternate, lightweight stage on startup would still take too long of a delay.  I was actually thinking that using the nice and simple JVM argument "-splash:<image name>" would be simple, easy and effective.  Unfortunately when I try to do this, the splash screen comes up but never goes away. 

View Replies View Related

Unable To Create MP3 Player

Jul 6, 2014

I am trying to create an MP3 player with a totally customized look and feel to it. I know how to do this with .net, but I must be missing something in Java.

I want to be able to NOT have to present the user with the default mediaPlayer.getControlPanelComponent() in order to control the media player. I want to be able to code it to when the user clicks on my "Play" button, I can tell the player to play the song, and so on.

so far I get this far:

try {
player = Manager.createPlayer(playit.toURI().toURL());
player.start();
//Component c = player.getControlPanelComponent();
} catch (IOException | NoPlayerException ex) {
Logger.getLogger(TagTester.class.getName()).log(Level.SEVERE, null, ex);
}

...but cannot seem to find out where to go from there.

If familiar with AxWindowMediaPlayer in .NET, I am looking for something similar to:

AxWindowMediaPlayer.Ctlcontrols.play()

when my "Play" button is clicked.

View Replies View Related

How To Track Player Positioning

Nov 25, 2014

So I have a player an enemy and enemy bounds the enemy can go. I need to have the enemy track my position and when I go into the position (I am using a collision method for this) the enemy comes over at a speed of 1. My problem is the enemy jumps to me and then follows at speed of 2 (2 is the player speed). The code is wrong this is why it is jumping and I have my other problems. so my question is what is a good solution for this? I am trying to make a method to track playerposition() so what I am thinking I could do is find x, y of player then store those into an array and return the array to Enemy so he tracks.

player.java
public class Player{
int x = 100; // Location of player
int y = 200; // location of player
int xa = 0; // Representation of where the player goes
int ya = 0; // Representation of where the player goes
private int speed = 2;

[Code] .....

Please note this is not the entire code I have cut some things out that did not need to be there. Also, the code is just to get an idea of what I was thinking of doing. The ideas that are came up with are not meant to be a reflection of what I already have but, what I could add or replace.

View Replies View Related

Java Music Player - Volume Control

Dec 5, 2014

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.

View Replies View Related

Turning Single Player Blackjack Game Into Multiplayer

Mar 19, 2014

I wrote a single player blackjack code and i want to play this game with multiplayers, which steps should i take to do this

package blackjack;
import java.util.Random;
import java.util.Scanner;
public class Blackjack {
public static void main(String[] args) {
Random kagit=new Random ();

[Code] .....

View Replies View Related

Collision Detection Using Rectangles - Player Sometimes Passes Through The Tiles

May 19, 2014

I have already tried every possible way for removing this bug but all failed. The problem is that sometimes my player passes through the map tiles, i mean, the algorithm is like -- if not colliding, move in required direction; else if colliding, move in opposite direction. But sometimes the second condition fails i dont understand why.

private void movement(){
left=bindObject.getLeft();
right=bindObject.getRight();
up=bindObject.getUp();
down=bindObject.getDown();
bindObject.setColliding(colliding);

[Code] .....

Where bindObject is a class which contains key bindings of following keys:-

left arrow key (when pressed) , left arrow key (when released),
right arrow key (when pressed), right arrow key (when released),
up arrow key (when pressed), up arrow key (when released),
down arrow key (when pressed), down arrow key (when released)

View Replies View Related

Hangman 2 Player Game - User Cannot Guess More Than 6 Times

May 27, 2014

I am creating a hangman code. So the game i am creating is 2 player, first player enters the word and second player guesses. i made the code but i don't know how to restrict the first player from adding random characters into the secret word because for my project the word can only contain letters. so i need making the code so the player 1 can only enter letters.

My code is below:

/**
* Auto Generated Java Class.
*/
import java.util.Scanner;
public class Hangman {
public static void main(String[] args) {
Scanner input= new Scanner(System.in);
String player1,player2;
int wrongguessamount = 0; //keeps the count of the amount of wrong guesses
int correctguessamount = 0; //keeps count of the amount of correct guesses
int maxincorrect=6;//makes sure the user cant guess more than 6 times

[Code] .....

View Replies View Related

Sound Won't Play When Player Dies And A Game Over Screen Pops Up

Jan 14, 2014

I am making a game with java in a program called greenfoot.My problem is that a sound won't play when the player dies and a Game Over screen pops up..

- I have saved the audio file in my sound map of the scenario
- Applied the good name of the file
- tested the sound effect and it's working

this is my code:

public GameOver()
{
setImage(new GreenfootImage("GAME OVER", 100, Color.BLACK, null));
Greenfoot.playSound("fail-trombone-03.wav");
Greenfoot.stop();
}

View Replies View Related

Multi-Player Game With Multiple Worlds - Unhandled Packets

Sep 16, 2014

So I am trying to create a Multi-Player game in java, and I have a Game server and a Client. They normally connect with either but I would like to add a login server so that there can be an option to go to a different world then just the main one. It will have the same map and data but will be separate from the Players that are on world one per say. Now if you are on world two I would like it to have the option for you to be able to Private message players that are on World one. That is where the login server comes in to play.

I am still new at Java and would like to be able to understand Packets and how to handle them more clearly. So far I have gotten the basis of the login server connected to the server and the client connects to the server via the login server. But I am getting a bunch of "unhandled packets" and I would like to know how to handle them. Here are some bits of the code.

package com.ls.net;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelStateEvent;
import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;

[Code] ....

So when I run my client this pops up in the console:

[Tue Sep 16 16:50:56 EDT 2014][LoginServer]: Finished initializing login server.
[Tue Sep 16 16:50:56 EDT 2014][SignalMultiplexer]: Unhandled packet: 15
[Tue Sep 16 16:50:56 EDT 2014][SignalMultiplexer]: Unhandled packet: 41
[Tue Sep 16 16:50:56 EDT 2014][SignalMultiplexer]: Unhandled packet: 74

[Code] ....

And here are the class's for Accounts:

package com.ls.net.codec.decoder.packets;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.ChannelHandlerContext;
import com.ls.bufutils.BufferUtils;
import com.ls.net.codec.decoder.PacketDecoder;
import com.ls.net.codec.decoder.handlers.AccountHandler;

[Code] ....

View Replies View Related

Calculate Possible Tiles Clicked Unit Can Be Moved On And Display It To Player

May 15, 2014

Alright, so I'm having problems with lines 11 - 55. I'm trying to calculate the possible tiles the clicked unit can be moved on and display it to the player.

The field is a 9 (columns) by 5 (rows) grid. A unit with can move tiles horizontally or vertically based on its movement.

Example: (unit = o; possible tiles = x) (assuming movement of 2).

[ ][ ][ ][ ][x][ ][ ][ ][ ]
[ ][ ][ ][x][x][x][ ][ ][ ]
[ ][ ][x][x][o][x][x][ ][ ]
[ ][ ][ ][x][x][x][][ ][ ]
[ ][ ][ ][ ][x][ ][ ][ ][ ]

I tried to calculate movement by finding out what column the unit is in, subtracting the column it wants to go to, multiplying the difference by *-1 if the difference is less than 0. Then, doing the same with rows and adding the difference of columns to the difference of rows and comparing it to the unit's movement. Unfortunately, with my code, it seems to move in any directions.

@Override
public void mouseClicked(MouseEvent e) {
if (Main.cards.size() > 0) {
mainloop: for (int i = 0; i < Main.cards.size(); i++) {
Card c = (Card) Main.cards.get(i);
int startingColumn = 0;

[Code] ......

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved