36,051 Topics
![]() | |
Problems clearing and adding items to Jlist box. I have a set of 12 items stored in each record of a database. These record items are named as follows: LANGUAGE1 LANGUAGE2 . . LANGUAGE12 I have no problems in accessing the database. rs.getString("LANGUAGE1") and so on.... I need to clear … | |
Hey Guys, Im new to learning java and I am writing a few programs for practice. I cant figure out whats wrong with my code. When i try to compile i get an "error . class expected" Any advice is appreciated, thank you. import javax.swing.JOptionPane; public class TuitionCost { public … | |
I need help with my java code for the game hangman... we are using eclipse to write the game and using three main files to start...hangman.java hangmanlexicon.java and hangmancanvas.java. the first part of the assignment, is to create a ConsoleProgram for the game and this is what i have so … | |
So i have this assignment, > Create a quiz game that displays, in turn five questions about any topic of your choice. All five questions should have the same three possible multiple-choice answers. For example, you might ask trivia question about Australia states for which the correct response is Victoria, … | |
Hi, I'm trying to insert a search function into my program. I used 2 classes class PatientInfo{ private void BAddActionPerformed(java.awt.event.ActionEvent evt) { PatientAddress pInfo = new PatientAddress(); lName = txtLastName.getText(); pInfo.getLName(lName); txtLastName.setEditable(false); } private void BSearchActionPerformed(java.awt.event.ActionEvent evt) { PatientAddress pInfo = new PatientAddress(); lName = txtSearchName.getText(); pInfo.searchInfo(lName); txtLastName.setText(pInfo.lastName); } } … | |
I am new to Java, and I have been trying to get an assignment coded and keep gettin java.lang.NullPointerException in Main Class.java:39. Ok, no prob. Unfortunately I can't quite get this fixed. Any suggestions? I'm using Eclipse Juno. Also, any suggestions on any books, sites, etc that review java in … | |
I am trying to develop a method that can find common elements in a simple array with a linear run time O(n + m). This is an old school problem, i.e., no hashsets, hashtables, arraylists. Here is what I have so far. import java.util.*; import java.util.Arrays; public class CommonElements3 { … | |
Hello everyone, I'm new here, and reletively terrible at coding, so I was hoping I could get some assistance with a program I've been working on. My assignment is to create a Frame that allows the user to choose where to paint a circle using a horizontal and vertical scroll … | |
expandable JPanel while adding items Hi, I have a JFrame and I added JPanel inside it However, I designed in a way, I can add JButton to that panel it is used as a bookshelf for example btn 1 btn2 btn3 so each time i add, it goes three columns … | |
I am fairly new to Java programming and I am having problems with creating a program with these requirements: 1. Create a program to simulate the roll of 2 – six sided dice. 2. Test to see if the dice are equal. 3a. If they are equal print “You win! … | |
Hello all, I am a beginner at Java and taking a class which is moving at a fast pace. So I have this Animal class and Fox class that must access the AnimalColor class through an API. Originally the AnimalColor object in the Animal class was public(accessible by all) but … | |
import java.util.*; public class GenericDemo4 { public static void main(String r[]) { Set s1 = new HashSet(); s1.add(0); s1.add("1"); dostuff(s1); } static void dostuff(Set<Number> s) { do2(s); Iterator i = s.iterator(); while(i.hasNext()) System.out.println(i.next() + " "); Object [] oa = s.toArray(); for(int x = 0; x<oa.length; x++) System.out.println(oa[x] + " … | |
class Sample1 { Sample1() {System.out.println("Sample1 const"); } void doStuff(){System.out.println("sample1 dostuff"); } } class Sample2 extends Sample1 { Sample2() {System.out.println("Sample2 const"); } } public class Sample3 extends Sample2 { Sample3() {System.out.println("Sample3 const"); } public static void main(String r[]) { new Sample3().go(); } void go() { super.doStuff(); } } The output is: … | |
hi all, been tryin to find wat is wrong with this code. It works for sometime then starts repeating the same value continuossssssly. any help will be appreciated. thanks /* THIS PROGRAM IS TO RUN A SIMULATION PROGRAM OF ARRIVAL AND SERVICE TIMES OF AN AUTO-REPAIR WORKSHOP * servTime = … | |
Hi, i want to call frame B from Frame A private void BFrameBActionPerformed(java.awt.event.ActionEvent evt) { Frame B = new Frame B.setVisible(true); } NOTE :calling JframeB is trigerred by a jButton but when I do this FrameA overlays my Frame B. can someone help me with this? | |
Hello , i am starting with java. I need to school make program that generates random numbers 1-20 , a than make method to check duplicates and replace them ... i find on the internet only methods with array or something like that , i cant use that because i … | |
Use document.forms[0].submit(); (0 refers to the index of the form – if you have more than one form in a page, then the first one has the index 0, second has index 1 and so on). | |
When choosing the input file, I tried three ways & all of them generated errors ! I created the file.txt in the project's folder. I'm using Netbeans IDE. 1) Passing java ShowFile Input.text as a command-line argument [properties ---> run ---> wrote this command-line in the 'Argument' box] 2) Using … | |
Hello Everyone... Am little bit confuse whether this post is come under Jsp or MySQl... but am posting in JSP because am thinking that it jsp..not Mysql query I created one report but the report is not coming perfectly so i need your help My actual report format is like … | |
I'm trying to alphabetize an array by comparing the characters at position 0 of two strings in an array, but I don't understand why when the if statement doesn't run my trail variable doesn't get incremented. //alphabetize array public class AlphaArray { public static void main(String[] args) { String[] yourChoiceItems … | |
Hi, how is it possible to handle multiple keys at same time. I am making platformer game. Now if I push forward it goes forward until I release button or hit some else button example jump. What should I do to achieve that it wouldnt stop going forward but jumps … | |
public class BufferedReader { public static void main(String[] args) throws IOException { char c; BufferedReader sen = new BufferedReader (new InputStreamReader(System.in)); **// ERROR** System.out.println("Enter characters, 'q' to quit"); // read characters from the console while(c != 'q') { c = (char) sen.read(); **// ERROR** System.out.print(c); } } } I don't … | |
I created a java web service in netbeans successfully.Then i deployed it also.But i can't right click on web service and test it.Test option appear as unclickable.Please help me. | |
Hi, I've been making my own zelda like rpg game and the game runs actually fine, but when closing it console prints this: FATAL ERROR in native method: JDWP Can't allocate jvmti memory, jvmtiError=JVMTI_ERROR_INVALID_ENVIRONMENT(116) JDWP exit error JVMTI_ERROR_WRONG_PHASE(112): on getting class status [../../../src/share/back/util.c:1265] JDWP exit error JVMTI_ERROR_INVALID_ENVIRONMENT(116): Can't allocate jvmti … | |
<style name="Theme.Custom" parent="android:Theme"> <item name="android:windowBackground">@drawable/progress_clip_drawable</item> <item name="android:windowNoTitle">true</item> </style> if I use image drawable it works but if I use clip or shape drawable it want please help suggest solution | |
i have a udp server thats going to send and mp3 file. when does the client udp know when the udpserver is done sending? | |
I am trying to figure out how to distiguish if the user input was a string or a int. The out put i am looking for is please enter a string: cat please enter a string: dog please enter a string: hamster please enter a string: 1234 please enter a … | |
public String roll() { Random generate = new Random(); int diceRoll; int firstNum; int secondNum; boolean winner = false; for (int x=1; x<=3; x++) { firstNum = generate.nextInt(6)+1; secondNum = generate.nextInt(6)+1; diceRoll = firstNum + secondNum; System.out.println("Roll number " + x + " was " + diceRoll); if(userNum == diceRoll) … | |
I am just starting out with java and I have to make a decision based text game. I keep getting some errors and I feel like I am missing an else or some curly braces somewhere, any help? import java.util.*; public class TextGame { Scanner scan = new Scanner(System.in); int … | |
Hi, [CODE] public void getTasksList(ArrayList<PerformTask> TasksList) { // TODO Auto-generated method stub try{ Class.forName("com.mysql.jdbc.Driver"); Connection cn=DriverManager.getConnection("jdbc:mysql:///test","root", "admin"); Statement st= cn.createStatement(); String s1 = "Select * from perform_task"; ResultSet rs = st.executeQuery(s1); System.out.println("Comes Here !! "); while(rs.next()){ rs.getDate("DateOfTask"); java.util.Date jDate = new java.util.Date(rs.getDate("DateOfTask").getTime()); TasksList.add(new PerformTask(rs.getInt("TaskID"), rs.getInt("PersonID") , jDate ,rs.getString("TaskDescription"),rs.getInt("TotalEffort"),rs.getString("TaskName"))); } }catch(Exception … | |
1.Which of the expressions below is true if and only if an array A containing three different integers is sorted in ascending order a. A[1] < A[2] || A[2] < A[3] b. A[0] < A[1] && A[1] < A[2] c. A[0] < A[1] || A[1] < A[2] d. A[1] < … | |
I have installed jdk and eclipse. but I can't start progamming. When I start from menu> New> class, it shows at the top "Source folder name is empty." Can anyone help me? My operating system is win7 64bit | |
Working with polymorphism collections, list, arraylists etc. I have a sorted collection that I would like to split based on one of the objects properties. All records > 0 to one; all less than to another. I'm trying to think of the best way to implement this. I'm thinking Comparable/Comparator … | |
Hi I need help with this program. I am trying to get it to store the person data into an array list and read from a file text but have not been able to figure out how to due it. This are the instructions for the program: Write an AddressBook … | |
I'm using Netbeans 7, JEE project with application client, stateless ejb with remote interface, and JPA entity clasess made from sql script. Interfaces are in separate library project which is referenced in ejb and client project. **And the problem is the remote method that use custom interface object made from … | |
dear all, I have made one program, but i am stuck with one problem. I have taken one scrollpane in simple desktop GUI application in java. My hierarchy of Scroll pane is as below. JFrame |_JTabeedPane |_JScrollPane |_JPanelMain |_Jpanel |_JPanelA |_JPanelB Now all the components are in JPanelA and JPanelB. … | |
I've created combobox.. the user have to select from the combo class, subject or grade(A,B,C,D,F) if the user select class in the text field he should type wich class 7 grade or8grade or 9 grade if he type 7 he should get all of the student name, grade. how can … | |
Hi all - this is the code: package sodukupackage; import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class ReadSudokuValuesIntoArray { public static void main(String[] args){ int[][] sudoku = new int[9][9]; Scanner sc = null; try{ int i = 0, j = 0, count = 1; sc = new Scanner(new File("validsudoku.txt")); while … | |
I am looking for help in creating an inventory system for my text based adventure game that I am writing in java. i have shared the *.java* files here: https://docs.google.com/folder/d/0B2crBUQ5i6iBRkFpanJiRGFfMWc/edit any suggestions would be appreciated, as well as any critiques of the current code. | |
Hi team, Can any one say what is instance Method in java ? *Method Overriding Concept? Thank you, with Regards, Prem | |
Here's what I have so far, I'm just having trouble writing the second part that will say that the string in the text file isn't there if the user enters a number thats not saved in the text file (data3.txt). Also how would I make it so that the program … | |
Anyways, I'm having trouble with this Cash Register code. I've been working on it for a day now, and it still won't work. Any ideas? import java.util.*; import java.io.*; public class Cash { public static void main(String[] args) { Scanner console = new Scanner(System.in); int amountDue,amountPaid; double pennies,dollars,nickels,dimes,quarters; System.out.print("The amount … | |
I am thinking of something that would require extreme use of algorithms, maybe a search engine or a distributed computing systems. Any other idea for heavily algorithim based project that would of course increase my marketability ? and by the way i have 2 instead of 1 year to complete … | |
My assignment was to create a Directory Lookup, that prompts the user for an input (inputting a number i.e. 5) and the program returns whether the input number is in the .txt file or not. Having some trouble, have re-edited my code numerous times already, but here's what I've amounted … | |
import java.util.Arrays; import java.util.List; import java.util.Random; class DynamicArrayOfInts { private int[] storage; private int size; private final int INITIAL_CAPACITY = 8; private final int GROW_FACTOR = 2; public DynamicArrayOfInts() { storage = new int[INITIAL_CAPACITY]; size = 0; } private void rangeCheck(int index){ if (index < 0 || index >= size) … | |
Hi, I have a file uploaded in DB. Can i download it from Swing application. By Download I mean with options like Open,Save,Cancel and set the response type based on the file's extension. Thanks in Adv. :) | |
Hi, Please help me in how to use findbugs static tool clouds in eclipse. | |
I want to draw a chart similar to area chart in asp.net. possible to use js / jquery. I tried out java script libraries that are available to draw charts, But those has no chart per my requirement. But I couln't find any pure code examples to draw a chart. … | |
I admit it's a part of an assignment but I don't understand what the assignment require in this part. This program is supposed to read 10 numbers from the keyboard and then the application findMax will take one single command line argument. If you invoke findMax 1, it will print … | |
What is the running time for the following recursive function: pubic static int Sum(int [] a, int start, int end) { if ((end – start) = =0) return a[end]; else { int mid = (end + start) / 2; return (Sum(a, start,mid) + Sum(a,mid+1,end)); } } Can someone please explain … |
The End.