Win a copy of Rust Web Development this week in the Other Languages forum!

sampath surineni

Greenhorn
+ Follow
since Apr 02, 2012
sampath likes ...
Android Chrome Ubuntu
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sampath surineni

Keith Lynn wrote:Have you tried printing out something at the beginning of actionPerformed to see if it may be getting there?


But its working first time.Do I have to put it in any loop?
8 years ago

Keith Lynn wrote:Can you elaborate on what happens when you click the second time?


The second time I press the button nothing is happening
8 years ago

Unnar Björnsson wrote:Remember the (==) comparison is object comparison, it checks if the objects on both sides of the == signs are the same.
The .equals() method compares the string value of the string objects, which is what you want to compare.


Thank you,can you help me out with my main problem?
8 years ago

Jesper de Jong wrote:Use .equals() instead of == to compare strings:


See:
AvoidTheEqualityOperator
Difference between == and .equals



Thank you very much for the suggestion. Can you help me out with my main problem also?
8 years ago
Hi I am coding an alarm application.
I use a JButton to set the alarm. I use the same JButton to warn the user about choosing any file other than an "mp3" file for alarm ringer. But the button works only once.
Here is the code


But I want the button to work as many times as user selects a file other than an mp3 file. Can somebody please help me with this
8 years ago

Stevens Miller wrote:How long are you waiting? Looks like your code calls check if the alarm is in the future (which means you have to wait until the alarm time passes), or it adds a day to the alarm time and then calls check. Unless your alarm time starts more than a day in the past, either situation will have you waiting in check. Since your makeReady method creates a Calendar object with getInstance, and only sets the hour, minute, and second, the alarm time is always set for the current day, so you are always going to end up either waiting for that time today, or waiting for that time tomorrow.

Note that your while loop is totally compute-bound while it waits. That is, at line 54, the loop is going to run over and over, using up as much of your CPU as it can get, until the alarm time comes. That's probably not the approach you want to use.



Hi Mr. Stevens Miller. Yes my code calls check if alarm time is for future. I wait till it is the time set by the user. I changed the while statement with advice from other programmers it is now


But it still didn't solve my problem
Hi

I'm working on an alarm application. I'm using SwingUtilities.invokeLater method to call my UI for snooze function. But when I run it I noticed that SwingUtilities.invokeLater function is not being called. Please help me with this problem

Tony Docherty wrote:If you already have a JFrame displaying your clock you shouldn't be creating new JFrame for your snooze panel, you should be using a JDialog.
Your classes shouldn't extend Thread, they should implement Runnable.
You should call Swing methods like setVisible() on the Event Dispatch Thread.



But Mr.Tony Docherty I was coding this app taking asource code as an example. They did the same thing and it is working there. I tried using runnable but the result is same. I didn't understand what you said by calling Swing methods like setVisible() on the Event Dispatch Thread. But there is a set visible method call in my constructor.

Sorry if I'm being foolish. I'm a beginner and thank you for reply
9 years ago
Hi I'm coding an alarm application.
I have a snooze class which gets called when the alarm sounds. It used to work fine before using JMF.But after using JMF I see only the outer frame of my snooze UI.

I tried starting a new thread for the class but got the same result. I'm pasting here code of the classes in which I think the problem is in.

Please help me solve the problem.

IsTime class. Which checks whether it is the time to sound alarm.


Media class which plays song when it is time


Snooze class where the real problem is
9 years ago
In java defining method inside a method is not allowed. You might not have known but main is also a method.
about compiler giving error about you declaring method before and after it verify whether the method declaration is inside the class. Use an IDE so that you can instantly know what mistakes you are doing by reading the errors.

ALL THE BEST
9 years ago

Darryl Burke wrote:This tutorial page is about images, not sound files, but the principle remains the same:
Loading Images Using getResource



Thank you very much Mr.Burke you solved my problem
9 years ago

Jan Hoppmann wrote:

sampath surineni wrote:Thanks for the reply Mr.Winston. I'm new to coding and I don't know in which folder of my project I have to include it. I'm using netbeans and there are src and libraries folders. should I include it in one of these of create a new one.
Even if I include it in one of these folders what would be its address to access.



I always put resources such as sound files or images into a resource folder named 'resources'.



Thank you very much Mr.Jan Hoppmann. You cleared my doubt. Can you tell me how to address them in the project. what is the path of them
9 years ago

Winston Gutkowski wrote:

sampath surineni wrote:I am coding an alarm application for the first time. I want to include a default tone for my application in case user did not choose a custom tone...


So you already have code to play custom tones then, yes? Just choose one of them. Alternatively, there are plenty of .wav libraries around. Download one and include it in your jar.

Google is your friend.

Winston



Thanks for the reply Mr.Winston. I'm new to coding and I don't know in which folder of my project I have to include it. I'm using netbeans and there are src and libraries folders. should I include it in one of these of create a new one.
Even if I include it in one of these folders what would be its address to access.
9 years ago
Hi Friends.

I am coding an alarm application for the first time. I want to include a default tone for my application in case user did not choose a custom tone.

Please can someone tell me how to do this.

Thank you..
9 years ago
Thanks for your advice. I will take care next time
9 years ago