32,199 Topics
| |
So let's take "banana", what happens when the program gets to if (ch <= 'd')? My understanding is the 'b' is < 'd' so it moves to the else. Am I wrong or right? If I'm right, then what happens at return 1 + g(s, index + 1); public class … | |
import java.applet.Applet; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; import javax.swing.JFrame; public class StartingPoint extends Applet implements Runnable, KeyListener{ public static void main(String[] args) { StartingPoint sp = new StartingPoint(); JFrame frame = new JFrame("My applet, as application"); frame.getContentPane().add(sp); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); sp.init(); sp.start(); frame.pack(); … | |
Hi my name is Jakob and I'm new to programming. My project now is to make a game called Mastermind in Java Eclipse. Here is an explanation of what Mastermind is: [url]http://sv.wikipedia.org/wiki/Mastermind[/url] My game is going to be text-/number-based and it's just going to be able to run in the … | |
**Background**: I have some experience in programming, but it's not a lot and not very good. I'm taking my first Java class this year, but because the pace is so slow I decided to just learn with the aid of the internet. This is how I have learned most of … | |
Hi Guys, There's something bugging me in the past 2 days. In Doubly Linked Lists, when will a Node get comepletely deallocated? is it when both **Next** and **Previous** references points to **NULL**? forget about the class and the method **remove()** and such. Let me make an example so you … | |
hi , i am facing a problem with jlabel. i wanna check wether the values displayed in the label is 0 or not.but no coding seems to work. int a=Integer.parseInt(albl.getText()); if(a==0){ lbl.setText(""+"out of stock"); } else{ JDialog1.setVisible(true); } | |
Ok so im writing a small java application using Zellers Algorithm to work out the day of the week for a given date. I have never compiled a java program before because i'm still moderately new to the language and IDE's etc. I am using netbeans. I have tried to … | |
This was in the game development section and I think I accidently put it there (or an admin moved it, if so then next time can you let me know, thanks). So I am posting it here (java forum community is of higer quality when giving responses) , I hope … | |
I am trying to cluster a sparse matrix with using K-means algorithm. I will use Apache mahout but I did not find any example about how can it be implement with Java. Is there any tutorial or function javadoc about it? I have tried KmeansDriver's run() function but I did … | |
I keep recieving an error on lines of code 77-80 and I'm not really sure what I'm doing wrong. They're all the same error and goes as follows: ----jGRASP exec: javac -g Program5.java Program5.java:72: error: cannot find symbol adultTickets = adultTicketPriceTextField.getText(); ^ symbol: variable adultTicketPriceTextField location: class Program5.buttonListener Program5.java:73: error: … | |
I am struggiling to correctly put together these two constructors, one adds an instance of an array class and the other searches for an int passed-in. public void Add(Appointment a) { Scanner s=null; for (int i=0; i<this.m_Appointment.length; i++) { m_Appointment[i]=a; a.Read(s); m_NumElements++; } } public Appointment Find(int appointmentId) { for … | |
I am going to be honest here, I am completley lost on trying to figure this out. I am trying to create a sudoku solver using sat4j for a 9x9 puzzle. I am trying to read a partially filled board and, by using a Satisability solver it finds a legal … | |
Hi guys, so my task is as follows. A. Develop an application that reads your listings.txt file, analyzes the property listed per agent, and outputs a report to an agentreport.txt file. Your application should do the following: 1. Prompt the user for the name of the input file (listings.txt). 2. … | |
my dillema is i dont fully understand this assignment. I also dont know if my array should be inside of class or inside of the void setString method. help import java.util.Arrays; class String { //data members private int SIZE = 25; private [] myString = new array[25]; public void setString( … | |
hi . i need help.You are asked to implement a set of programs to simulate a group of users being logged onto a computer network. Users may be added, deleted, modified, displayed and searched for at any time. A method to test whether a user’s name is a palindrome (a … | |
public class J_01_FLOW_08 extends JApplet { JPanel p = new JPanel();//nedd a jpanel to add scroll String s_value[] = {"black","red","pink","yellow","blue","orange"}; DefaultListModel dlm = new DefaultListModel(); JList l_list = new JList(dlm); JScrollPane sp = new JScrollPane(l_list,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JLabel l_label = new JLabel(); Container c; FlowLayout flow = new FlowLayout(); public void init() … | |
How can I extract the main classname of a java file ? I am doing this in php! I will read the whole java program as a string! Please help! <any_type/public/private/static> class **MainClass** { //Could be anything over here! public static void main(String[] args) { System.out.println("Hello World!"); } } | |
how can i implement a polynomial class using the doubly linked list data structure such that each node of the list holds the coeffient and the exponent of the term ? | |
Hello, I am unable to register the right key event from this program. Besides setting the focus of JPanel to the KeyListener, I am not sure what else can be done. I will be grateful for any help. Thank you! import java.awt.*; import java.awt.event.KeyListener; import java.awt.event.*; import javax.swing.*; public class … | |
hi Guys, I am currently coding for a GUI based program that delivers the amount of time a tutor works in minutes and the amount they go paid total, giving them details on the amount of time work total, and wage per hour and if it is below, minimum, or … | |
Hi.I created a jtable and imported a table from mysql there.now i created 3 jtextfield and 1 jdatechooser.Now i want to see the value of any row in the jtextfield and and jdatechooser when a row is clicked.I created the following method for this.It worked for the textfield but didn't … | |
I'm curious. Why is so much code in this forum formatted like this [CODE]if (something) { do something } else { do another thing }[/CODE] rather than [CODE]if (something) { do something } else { do another thing }[/CODE] The first version is harder to read and takes up more … | |
Hi all, A question asks me to write overloading functions to square,circle ,rectangle and triangle.... But since the square and circle have only one parameter I had to change the parameter of area of circle to double...... Is this the only way to accomplish this..... Are there any other ways … | |
import java.util.*; public class Elway { public static void main(String r[]) { ArrayList[] ls = new ArrayList[3]; for(int i=0; i<3; i++) { ls[i] = new ArrayList(); ls[i].add("a" + i); } Object o = ls; do3(ls); for(int i=0; i<3; i++) //insert code here } static Object do3(ArrayList[] a) { for(int i=0; … | |
I need your urgent help. Please help me to solve it out. Thanks a lot in advanced for your time. error: java.lang.StringIndexOutOfBoundsException: String index out of range: 150 Lines of code in this place there: if (text.length ()> 150) { text.replaceAll summary = ("<[^>] *>", ""). substring (0, 150) … | |
Hey everyone, iv'e been working on a Hangman code for weeks for the beginning of a semester long portfolio, iv'e tried several codes, but no matter what i do i can't seem to make it work... The specifics for the program were: - Create a list of possible words called … | |
Hi there, I've been trying for hours to get my Dijkstra algorithm to print the correct path. It collects the correct distance properly, but I just can't get it to print out the path of nodes that it uses! Any help would be great appreciated. 'route' is my string variable … | |
I've been doing this for the school assignment. So the whole idea of this program is to use random numbers to disguise a message by translating it into pairs of numbers; or to reveals messages by translating a series of pairs of numbers back in to the original characters. It … | |
Hey guys and girls, first post here been reading for a few days but I am pretty new to java and I have to edit a class to import a file into an array. The class initially defined the array within itself. So I made my changes and I am … | |
basically my program runs like this 1. open up configure GUI 2. get congiguration 3. close configure GUI 4. open up main GUI now when I am testing in netbeans, this works perfectly however, as soon as I compile and try to run the jar file outside of netbeans the … |
The End.