Swing/AWT/SWT :: Continuous Audio Data Stream Not Working
Oct 15, 2014
I am trying to make my audio loop and i tried the code below
public void audioloop() {
AudioPlayer MGP = AudioPlayer.player;
AudioStream BGM;
AudioData MD;
ContinuousAudioDataStream loop = null;
try {
[Code] ....
But is not working. I was thinking may be API is not work with java 7 because i got the following warning (AudioStream is internal proprietary API and may be removed in a future release);
View Replies
ADVERTISEMENT
Jan 18, 2015
package timerApp;
import java.util.Scanner;
import java.util.Timer;
import java.util.TimerTask;
import sun.audio.*;
import java.io.*;
public class timerDriver
{
static int interval;
[Code]...
So I'm trying to make a program that plays an mp3 file after a timer reaches 0, but i keep receiving the error "could not create audio stream from input stream" the audio file is 3.44 MB and 00:03:45 minutes long if that's a problem
View Replies
View Related
Jan 27, 2015
Just run the following code and move the mouse next to the text of the button and you will see exactly what I am talking about. Any way to prevent this continuous flash?
import java.awt.Dimension;
import javax.swing.JButton;
public class GUI {
public static void main (String[] args) {
javax.swing.JFrame frame = new javax.swing.JFrame();
javax.swing.JPanel panel = new javax.swing.JPanel();
[Code] .....
View Replies
View Related
Nov 23, 2014
I wanted to know some hints on where to begin if I wanted to create a program which compares an audio file with real time captured audio. I found this website "[URL]...", but I think this would not do the job, so what are the basics of audio in java and how to compare audio files and see if they are compatible.
View Replies
View Related
Aug 3, 2014
I mean i need to access to two txt file at the same time so i did this in method:
DataInputStream din= new DataInputStream(FileInputStream("vip.txt"));
DataInputStream din2= new DataInputStream(FileInputStream("corporate.txt"));
But there are errors when i compile and they pointing to these two lines.
View Replies
View Related
Jul 26, 2014
I am going to to develop an app for my final year project. basically the app is to show live video streaming on android phone from remote CCTV . The project is just in design phase i know the networking part i.e static ip for dvr etc but i dnt know how to get stream of data from dvr and how to control the CCTV camera i.e camera movement....
View Replies
View Related
May 8, 2015
I a simple server that receives bytes using TCP and then saves them to a file stream.Through many tests I have seen that the first packet received is always just the filename with no other data. The second packet received only has one byte and it is the first letter of the input text file. After this all packets are sent correctly, but I can't seem to figure out what is messing up the second packet. It also appears that the last packet is written twice.
Here is an example Input/Output: [URL] .....
InputStream in = clntSock.getInputStream(); //server's input stream - gets data from the client
OutputStream out = clntSock.getOutputStream(); //server's output stream - server sends data to the client
byte[] byteBuffer = new byte[BUFSIZE];
int count = in.read(byteBuffer, 0, BUFSIZE);
String firstRead = new String(byteBuffer, 0, count);
[Code] ....
Another peculiarity to me is that the second to last packet is always just "-" and then the last packet has the remainder of the magic string which terminates the file output stream.
I am aware that it is not safe to make the assumption that the file name will be sent in one go before the loop, but I wil fix that later. I am not concerned about it at all now. THe problem si that the loop should account for any amount read in, but for some reason the first packet always contains one letter, and the second packet picks up around 16000 bytes later for some reason. Why would this be?I can't edit my above post so here is the code with code tags.
InputStream in = clntSock.getInputStream(); //server's input stream - gets data from the client
OutputStream out = clntSock.getOutputStream(); //server's output stream - server sends data to the client
byte[] byteBuffer = new byte[BUFSIZE];
int count = in.read(byteBuffer, 0, BUFSIZE);
String firstRead = new String(byteBuffer, 0, count);
[Code] ....
View Replies
View Related
Jan 25, 2014
Iam trying to upload jpeg image.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
[Code] ....
In servlet the below code
DataInputStream din = new DataInputStream(request.getInputStream());
byte[] data = new byte[0];
byte[] buffer = new byte[50];
int bytesRead;
while ((bytesRead = din.read(buffer)) > 0 ) {
byte[] nData = new byte[data.length + bytesRead];
System.arraycopy(data, 0, nData, 0, data.length);
System.arraycopy(buffer, 0, nData, data.length, bytesRead);
data = newData;
}
What i see is servletinput stream does't have any values.It does't even enter while loop.
View Replies
View Related
Jul 15, 2014
I am subclassing a Pane to be able to use my custom NGRegion:
public class MyPane extends Pane {
@Override
public NGNode impl_createPeer() {
return new MyNGRegion();
}
}
in MyNGRegion i override renderContent(Graphics g) for custom drawing
@Override
protected void renderContent(Graphics g) {
/* custom drawing */
}
The custom NGRegion gets drawn one time, but i want to continuously draw on every pulse.
i already tried a lot of things, but don't see how to do it properly:
using -Dprism.forcerepaint=true did not work.
overriding clearDirty() and set it
View Replies
View Related
Aug 31, 2014
I'm trying to get a primefaces data list working and not sure I'm doing this correctly, having a problem with getting this view to display. Here is my xhtml .
<f:view>
<p:scrollPanel id="cclist" header="CCList" styleClass="cc-log">
<p:dataList value="contactController.contacts" var="contact" type="ordered">
<f:facet name="header">
Call List
</f:facet>
#{contact.firstName}, #{contact.lastName}
</p:dataList>
</p:scrollPanel>
</f:view>
[code]....
View Replies
View Related
Jan 22, 2014
We created one web application which runs on tomcat 7.0.35 using spring mvc 3.0 . Its working perfectly on 32-bit windows machine in IE 8 on Windows 7 OS, when we tried to run this on 64-bit windows 2008 Server, jquery is not working. Also I populate data from Pop-up JSP to parent JSP, and it works 3/10 times only and does not work always.
We used the following jquery plugins in our project
jquery 1.8.3
jquery.ui.custom.1.9.2
jquery.ui.custom.min-1.9.
View Replies
View Related
Feb 14, 2014
I'm trying to get a progress bar to work on my GUI.
This is what I have so far, the parameters are taken from another class that takes in an image in packets from a Raspberry Pi and stores them to a file on PC.
public void ImageInfoReceivedHandler(int sizeOfFile) {
progressBar.setMinimum(0);
progressBar.setMaximum(sizeOfFile);
progressBar.setIndeterminate(false);
[Code] .....
The println are printing out the correct values and they are being implemented in the methods, but nothing is happening in the GUI.
I have a thread setup in the GUI when a button is pressed
getImageButton.setText("Timer Started");
transmit = new transferImage(port);
lblImgProcess.setText("Getting Image, Please Wait");
transferThread = new Thread(transmit);
transferThread.start();
So the thread starts and image is then transmitted, does the progress bar need to be in that event handler?
View Replies
View Related
Mar 26, 2014
setDefaultLookAndFeel is not working as i'm expecting.this is my code: URL....
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
import javax.swing.text.*;
import java.io.*;
import java.text.*;
[code]....
after reading the oracle tutorial on how to make frames and reading FrameDemo2.java. URL....i thought setDefaultLookAndFeelDecorated(true); would give me a different decoration than the default windows 7 border.but toggling between true and false changes nothing, and changing setUndecorated does nothing either.what am i supposed to do to make it look like the one in theFrameDemo2 window?
View Replies
View Related
Mar 5, 2014
I was suspecting I had a jButton not working, so I added a console print to test. See below. When I click the button, the console doesn't display anything. Am I using the button wrong?
private void jButtonUpdateItemsMouseClicked(java.awt.event.MouseEvent evt) {
System.out.println("click");
System.out.println(drawPreviousRectangle);//this is a boolean
}
I have also tried the following with the same results (or lack of).
private void jButtonUpdateMajorDeckItemsActionPerformed(java.awt.event.ActionEvent evt) {
System.out.println("click");
System.out.println(drawPreviousRectangle);//this is a boolean
}
View Replies
View Related
Mar 11, 2014
I am trying to get a scrollPane working correctly, but not having any luck. The picture drawn in the center panel is quite large and goes off the screen. I visited URL... but I am missing something vital. Both tracks show, but there is no knob to do the scrolling.
public DViewer() {
super();
frame = new JFrame();
frame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
[code]....
View Replies
View Related
Sep 6, 2014
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
class Stock extends JFrame implements ActionListener
[code]....
well everything seems to be working fine only the scroll pane is not working.
View Replies
View Related
Feb 27, 2015
The class does get compiled but the submit button doesn't work?
/**
* Orchestration class for Account
*/
import java.awt.*; //Importing the java.awt.* class
import java.awt.event.*;//Importing the java.awt.event.* class
import javax.swing.*;//Importing the javax.swing. class
public class AccountDemo extends JFrame
{
/// initializes the variables in the container
[Code] ....
View Replies
View Related
May 4, 2014
I'm trying to make a simple window that displays 5 text fields on x number of rows, depending on what I set x to. Attempting to do this with GridBag Layout but I can't seem to get a new row started. The closest I can get is to repeat the same fields on the same row. I'm trying to modify the row by putting the code in a loop and setting gridy = i, that way each iteration should place the code lower than the first. I'm new with GridBagLayout so I'm probably missing something simple. The constructor with the loop is below. I've commented out code that doesn't seem to work but left the gridx and gridy.
public PAMCalculator()
{
setTitle("PAM Calculator");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(WIDTH, HEIGHT);
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints gridConstraints = new GridBagConstraints();
setLayout(gridbag);
[code]....
View Replies
View Related
Jan 16, 2015
I'm trying to make a simple program that will feature some graphics. It will have a JCombobox that the user selects to draw various shapes. I can't get the repaint function to work however.
package selectingshapes;
import java.awt.Graphics;
import java.awt.Color;
import javax.swing.JPanel;
import java.awt.Graphics2D;
[Code] .....
View Replies
View Related
Oct 31, 2014
I am adding a JTextArea to my JPanel with this code:
commentTextArea.setLineWrap(true);
commentTextArea.setWrapStyleWord(true);
commentTextArea.setVisible(true);
this.add(commentTextArea);
commentTextArea.setBounds(0, 0, 100, 100);
//commentTextArea.setLocation(0, 0);
Whenever I use setLocation(0,0), the JTextArea never moves. It is always in the top middle of the screen, not at (0,0). The same goes for setBounds(0,0,100,100) BUT the height and width are set this way, just not the location. Why is this?
Full Code
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
[Code] .....
View Replies
View Related
Sep 5, 2014
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
class Stock extends JFrame implements ActionListener
[Code] ....
Everything is fine but the scroll pane is not working!
View Replies
View Related
Apr 4, 2014
I have written a drum machine using Java. Into said drum machine I list all 47 available MIDI drums. The instrument list is placed into a JPanel, along with a gridArray of checkboxes. The JPanel is then in turn added to a scrollpane. I have listed the MIDI drums in order of 'ground-up'. For example, the bass drum is generally at the bottom of most drum kits, so it is at the bottom of my MIDI drums list. Next up would be the snare, followed by the cymbals, and then by all the specialty percussives. Since most beats are started from the 'ground-up', laying to foundation, so to speak, I want the scroll bar of the scrollpane which houses the JPanel, which in turn houses the instrument list and the beat checkboxes, to be positioned, upon opening, at the bottom of the scroll pane. Nothing I have tried works. It always positions the slider somewhere in the middle of the scroll track. Below is a listing of just the buildGUI portion of the code, all the MIDI functionality has been removed to keep the size of the post to this forum down.
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class BeatBoxG
{
JFrame overallOuterFrame;
JScrollPane namesAndSquares;
[code]....
View Replies
View Related
Sep 5, 2014
Why the JFrame is not working
// Project: RestaurantBillCalculator.java Calculates a table's bill.
// Import statements for different classes
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
public class RestaurantBillCalculator extends JFrame
[Code] ....
View Replies
View Related
Oct 6, 2014
I made an Analog Clock and its working but when a remove the filloval (Background) the seconds hand keep repeating itself..here is the code
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import javax.swing.JFrame;
import javax.swing.JPanel;
[code]....
View Replies
View Related
Oct 11, 2014
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?
}
There is the method and my JButton.
View Replies
View Related
Nov 19, 2014
I am getting the following message when trying to print a JTable.
"Java(TM) platform SE binary has stopped working"
Here is the code:
try {
MessageFormat headerFormat = new MessageFormat("Page {0}");
MessageFormat footerFormat = new MessageFormat("- {0} -");
table.print(JTable.PrintMode.FIT_WIDTH, headerFormat, footerFormat);
} catch (java.awt.print.PrinterException pe) {
System.err.println("Error printing: " + pe.getMessage());
}
View Replies
View Related