32,199 Topics
| |
How do i pass file name ("chosenFileName") from sample2 class to sample1 class? An example would be nice. here's some code from sample 2 class - private void openFile( ) { JFileChooser chooser; int status; chooser = new JFileChooser( ); status = chooser.showOpenDialog(null); if (status == JFileChooser.APPROVE_OPTION) readSource(chooser.getSelectedFile()); else JOptionPane.showMessageDialog(null, … | |
I have two textfields which are formatted for dates, i want to retrieve data from the database within a period of days which the two textfields stand for the "from" and "to" dates.Can anybody help me out? select distinct courseId,courseName,description,Date,amount from course where date>='2013/05/11' and date<='2013/05/11' for the SQL queries … | |
Let me start by saying I'm a noob. I want to get input from a text file through gui and perform some actions.the last time I did it I used command line argument to pass file name to get file input. The code in quote. It works when I uncomment … | |
I am trying to create breakout game like this below. http://www.2dplay.com/break-out/break-out-play.htm I like how when balls bounces on paddle you have control over where it is goings. i need help creating some thing like this //this is my code for when ball touch the paddle(player). i have divide the paddle … | |
Hi, I'm working on an assignment for programming class where we're supposed to create a method that takes the contents from a text file (one giant string) and stores them piece by piece in a linked list. I'm a little stuck and not sure where to go from here, or … | |
When I was going through a program of my friends, suddenly I came across a strange for loop, I was wondering about the for loop since then, the loop looked like this for(1=0,ii=result.length;i<ii;i++) Is this for loop a valid for loop? Can any one please help me? | |
package com.example.crypton; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.Contacts; import android.provider.Contacts.People; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.Data; import android.telephony.SmsManager; import android.util.Log; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import android.app.PendingIntent; public class CREATEMESSAGE extends … | |
Hello, I trying to create a **messenger**(just for practice, so nothing fancy!). I created the server and client programs. Suppose a client(user A) initiated a connection with the server, so it's online. Now, another user(user B) wants to chat with that user(A). How do I give User B the IP … | |
Hello, I'm having a bit of trouble with this error. The error seems to be wih setRented but I'm not really sure what to change. This is my interface public interface Rentable{ double getRent(); void setRent (double rent); boolean isRented(); void setRented (boolean rented); } This is my abstract class … | |
**give me source code if anyone can** | |
Hi, I am currently working on project wherein I am inserting thousands of records in database using spring batch. So is there any way where I can handle exceptions in my ItemReader and ItemWriter? I need to apply logic for failure of records when job executes i.e if I am … | |
write in java language,to find the maximum,minimum andmean value of asset of floating point numbers to be supplied by the programmer user | |
there are no visible error in the syntax but when i run the application i keep getting the following error. i have been trying to fix it for hours and simply cant find the problem. the error that appears when running is; Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.JComboBox.setModel(JComboBox.java:292) at … | |
My programs objective is to mkdir and ope dir. if I ever get it jarred up I would like to run it from a jump drive. [code] public static final String USERHOMEDIR = System.getProperty("user.home", "."); [/code] clearly this code will not be valid any more. Could this USERHOMEDIR be replaced … | |
I'm working on a Grade Point Average Calculator. The user just have to Select the number of courses offered, then select the grade obtain in the different courses by choosing the appropriate grade from the Choice Box. The problem with my application is that, if the user mistakenly selects "A" … | |
hi, how can I make the size of the array is equal to the number of elements in the array | |
Could anyone help me in understanding what does below Python code do? Also please help me in converting it into Java. import random howMany = random.randint(0,1000) stats = {} for i in range(howMany): value = random.randint(0,500) stats.setdefault(value,0) stats[value]+=1 for item in stats: if stats[item] > 1: print item | |
Asalam U alikum I want to learn Java programming I have installed the jdk7 on my machine and i want to set the environment variables as it shows me that javac is not the internel or externel command.So can anybody help me | |
Hello , I have a List<String> and I want to compare in a loop the elements. For example sth like : for (int i=0;i<theList.size();i++){ while (theList.get(i).equals(theList.get(i+1))) ... } I want to compare the next to the previous entry. Thanks | |
Why Java is platform independent? And how to set path in Java? | |
Hi everyone , i hope someone helps me out. im working my way up step by step learning Java . but no one at the University is helping , they just give us the homework and we have to learn alone.and give the soltution at the end of the week. … | |
Hello. Im new here. I have a question: I have this copy constructor here: /** Copy Constructor. * Since landscape is immutable in the scope of our project, you could * do a simple reference copy for it. * However, Fish and Plants are mutable, so those lists must be … | |
Hello Ive come up with a stupid question that just needs a why What would this do? for (int i=5; i<2;i++) { System.out.println("What?"); } System.out.println("Who?"); | |
Hi...! I'm Working on a Notepad project and i'm in menu->view->font but i don't have any idea how to write a function for it! can anyone help me?! thanks... | |
i have a enemy and spriteanimation classes. in Enemy class i have bufferedimage array with 4 different images. than i am creating a animation and storing in 'animationEnemyHit' variable. than i am starting and updateing the animation in method. the problem is that it keeps on loop for ever. i … | |
Hello This is a demo showing Java interacting with Daniweb's new API ( http://www.daniweb.com/api/documentation ) You introduce a member's name and it should show you the total number of posts he has made. Demo is a proof of concept: No bug checking, error checking, etc is in this code. In … | |
import java.util.Random; import java.util.Scanner; public class RandomDeck { String suit[] ={"Diamonds" , "hearts" , "spades" , "clubs"}; String face[] = {"A" , "Two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" , "ten" , "jack" , "queen" , "king"}; String cards[] = new String[52]; … | |
hello i am working on a simple panting project that allow the user to select a shap from ComboBox then draw it on the panel but problem is when is choose any type of shapes and drawing it on panel no shape appear on the panel ?! here is my … | |
1. Given a length of wire P units long, where P is an integer, it is possible in some cases to bend the wire into an isosceles triangle(with two sides equal) where the lengths of all the sides are also integers. For example a wire of length P = 3 … | |
I once did a project in a class that connected to a mySQL database, but now I'm using the jGRASP ide on a mac and the class files won't compile properly. In the project we added the files: Connection.class, ResultSet.class, Sql.class, and Statement.class to the directory (assuming it's the middleware). … |
The End.