Jesse Matty

Ranch Hand
+ Follow
since Feb 09, 2017
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jesse Matty

Hello I'm Finishing up my  java music player that is also a portfolio  project and  I wondered how I  can read from an audio CD in java. The java file class can read the file  data and send it to ffmpeg via opencv for java  and then write to the source data line for playing , unless the user skips songs too fast or tries to seek them. Then the  song refuses to play (due to buffer under runs I believe; it throws ffmpeg frame grabber execeptions) and it just keeps skipping tracks. File input stream was slightly better  but it  faced other problems and still had seeking problems. My latest idea was to cache the file on to the hard disk and  then play it. But not one of the four  file copy methods  I tried, Java Copy File – Stream, Java Copy File – java.nio.channels.FileChannel, Java Copy File – Apache Commons IO FileUtils, Java Copy File – Files class  was able to copy 100% of the file 100% of the time. They mostly transferred about 50-60% of it and then quit.  So how does one read from a CD in java? I'm running OSX 10.12 and all of the audio files appear up as AIFF files . I  would like to be able to have this work  for all major desktop platforms (OSX Windows, Linux) though.
5 years ago
What is the correct way to add items to an  javaFX ObservableList via another thread that is not a javaFX worker thread?

I have  it working by creating a new ArrayList in the wait thread and adding the the returned results to that and to then adding them to observable list via Platform.runLater();
like this
 
I update the observablelist like this






5 years ago
I tried to do this for a game I was making and then  gave up. No need to reinvent the wheel there are already algorithms out their that do this. .  But if you want to  code this yourself look up A-star pathfinding algorithm tutorials. They will be of massive help.
5 years ago
I'm working on  the level editor for my RPG, Say I have abstract class called Weapon for an RPG  I'm making. There are others for things like Armor,  Rings,  Enemies ECT.   Is possible to  have a java program create and compile at run time  a new  Java Class for  a weapon armor or other concrete class derived from a abstract class or classes? I would like  to have  a GUI Interface with Text Boxes  to change  the fields  and write code for the abstract methods.  That would make  it  so  myself or others can easily  create  custom game elements.  Is this possible? and if so what would be the best way of doing it?
6 years ago
sorry you would be right it does clip my if statement had a single equal in it. there fore my clipping code was never executed
6 years ago
setClip alas does not clip the pane to the bounds of the rectangle
6 years ago
thank you!! that was the  answer I was looking for I did not know pane had a set clip function
6 years ago

Daniel Demesmaecker wrote:you can put a imageview in a pane. I don't understand why you wouldn't use a imageview. I guess you could set the image as background of the pane, make the rectangle, set the background to transparrent and add it to the pane.



there is no image I am drawing shapes on to  a pane lines and ellipses to be exact with some text   to mimic the fretboard of a  guitar . The program will draw various dots on a drawn image  of the  fret board of a guitar that shows the chord shapes for the selected chord based on number of strings tuning etc.  I cannot use image view because there is no image.  Now , if  you know how to make an image view from a pane  I'm all ears.  then it would be easy to set the view port.
6 years ago
I know how make a  view port  for  an image view of an image what I want to know is how to  make the equivalent of a view port for a PANE   that I have drawn shapes to    not an image view .  And I  don't think you can make an image view of a pane can you?
6 years ago
Is there anyway to  only show a predefined  rectangular section of a Pane, similar to a viewport  for a javafx ImageView of an Image?
6 years ago
this sounds like homework  but a recurisve  method is one that calls itself repeatedly to solve a problem    until the exit condition  is met (or a stack overflow error occurs). What parts of  these problems  are you having problems with?
6 years ago
my problem was that has been solved  is  that I thought that java would call the most specific for the given object created with the right  handed assignment   I realize now that is not  the case and that java looks at the left handed assignment  when choosing which method to call.   Knowing this I have rewritten my code and the problem has been solved.

Thanks for the information.
7 years ago

David Simkulette wrote:

Campbell Ritchie wrote:
The compiler has to bind an argument to the method call in line 30. Can it bind a bus or a car? Can it tell in advance which to bind?




If no exact match is found, then it will try to match based on the hierarchy of l-hand types. So if there is no method which takes Water and Water extends an Item it will invoke the method that takes an Item and treat it like an Item (unless you cast it). Why? Because :





That is correct but  you cannot pass an Object declared as the parent class  to a method that requires a child class even if the right hand side is the child object with out first casting.
7 years ago




My question is simple say I have   apple, water, sword or some other Item declared as a type Item how to I get the correct overloaded method to be called based on whether it is  an Item Food or Water?  Would making another subclass that extends Items for all non food and non water items do the trick?

7 years ago
I have tried   declaring  the food  object  instances  as



but no matter how  I declare them only the removeItems ( Items item, double amount)  and addItems (Items item, double amount) methods are ever called NOT the ones that take  a Food object.
7 years ago