Hi guys, Is there anyone out there who can help me figure out how to display strings of symbols in a shorter form using Java. For example i want to be able to take a string "dddddd" and for it to appear as "d^6" and to be able to take something more complex like "dddddeeeebdddddeeeeb" to appear as "...
I'm completely new to Java Programming so go easy on me.I'm trying to compile "HelloWorld" in Programmer's Notepad but I keep getting this error every time I compile.> "C:\Program Files\Java\jdk1.5.0_12\bin\java.exe" HelloWorld.javajava.lang.NoClassDefFoundError: HelloWorld/javaExc...
1119 byte By
martin1 at 2007-11-20 11:08:17
Hie, I've encountered a slight problem when I tried running my applet which is embedded in at HTML but has no problem running it in the command line using: appletviewer -J-Djava.security.policy=applet.policy Index.htmlThe error which I received when I click on a button to start my application i...
1928 byte By
-EquinoX- at 2007-11-20 11:08:52
So I am asked to create this method for a connect four game strategy, thr format of this method is:/** * This strategy offer a bit of a challenge. If possible, return the column that * would make this Player win, if that is not possible, block one of the human * players wins if one exists (there can...
while (keepPlaying == "y") { System.out.println("Play again? (y/n) "); keepPlaying = scanner.next(); playSingleGame(); }okay I'm having troubles with this loop it runs through the first...
229 byte By
Enduser at 2007-11-20 11:10:11
i'm designing a Jframe that has a button that when clicked, opens another frame that's in the same project. I can't figure out how to get it to open when clicked. Any ideas? let me know if you need more information
5937 byte By
Mykullski at 2007-11-20 11:10:13
ok this may seem a little confusing but i have a .dat file called miles.dat which is found here http://www.cs.uiowa.edu/~sriram/21/fall07/miles.dat and i made a program that only does some stuff but im troubled with this one part ... the full code isimport java.io.BufferedReader;import java.io.F...
173 byte By
Enduser at 2007-11-20 11:10:18
when I build my program using netbeans using multiple frames, it uses the wrong frame first, how do I choose the "default" frame to first be visible when the program starts?
There is a concept of worker threads and UI threads in VC++, how is that Java has one Thread class which can be used for all purposes?
I wanted to thank everyone for their feedback...which was: post this elsewhere. Now I wanted to delete this and don't see a link, button, etc. for deleting it. Cany you help? Thanks.I am not sure if it is inappropriate to post the following; if it is, then I will retract it with your help, a...
541 byte By
JavaDev at 2007-11-20 11:13:36
I am developing an application in struts framework , where i am trying to display some content to the div tag in jsp when a option is selected in drop down box in a <html:form>i can do this in jsp using onchange=this.form.submit() but i dont want to use this method as it effects the performanc...
i have generated key pairs and stored them in separate files. public key stored in public key file and private key storede in privatekey file. these files are stored to class path. In another file i created a class with the name PublicKeySelector. in which i am trying to get public key from keystore...
58 byte By
pranz at 2007-11-20 11:14:44
Found the problem..Unable to delete thread..<br/>Pran
226 byte By
punky79 at 2007-11-20 11:14:53
Need to create a forum for a website using Java (jsp servlets etc) The forum needs to allow users to upload pictures as well...Is this possible with Java and does anyone have any pointers to get me started? Thanks in advance.
Transpose a 2 dimensional integer matrix. The matrix is too big,, so the matrix is to be divided into 5 equal parts and to be processed concurrently by 5 separate threads. Once the matrix is fully transposed a message has to be printed out in the console and the program should end. This is the ques...
How long does it take before I know enough java in order to design a program that works for me? Does anyone want to tell me, at what point, he or she was able to study several java programs, and from that information design an algorithm, analyze the problem and then write the code with minimal heada...
okay, so i have a question...this isn't for a homework assignment, just something i'm wondering on my own time...in my class we run java in eclipse and all the outputs are within the eclipse window. how hard is it to have a java program where the out put is in its own window...for example...
208 byte By
lontana at 2007-11-20 11:17:41
Hi to all,<br/>I am writing a function which input parameters will be known during runtime. I know that in C++ this is solved with templates but I could not know how this problem is solved in Java.<br/>Thanks
what is the use of assert and what is the difference between using assert and if condition ?
1579 byte By
Mykullski at 2007-11-20 11:17:59
ok ill start off showing my code //reads city and parses BufferedReader in = new BufferedReader(new FileReader("miles.dat")); String city = in.readLine(); // read all the words from the file System.out.println( "Reading miles.dat..." ); System.out.println()...
162 byte By
kuku at 2007-11-20 11:18:13
how do i change the scale or size of the image?<br/>ligthing correction and histogram equalizition<br/>i'm currently try to create a face detection component
2426 byte By
hensa22 at 2007-11-20 11:18:14
hi everyone.I have a doubt and I need you suggest to solve it.I am developing many windows and each this has 5 buttons.then I have created a class named ButtonPlaced which go to placed JButtons on others Windows. public class ButtonPlaced extends JPanel { private MyClass panelBotones; private JBut...
1349 byte By
Mykullski at 2007-11-20 11:18:28
ok ill first show my codeBufferedReader milesIN = new BufferedReader(new FileReader("miles.dat")); String miles = milesIN.readLine(); //reads in miles.dat while( (miles = milesIN.readLine()) != null ) { if(miles.startsWith("*") != true) //skip comments { if(miles.conta...
how can we code for a search button as if in google using java
Hey all, first post here. I have a quick question about boolean statements.I'm trying to check a 'long' to see if it is more than 55 000 000 000, but if i use if (total >= 55000000000)I get an error message saying that the integer is too large, so instead I'm using i...
1699 byte By
smbelow at 2007-11-20 11:20:06
Ok need some help with applets?I have written a very simple applet to run in an explorer; however I am unable to get it to work. Alls I get is a temporary JAVA looking logo and then the red X. The code looks like this:package Applets;import java.applet.Applet;import java.awt.Graphics;import java.awt...
440 byte By
zhshqzyc at 2007-11-20 11:20:49
Hello,I have a html file that is like<h5>Views</h5> <div class="pBody"> <ul> ...I want to add id and style to each line to create a new web page that looks like<h5 id="1" style = ...>Views</h5> <div id="2" style=.. class="pBody"> <ul id="...
3769 byte By
kottyn at 2007-11-20 11:21:23
I have coded JAVA requirement below, but nothings displays in the console when I run the program.Could someone assist me in solving this problem?Requirements:In this project, you will work with Java String. You are to write a program that does the following tasks:1) Ask the user for the name of th...
hello i have a problem with making a code with a hash functionmy method isprivate int hash(String word) { int hashValue = 0; for(int i = 0; i < word.length(); i++) hashValue = ((hashValue << 5) + (word.charAt(i)-'a')) % M; return hashValue; }however it only works for lowercas...
1613 byte By
OpenPick at 2007-11-20 11:22:09
import java.util.Random;import com.ibm.invaders.SpaceShip;/** * This is the class that you must implement to enable your ship to move within the CodeInvaders environment. Adding * code to these methods will give your ship its personality and allow it to compete. */public class MySpaceShip extends Sp...
1146 byte By
Mykullski at 2007-11-20 11:22:17
I wrote a code for my long project and im confused how to do this using Strings...ill first show what i have using integerspublic void selectCities(String attribute, int lowerBound, int upperBound) { if(attribute.compareTo("longitude") == 0) { for( int i = 0; i < 128; i++) { if(selectedC...
127 byte By
lontana at 2007-11-20 11:22:33
I got a warning "The static method should be accessed in the static way".<br/>How can be a method accessed in "the static way"?
380 byte By
lontana at 2007-11-20 11:22:36
Dear All,I have class with the constructor that uses some input parameters (for example two integers). I determine the constructor parameters within the loop. My question is:1) Should I put the constructor in the loop; or2) I should create array list so that every time the new parameters are determi...
751 byte By
MoD2007 at 2007-11-20 11:23:28
Hi all,I have to write a very small java program but I am not good in Java . It would be great when someone could help me out. The question is:Write a Java program that will print out statistics for N coin tosses. The user will input N first. And then the user has to input either 'h' or ...
464 byte By
pouncer at 2007-11-20 11:24:11
cd C:\Documents and Settings\admin\Desktop\***1\javac Server.java'javac' is not recognized as an internal or external command,operable program or batch file.i think im missing something from my system variables, ive got all the java jdk stuff in my program files stillpls i hope someonce c...
98 byte By
Soupy at 2007-11-20 11:24:15
Edit: Please disregard, I have solved this problem (not sure how i missed OOS.writeChars() before)
85 byte By
prasun at 2007-11-20 11:24:25
What is the difference between class lock nad object lock. Please give some example ?
321 byte By
pouncer at 2007-11-20 11:24:26
when i run my java server application in cmd, by doingjavac Server.java (compile)java Server (run it)it basically listens for incoming connections from clients, etc etc..my question is, how do I break out of the loop, so i dont have to keep closing the cmd screen and opening a new one?...
1245 byte By
pouncer at 2007-11-20 11:24:28
import java.net.*;import java.io.*;import java.nio.channels.*;public class Server { public static void main(String[] args) throws IOException { Selector selector = Selector.open(); ServerSocketChannel serverSocket = null; try { serverSocket = serverSocket.open(); serverSocket.configureBl...
Is anyone here willing to help me as a tutor?
326 byte By
poojak at 2007-11-20 11:25:24
Hi, I want to access details like toner low, paper jam or cover open through java code.Although I have seen some VB codes for the same, I am yet to come across any java code for the same.Is it possible to do so with java directly?Any help would be really appreciated!!Thanks in advance!Pooja...
1001 byte By
pouncer at 2007-11-20 11:25:32
Basically, I want my client to be continously able to send messages to the server, but *also* at the same time be able to recevie and display any messages from the server. This is the loop I have in its current state on the client while (true) { try { System.out.println("Enter a message to send...
297 byte By
lontana at 2007-11-20 11:25:47
Dear All,<br/>How can I create dynamnically three dimensional array (I will determine the sizes of dimensions in the course of the running program). <br/>Is it better to create vector which elements are two dimensional arrays?<br/>What is the difference between these two approaches?<br/>Thank you
738 byte By
cases at 2007-11-20 11:26:01
Hi guys this might be an easy one for you all.I am receiving the error below when compiling the class below. Any idea what kind of statement I should be returning?Database.java:51: missing return statement } ^1 error public Item search(String title){ String ItemName; for (int i=0; i < items.le...
1477 byte By
pouncer at 2007-11-20 11:26:18
public static void sendMessageToClients(Selector selector, SelectionKey key, SelectionKey serverKey, String message) { Set keys = selector.keys(); for (Iterator i = keys.iterator(); i.hasNext();) { SelectionKey sel_key = (SelectionKey)i.next(); try { // Skip if key is associated with ser...
193 byte By
lontana at 2007-11-20 11:26:56
How should I declare that will be accesible everywhere in the program (without having to initalize the class)?<br/>In C++ this is solved with extern what is equivalent in Java?<br/>Thank you!!!
927 byte By
shoaibi at 2007-11-20 11:27:06
I am programming a java application that can take commands from user and execute them using a backend perl script.Suppose if i have a perl script called exec.jpl ( i have read http://perl.active-venture.com/jpl/docs/Tutorial-callingperl.html, and i know all mentioned there) like this:exec.jplperl by...
652 byte By
pouncer at 2007-11-20 11:27:07
I'm a little bit stuck, I'm able to send messages from multiple clients to the server. But the server should send back the message to ALL connected clients, I can't seem to get this part working. It only sends the message back to the client that originally sent the message..I've...
i have a quick question, if i have two arrays, say int [] data and int []xint data : 0 4 5 1 int x : A B C Dand i want to sort data, but when it does, i want x to also sort, ( hard to explain but 0 is linked with A, (4, B) (5, C) and (1, D)so if i sort data:0145x...
2669 byte By
mbp123 at 2007-11-20 11:27:34
so i need to write this program that will take a sentence inputted by the user such as "this IS THe JaVA senTeNce" and convert it to "This Is The Java Sentence". also it must tally up all the spaces, capital, and lowercase letters and print those out at the end.I am very new to java, so I am just us...