32,204 Topics
| |
I am having trouble completing This hangman project. It mmost be done using model view controller pattern. Here is what i have so far //Header file declarations import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileInputStream; import java.io.IOException; import java.util.Scanner; //Class declaration class HangmanModel extends JFrame implements ActionListener { … | |
I am working on an application in which I select a color from a color selection dialog and click on a graphic shape to change its color. Everything is working fine, but now I would like to change the default arrow-shaped cursor to an eyedropper shape when I am in … | |
Hey I'm in an AP Computer Science class working on classes. We have been working on a project that is a date class that does certain things like setYear, getMonth, getDay, etc. I have gotten all of those to work, except for one. The last one is a boolean method … | |
My Java instructor yesterday gave us a sample test. One line that surprised me was something like [B] if ( m2++ < 10 ) { ………[/B] iow the first thing done is , in effect m2 = m2 + 1, an ASSIGNMENT. Whether the instructor ever actually discussed this in … | |
[B]hey guys: i put a question 2 days ago after having a problem with this equation and u guys helped me alot and solved it but i want to program it in java everything went well but gave me 2 errors here is the code and all information the code … | |
GUI class with the list. What i want to do is have another class add to this list when button is clicked but im not sure how to do that. [CODE] public class LView extends MasterViewPanel{ private static final long serialVersionUID = 1L; private JButton host, join, quit, start; private … | |
Guys I need some help in my activity, I'm making a calculator using NetBeans but I dont know what codes to use be in 0,1,2,3,4,5,6,7,8,9,+,-,*,/,=,(. decimal) all i know is the clear button code[CODE]private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){ jTextField1.setText(""); } [/CODE] My calculator lack of functionality...:( | |
I have been asked to create to check if a word is palindrome or not. But I am facing some problems. After the code you can see the messages that I received from the compiler. [CODE] import java.util.*; public class Palindrome { public static void main(String[] args) { [B]Stack<String> stack … | |
Hi, I am facing OutOfMemory exception in Java, Kindly help me to resolve this issue, really appreciate your help [U][B]ERROR: [/B][/U]java.lang.OutOfMemoryError: Java heap space [B][U]CODE:[/U][/B] [CODE] public Blob getBlob(String databaseInstance, InputStream inputStream) throws SQLException, Exception { applog.info("Entering getBlob"); InputStream stream = null; applog.info("inputStream : " + inputStream); stream = inputStream; … | |
I'm trying to make my first real project: A calculator, but when I press the "clear" button (the only button i've done so far) the JLabel doesn't go from two to zero, any help would be really appreciated :) code: [CODE]import java.awt.Color; import java.awt.GridLayout; import java.awt.event.*; import javax.swing.*; public class … | |
I am a beginner in programming(java) and want to know, how to do typecasting in it. show me by giving examples. | |
Hi, I am wondering if it is possible to "transfer" a Socket connection to another ServerSocket? So, say I listen for a connection on ServerSocket with port 1111. A connection is established, I know want to use a ServerSocket with port 2222 to handle this connection. Is he possible without … | |
Hey Im currently working on a application server written in Java but to use information from a C++ program. The company seems to agree that rewriting thousands of lines of code would be time consuming and simply making libraries of key functions of the C++ program and then passing them … | |
How to convert int value to another data type in java or from other data types to int.I just need syntax of it. | |
I accidentally hit Source->Externalize Strings... on eclipse and now hundreds of string literals are stored in a properties file. I want them back scattered about my code. How can I do this without re-entering them? | |
I need a help to understand what condition can be applied to the below requirement: If suppose we have 2 species name eg. dog and cat... and we have few breed name for the above mentioned species.... so what condition can be applied in such a way that the user … | |
I have to complete a project about employees and their jobs. Here are the requirements: 1 Must be able to add new employees 2 Must be able to add new jobs 3 Must be able to attach a registered employee to registered jobs (several jobs to the same employee) Since … | |
[CODE]int numdigits(int num){ int len = 0; while(num >= 10){ num = num/10; len++; } return len; } [/CODE] This algorithm is used to count the number of digits but I can't understand it. Someone explain it to me please :D Thanks | |
For a program I'm writing, I'm trying to get rid of doubles in my string (which is a concatenation of a keyword and the alphabet). My code was compiling fine until I added the code about concatenating the substrings before and after the character I'm trying to get rid of. … | |
Can you guys run this program, I'm having issues running it. [ICODE]import java.io.*; import java.util.*; //class definition public class NumberAdder { //The main function public static void main(String args[]) { //This declares a file to open. File outFile = new File("numbers.dat"); int sumEven = 0; int sumOdd = 0; //File … | |
I am confused about composition in java. I am able to write code using inheritance...but have no idea how to turn it into composition...from what my textbook said the two are quite similar has a is a relationship and all. I ultimately would like to write the cylinder code using … | |
| Hello people, I created an innter class like this [CODE] public class OuterClass{ int attribute=0; class InnerClass { public void method1(){ attribute++; } public void method2(){ System.out.println(attribute); } }[/CODE] My problem is when I call method2() in a correct way, it displays 0 and not 1 as I wanted. Can … |
Hey i was wondering if someone could have a look at this and help me figure out why the output is repeating it's self and how I would fix it. I have spent several hours trying to fix this. Thanks in advance. [CODE]/* Author : * Date :02/10/10 * Title: … | |
how to .class file from another package????? following is run time error when i execute like this.... [CODE] e:\java2>java employee1 Exception in thread "main" java.lang.NoClassDefFoundError: Employee1 (wrong name : com/project/employee/Employee1) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 1) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at … | |
[CODE] private int [] minValues; private int count = 0; String[] tempString ; tempString = line.split("-"); System.out.println(tempString[0]); [/CODE] but when i try to add the store into array's code, [CODE] private int [] minValues; String[] tempString ; tempString = line.split("-"); minValues[count] = tempString[0]; <-- it say incompatible types System.out.println(tempString[0]); count++; … | |
I would like to write a program which asks the user for a number and prints off the tree, For example 7. Program prints something like that then. If user put 3 tree will start from 3. I think you should get the idea. [CODE] "Enter a number: 7" 1 … | |
I'm working on a project and want to open the window to the position the same as last time the window was closed, and open the window the same size as last time was closed also. The rough script is as below: When user open the window and resize it, … | |
Here my code [CODE] public static String modele; public static String supplier; public static int height = 180; public static final String[] COLORS = { "RED", "BLUE", "GOLD", "ORANGE", "PURPLE", "PINK", "NONE" }; public static String description; public static boolean withSnow = false; public static boolean sale = false; public … | |
I want to fill a Drop-downlist with a list look heres my list code [CODE] public List ListaEmpresas(){ SessionFactory factory = HibernateUtil.getSessionFactory(); Session session = factory.openSession(); Transaction transaction = null; transaction = session.beginTransaction(); Criteria crit = session.createCriteria(Empresas.class); List empresas = crit.list(); List list = new LinkedList(); // Doubly-linked list list … |
The End.