36,051 Topics

Member Avatar for
Member Avatar for johnlop1

How do I write an event listener that displays an image when I click the upload button? so far i have [CODE] jButton1 = new javax.swing.JButton(); jButton1.setText("Upload"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });[/CODE] and then [CODE]//the LOAD button for loading the file private void jButton1ActionPerformed(java.awt.event.ActionEvent …

Member Avatar for Ezzaral
0
114
Member Avatar for plasticfood

[CODE] String[] names = new String[namesListSet.size()]; int[] nums = new int[namestimesSet.size()]; namesListSet.toArray(names); [B]namestimesSet.toArray(nums);[/B] for (String s : names) { System.out.print(s); } [/CODE] i'm getting an error on the bold part. getting symbol not found.

Member Avatar for plasticfood
0
82
Member Avatar for DoEds

[CODE]String[] myArray = {"Player 30","Player2 35"};[/CODE] This statement [CODE]Arrays.sort(scoreArray);[/CODE] will sort myArray by Letters. Output: [CODE]aPlayer 30 bPlayer 35[/CODE] Problem: Is there a way to sort myArray by numbers from highest to lowest? The output should be: [CODE]bPlayer 35 aPlayer 30[/CODE] I even tried foolish things like. [CODE]String[] myArray = …

Member Avatar for JamesCherrill
0
128
Member Avatar for sirlink99

The [COLOR="Red"]red[/COLOR] is where the problem is: Thanks for the help. [code] // The "ChoseYourStory" class. import java.awt.*; import hsa.Console; public class ChoseYourStory { static Console c; // The output console public static void main (String[] args) { c = new Console (); int move; String start = ("yes"); int …

Member Avatar for JamesCherrill
0
159
Member Avatar for gedas

