398 Posted Topics
Re: hmm i havent tried your code, but back when i was doing my own server client encryption, i realizd that if i never converted the data to base64 and sent it over the socket it would decode incorrectly, i think due to symbols etc.... so i first encrypted the data, … | |
Re: you need to check your if statements i made some changes and left out others: if (playerRoll > computerRoll) { System.out.println("YOU WIN !"); } else if (computerRoll > playerRoll) { System.out.println("YOU LOSE"); } if ((computerRoll == playerRoll) || playerRoll > 7) { System.out.println("Winner"); } else if ((computerRoll == playerRoll) && … | |
Re: JTextArea has a setText() method and a getText() method use the getText() to get your previous written text and then use setText() to add the new text and the old text. NB this wont work textarea.setText(whatever+textarea.getText()); you will have to use a temp variable to hold the results of getText() | |
Re: hmm try using swing timers for that as you can run a scheduled timer to go off every 10 seonds. The reason your threads are giving you that output is because its what threads are used for. Hence it will work on one thread until that thread is paused or … | |
Re: hmm yes if statements are normally evaluate to a boolean, every if statement will end up with either evaluating to true or false: if(1==1) { } else if(1==2) //will during runtime be evaluated as if(true) { } else if(false) { } however in your example you are not evaluating wether … | |
Re: perhaps you are using the wrong name? because i cant find a class called ButtonListener? | |
Re: I think the problem is because you havent closed your last stream of the file so the new panel cannot read the file as its in use by the other try:: try { file = new File(fileName); br = new BufferedReader(new FileReader(file)); while ((line = br.readLine()) != null) { if(line.startsWith(edit)) … | |
![]() | Re: see; http://www.java-tips.org/java-se-tips/java.util/how-do-i-generate-a-random-number-between-0-and-some-inte.html and http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Random.html ![]() |
Re: what exactly is the problem/ what are you trying to do? Do you have any errors when compiling or running? [edit] actually got the problem fixed add: @Override public void paint(Graphics g) { super.paint(g); //other code } as your first line in your paint(Graphics g) {} method | |
Re: what does the error message say please post full message here | |
Re: good link too http://www.roseindia.net/java/javascript-array/modified-java-method-overriding.shtml and http://docs.oracle.com/javase/tutorial/java/IandI/override.html | |
![]() | Re: uhm you use count(n) however i see no method for this where is the method? because if you are incrementing a simple int you would use variable++? where is count defined? it cannot be defined within the method that is recursively called thats the key. So either make it global … ![]() |
Re: Hmm please can you post the full error message? with line number etc | |
Re: public static void main(String[] args) { File[] files=new File("C:\\test\\").listFiles(); for(File file:files) { System.out.println(file.getPath()); readFile(file); } } private static void readFile(File file) { //method of reading file here } Perhaps that will help, just give it a name of the directory with files and see the output | |
Re: adding this to your main method should do the trick: Die die = new Die();//create new instance of Die die.roll();//calls instance method roll() in Die to give value a number System.out.println(die.getNumDots());//print out the instance value of die | |
Re: > I would like to develop an installer for all platforms(including windows,linux and Mac). well for the first problem: http://installbuilder.bitrock.com/ and this might help: http://www.advancedinstaller.com/java.html for your next problem take a look here for > how to connect to a mysql database in java : http://www.java-samples.com/showtutorial.php?tutorialid=9 and here: http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml hope … | |
Re: hmmm Can you post the code pertaining to the problem, use: try { //... } catch(Exception ex) { ex.printStackTrace() } in your exceptions and also copy the full error message here. This will help to locate the exact code that is generating the exception so you can post it here. … | |
Re: what IDE are you using? because if eclispse may this http://stackoverflow.com/questions/2728283/how-can-i-create-a-self-consistent-jar-file-with-eclipse or for Netbeans this: http://www.java-forums.org/netbeans/12582-netbeans-creating-jar-including-jar-libraries.html and perhaphs this too for Netbeans 6.x: http://www.lampos.net/netbeans | |
Re: hmm check this link: http://www.daniweb.com/software-development/java/code/408638/read-edit-and-write-to-file | |
Re: heres a good link: http://stackoverflow.com/questions/1605332/java-nio-filechannel-versus-fileoutputstream-performance-usefulness | |
Re: check this out: http://forums.codeguru.com/showthread.php?t=348317 and http://www.coderanch.com/t/446406/GUI/java/JTextArea-image but as NormR1 suggested rather try this: http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html | |
Re: what is the error you have or the output you are receiveing thats wrong/not what you excpect? | |
Hmm i really like what applications like Windows Media Player and VLC player can do, and by this i mean: you know when you are watching a movie or listening to music and you minimize the window? Well if you hover the taskbar icon of the minized window with your … | |
Hey all, I must say its taken me a while to get hang of the new sites layout and all but im finally getting there. one thing i cant seem to get is the 'up voting' system.... in the old site you were able to either up vote a post … | |
Re: check here: http://www.daniweb.com/software-development/java/threads/658/javas-string-tokenizer and this : http://www.coderanch.com/t/397858/java/java/StringTokenizer-remove-consecutive-words | |
Re: You know when i sit and ponder what projects to make i rarely look online, because any project given by another member might not have your sons interests at heart which for me doesnt make it a 'fun' project. Think of what your son might like to make... maybe a … | |
Re: hmm looks like you havent initialized your 2D classList array: classList = new String[100][100]; | |
Re: the simplest way to read from a file is: Scanner sc=new Scanner(System.in); System.out.println("Please enter your files name and path i.e C:\\test.txt: ");//prompt for file name filename = sc.nextLine();//read in the file name Scanner fileToRead = null; try { fileToRead = new Scanner(new File(filename)); //point the scanner method to a file … ![]() | |
Re: heres 2 good links: http://stackoverflow.com/questions/161942/how-slow-are-net-exceptions and http://stackoverflow.com/questions/615955/under-c-sharp-how-much-of-a-performance-hit-is-a-try-throw-and-catch-block | |
Re: hmmm to be honest i havent heard of that and had a look on google and nothing popped up. but from what i can gather i think locally caught exceptions are those that are caught within the class itsself, and global would be when the class or object is throwing … | |
Re: well you are trying to print out the object you initiated, first you must call the constructor like you have, then call: cTotal.setArea(); System.out.println(cTotal.getArea()); I also think your setArea is wrong, it should set the variable for the instance which you called 'area' to the new area not the variable … | |
![]() | Re: > while(x > total){ //Will run until total == x || total < x. hmm i havent checked through all your code but i see this mistake is repeated: ` while(x > total){ //Will run until total == x || total < x.` can you see the mistake? you say … ![]() |
Re: here is 2 good links i found: http://docs.oracle.com/javase/tutorial/uiswing/layout/ and http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html I'm sure you know that a layout manger helps structire your components sizes and places them on certain places in the container etc, hwoever you may have to use more then 1 layout manger depending on how you want each … | |
Re: What NormR1 said is the perfect solution to what you said. you could also write the information to a text file for the user to view? Even both :) heres some exampke on adding listners to frames: http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html and http://www.java-tips.org/java-se-tips/java.awt.event/how-to-add-window-listener-to-the-window-in.html | |
Re: because b[][] isnt defined within the scope of the getAlive() method..... import java.util.*; import java.io.*; public class life{ char[][] b; public static void main(String[] args) throws IOException { java.io.File file = new java.io.File("desktop/input.txt"); Scanner input = new Scanner(file); try { int rows= input.nextInt(); int columns = input.nextInt(); b = new … | |
Re: you have too many or too little '}' & '{' but i fixed it quickly using my IDE, and the way you called the JOptionPane methods was wrong: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package studentbook; import … | |
Re: > System.out.println(result); well i cant see where you defined the variable result, so i take it your trying to call the method findBestFit(int size1,int size2int folder) and get the returned value well to do that you create a variable and assign it with the call to the method findBestFit() like … | |
Re: hmm check this has a great number of free online ones too and also paid for books : http://www.squidoo.com/javaresources | |
![]() | Re: > so why not write your own pow class that accepts two floats and returns a float? public float pow(float f1, float f2) { float answer = 0; //calculate f1 to the power of f2 and store in answer return answer; } |
Re: check this here: http://stackoverflow.com/questions/1006921/how-do-i-get-a-an-image-to-display-in-jtable-in-java-swing and perhaps this too: http://www.coderanch.com/t/342187/GUI/java/Images-JTable | |
Re: maybe check this out, http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html. Im not sure though what you mean, i dont see any form of polymorphism in the above code? maybe post the rest of your code too? | |
Re: Hmm well here's a good tutorial: http://www.dreamincode.net/forums/topic/66176-creating-a-basic-notepad-application/. | |
Re: Hmm just to add here is a good tutorials on writing your own exceptions if you so wish:[Writing Your Own Exceptions](http://www.osix.net/modules/article/?id=766) | |
Re: Hmmm...infection of exe's is way more complex then simply attaching a batch script to an exe... unless you delete the exe and give the batch the same name but thats just a simple overwriting virus. I wouldnt be mixing languages as you are because it doesnt really help, just use … | |
Re: > package pckage1; > class BaseClass { > public int x = 10; > private int y = 10; > protected int z = 10; > int a = 10; //Implicit Default Access Modifier > public int getX() { > return x; > } > public void setX(int x) { … | |
Re: Hmm im not quiet sure if this is what you mean take a look... [Combination Generator](http://www.merriampark.com/comb.htm) | |
Re: > package now; > import java.awt.FlowLayout; > import java.awt.event.ActionEvent; > import java.awt.event.ActionListener; > import javax.swing.*; > public class Now extends JFrame { > JLabel FirstName; > JTextField jtfFirstName; > JLabel LastName; > JTextField jtfLastName; > JLabel Age; > JTextField jtfAge; > public Now(){ > //Set FlowLayout > setLayout(new FlowLayout(FlowLayout.LEFT, 10, … | |
Re: [QUOTE=Mr.BunyRabit;1728979]I have a java program whith a mysql database. the user loggs in in the breginning of the system with a username and password. there are some functions that the normal users may not see/use. How do i know who is logged on to my system, since they only type … | |
Re: [QUOTE=Mr.BunyRabit;1733498]Hey there I started coding again on my old project in netbeans but i have no idea what kind of a prject it is, for example, is it javaEE or whatever. like in the image attached. How can i find out what my current project type is? Thanx[/QUOTE] I'd recommend … | |
Re: [QUOTE=Mr.BunyRabit;1733367]but it thats the case, why? I simply draged that button in Just as i did with all the others. i even deleted them, and draged new buttons in. same story. I dont understand whyyyy that happens[/QUOTE] It may occur because netbeans attempted to resize your button but it did … |
The End.