can somebody tell me what this code actually does? [CODE] int i = 0; while (i < -1) { double x = xCoordinates[i]; double y = yCoordinates[i]; long xx = getWidth() - Math.round((double) getWidth() * x / 1024.0); long yy = getHeight()- Math.round((double) getHeight() * y / 768.0); g2.translate(xx, yy); …

Member Avatar for gedas
0
92
Member Avatar for churva_churva

Can someone teach me or guide me using GUI..or can some one help how to understand right away the GUI..and please give the link which can help me to learn more about GUI..

Member Avatar for Ezzaral
0
145
Member Avatar for rcogq7

//This is the error that i have Exception in thread "main" java.lang.NullPointerException //at CardTest.main(CardTest.java:16) /** * @(#)CardTest.java * * * @Robert Coughlin * @version 1.00 2010/10/15 */ //this is the main public class CardTest { public static void main(String [] args) { Card [] randomCard=new Card[20]; for(int i= 0; i<20; …

Member Avatar for kramerd
0
234
Member Avatar for DoEds

I have this txt file containing names and scores. "[COLOR="red"]ex. Player1 35[/COLOR]". My program able to read it and store it to an Array of String. Here's my question. Is possible to separate the name and the score and store them in different Arrays? [CODE]ex. myArray = {"Player1 35","Player2 30"};[/CODE] …

Member Avatar for DoEds
0
108
Member Avatar for DARK_BYTE

Hi I have a project in which I have to build an algorithm visualization tool. Up until now I have been going in a static direction thinking of having in built menus that allowed a user to create an animation of a sorting algorithms but now my tutor wants me …

Member Avatar for JamesCherrill
0
154
Member Avatar for Yutxz

Why is my while statement being ignored? [B]Problem:[/B] Write a method called squareRoot that takes a double as a parameter and that returns an approximation of the square root of the parameter, using this algorithm. You may not use the built-in method Math.sqrt. As your initial guess, you should use …

Member Avatar for masijade
0
260
Member Avatar for ubi_ct83
Member Avatar for AndreRet
0
80
Member Avatar for vskumar19

Hii all, Using Scanner class I am accepting an input string which serves as a password field Is it possible to mask the field while the input is being given ?? eg: This is how my output will be : Username : abcde1 Password : abcd@xyz This inputs are given …

Member Avatar for masijade
0
185
Member Avatar for peter_budo

Would be possible to create "generic" sub-forum in Databases where we can place any db related stuff which doesn't fit into any of our present options?(MySQL, MS SQL, Oracle, MS Access and FileMaker Pro, Database Desing) Having something similar to Software Development sub-forum Legacy and Other Languages. Reason: Often there …

Member Avatar for peter_budo
0
363
Member Avatar for elcliff

Write a java program that calculates the grade point average of three course and their credit hours through, if the grade points and credit hours are as follows: COURSE/SUBJECT GRADE GRADEPOINT CREDIT HOURS Maths A 4.0 3 English composition B 3.0 2 French B+ 3.3 3 Now, if the grade …

Member Avatar for peter_budo
0
73
Member Avatar for cowtippa

Im writing a program that will instatiate an object from another object but I have no idea how to get it to work. Here is my main code [code] public class testPurse { public static void main(String[] args) { Purse p1 = new Purse(); System.out.println(p1); p1.insert(3,0,2,1); System.out.println(p1); p1.insert(3,1,1,3); System.out.println(p1); p1.remove(3,1,0,2); …

Member Avatar for masijade
0
79
Member Avatar for raghujosh

Can somebody pls explain me this error that I am getting when I try to run my web application on Tomcat. java.lang.NullPointerException business.Cart.addItem(Cart.java:27) cart.CartServlet.doGet(CartServlet.java:49) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) The code for the Cart.java is [CODE]package business; import java.io.Serializable; import java.util.ArrayList; public class Cart implements Serializable { private ArrayList<LineItem> items; public Cart() { …

Member Avatar for masijade
0
80
Member Avatar for hollybells

here is code for my assignment. I am getting: Exception in thread "main" java.lang.NullPointerException at SortedStringList.insert(SortedStringList.java:33) at TestSortedStringList.main(TestSortedStringList.java:6) Line 33 is the "while" loop in my insert. Its supposed to be a double linked list of nodes w/string in each node, alphabetically arranged. here is the code: public class SortedStringList …

0
76
Member Avatar for plasticfood

[CODE] String names1 = ""; System.out.println("enter names: "); names1 = kb.next(); while (names1 != "stop") { System.out.println("enter names: "); names1 = kb.next(); namesList.add(names1); } [/CODE] everytime i type "stop," the program keeps running...

Member Avatar for plasticfood
0
64
Member Avatar for samuel17

Hi all, Im having issues with this program. I've looked online and seen others that have basically the same program but have issues also. My issue is a compiling error, thats one problem thats obvious to me. This program is suppose to get the user to enter grades for five …

Member Avatar for Akill10
0
183
Member Avatar for sciprog1

Hello Members, Does BlueJ support Networking? Can you have the main() of Client.java and Server.java running at same time? I always get this "Your program is running.You cannot start another execution......". Any help would be greatly appreciated. Thank you!! sciprog1

Member Avatar for sciprog1
0
122
Member Avatar for sirlink99

[code] c = new Console (); int lvl = 1; double exp = 0; int x = 1; double monsterhp; int monslvl = 1; int a = 1; while (a == 1) { int lvlup = 10 + (lvl * 40); if (exp >= lvlup) { lvl = lvl + …

Member Avatar for sirlink99
0
328
Member Avatar for nipacayaljon

i want to disable the NO and CANCEL option , can you guys help me because im only a begineer of JOPTION here is ma code: btw this is my assignment in my 1st year college "compro" my teacher tell us to create a program , and my system is …

Member Avatar for cale.macdonald
0
2K
Member Avatar for Blitze

Hello, I am in Object Oriented Design for C++ at the moment... The test we are having has a question on it and the professor wants us to find and know the answer before we come in for the test. The question is this: The following code out puts what …

Member Avatar for Blitze
0
134
Member Avatar for simransuri

Hey!I have to make a Quiz game using arrays in java...Now,i have to create a random function such that the questions appear randomly n without any repetition?plz help... Here's the code: [code]import java.util.*; public class KBC { String questions[]; String options[][]; int answers[]; long money[]; int history[]; public KBC() { …

Member Avatar for masijade
0
173
Member Avatar for FNHA

I'm doing an assignment for a Data Structures class, and I'm supposed to to implement a binary search tree with a client side method to create the tree. I've gotten most of it running I think, based on some debugging lines I added to track which part of the code …

0
71
Member Avatar for compe_dsd

Hi! I'm making a code right now but I don't know how to continue.....my problem is that I have to make an online shopping list...first, data will be shown to the viewer or buyer...i've done that already. next the buyer should enter the itemID then the number of pieces of …

Member Avatar for kramerd
0
572
Member Avatar for tobyana15

Hi! I am newbie in java program. All I want is to have a method that check the filename of the file that I want to upload, if it is correct given filename convention.

0
44
Member Avatar for priteshdesai

I have created a Java program which scans a given folder and creates a .txt with a list of names of all the files in that folder. I want to create a table on MYSQL server on a website and fill it with the names of the files given in …

0
64
Member Avatar for jems5

I need to sort a text file that has text, whole integers and float integers. The code I have thus far is able to take the data and perform required calculations. Next I need help with sorting by last name and outputting data in a table. I was successful in …

Member Avatar for cale.macdonald
0
143
Member Avatar for jemimaloh

Hey there, Here's a snippet of my code. 1)I am trying to assign the value "[COLOR="Red"](votes + " : " + Str2)[/COLOR]" as an element of the String[] Results at the end of my for loop. So at the end of every loop, there is a new entry made to …

Member Avatar for mmusehani
0
134
Member Avatar for sciprog1

Hello Members, I have two classes(A and B) which extend from a JPanel. These two JPanels are then added to a JFrame in a third class. I would like the program to be such that when I click a certain button in A, A becomes invisible and B becomes visible …

Member Avatar for sciprog1
0
102
Member Avatar for sirdoris

Hi all, I'm really having trouble with this been going in circles for days some fresh insight would really help. Basic idea - is i have n nodes that have m ports that connect by links to other nodes each port has 1 link to an adjacent node. my idea …

0
37
Member Avatar for Fulsomenko

Hey guys, new to the forum. So sorry if i am posting this in the wrong location. To my question: I am trying to create a random password generator, and I think it's done is this way. I have made four arrays, two for the alphabet (capital letters and not), …

Member Avatar for peter_budo
0
248
Member Avatar for kvass

Hey guys I'm working on a program that asks the user to enter a month and year and then prints that month's calendar page on the screen. However, to do this I created a daysBetween() method that accepts 2 dates and finds the number of days between them. So basically …

Member Avatar for JamesCherrill
0
83
Member Avatar for bonafos
Member Avatar for bonafos
Member Avatar for Kimmelivim

Hi! I'm creating a guessing game where I ask the user to guess a number between 1-1000. The output where the computer asks the user for a number is contained in a [I][COLOR="Green"]do loop[/COLOR][/I]. The problem I'm having is that I have a high score list and in the high …

Member Avatar for Kimmelivim
0
167
Member Avatar for johndoe444

In the J2EE tutorial from sum site, it is often mentioned this term. For example, the timersession example: "Because it's a business method, setTimer is exposed to the local, no-interface view of TimerSessionBean and can be invoked by the client." Thanks.

Member Avatar for swosh
0
157
Member Avatar for CodeBoy101

Hello everyone, I'm working on a project where I wish to find out who the instructor for a particular course is. The user is has to input the course name and course id for that course id then the script will search for the instructor. If the value returned is …

Member Avatar for atikahuk
0
178
Member Avatar for bugmenot

Hi I have created a simple search form to search a movies database on my page using jsp and mysql, how can I make a download link after results have been extracted in a result page. Thanks for your nice reply.

Member Avatar for atikahuk
0
91
Member Avatar for nwalser

So i am suppose to write two methods called superPop and superPush. superPop() pops a StarLine object from the stack, sends it to System.out.print, and returns it. superPush() pushes a StarLine object onto the stack, sends it to System.out.print, and returns it. I am continuing to try new things but …

Member Avatar for kramerd
0
198
Member Avatar for bonafos

Salary calculator: this program will ask for the number of hours you have worked and compute the salary including the overtime. Note: working hour over 45 is considered an overtime on this example. plss!.. give me the code. pls!..

Member Avatar for sirlink99
-1
75
Member Avatar for john7890

.how would able to show monthly balance .would like to charge a fixed a fee each month .would like to charge withdrawal fee import java.awt.*; import java.awt.event.*; import javax.swing.*; class GuiAccTest extends Frame implements ActionListener { Label lab=new Label(" "); Label lab1=new Label(" "); TextField t[]=new TextField [4]; Label l[]=new …

Member Avatar for Akill10
0
106
Member Avatar for ssubnel

This is my homework for a Java class. I get a perfect score followed by a query as to why I didn't use a void method. The answer is I don't understand the difference. Can someone illustrate for me how it would look. I need a better grasp of this. …

Member Avatar for ssubnel
0
167
Member Avatar for john butler

Hi Everybody, I am a new joinee as an Android Application Developer. Now I have a duobt that "Does the Android Application Development uses the J2ME platform, I mean can we call the Android Programming as the J2ME programmimg or the Android Programming has nothing to do with J2ME or …

Member Avatar for Hasan_DMT
0
227
Member Avatar for stamford47

how would i be able to show the end of month balance using pop up window and also would like to charge a fixed a fee each month and withdrawal fee import java.awt.*; import java.awt.event.*; import javax.swing.*; class GuiAccTest extends Frame implements ActionListener { Label lab=new Label(" "); Label lab1=new …

Member Avatar for cale.macdonald
0
369
Member Avatar for y0yie_333
Member Avatar for meghab

Hi All, I am creating an application in which I want to keep refreshing a jsp file and in that jsp file i need to keep calling another url of type [url]www.daniweb.com/receive.jsp?a=xxx&b=xxx[/url] and save this url in database. Here the url keeps changing in every second ie. values of a …

Member Avatar for Airshow
0
100
Member Avatar for kosalaudara

hello iam a student of following computer engineering in srilanka.I haven't a good knowledge about java.Can you help me to learn it from begining.O.K.Thankyou.

Member Avatar for dragonshadow001
0
82
Member Avatar for selfuser

i need to develop a java project (UNO card game) using Graphical user interface and Database access... i dont knw how to do it... can any1 help me solve out this problem... am new to java... plz help me :) asap

Member Avatar for masijade
-1
58

The End.