- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 11
- Posts with Upvotes
- 10
- Upvoting Members
- 7
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I'm a university physics student with a passion for creating video games, currently in Java.
- Interests
- Guitar, piano, drawing, writing, basketball, physics
- PC Specs
- HP pavilion dv7 for university Home built desktop at home Currently dual-booting Windows 7 and Ubuntu…
52 Posted Topics
Re: If you just want a boolean to see if it had any capitals, you can use this: [CODE]String test1 = "Hello"// your string; String test2 = test1.toLowerCase(); boolean hasCapital = !test1.equals(test2);[/CODE] | |
Re: Going on what mike said, to make it official, I wrote a snippet in Java for dynamic class loading from XML files, to be found here: [Click Here](http://www.daniweb.com/software-development/java/code/425300/dynamic-class-loading-from-xml) Curious what you think of it :) | |
Hello everyone, this is something I wrote a couple months back. It is used as a universal class/object loader from an XML file. For the handling of XML I use the JDOM library. The story basically goes like this: I have a load of classes in a game I'm working … | |
Re: What you can do for instance is put all your coefficients (aka a0,a1, etc) in an array, then make a for loop through that array. Just keep a value say x, and every time you enter the for loop, add x+ai*x EDIT: Didn't read your third line for the summation … | |
Re: Every time the user changes something, overwrite the config.properties file, and just always try to load the file when your app starts? There might be more to it I don't know about. | |
Re: You can split your string so that you get all the different lines in an array, like this: [CODE]String[] lines = yourString.split(System.getProperty("line.separator"));[/CODE] Then you just select the ones you want. :) | |
Re: I assume you're talking about some sort of chat program? You will find many examples on the internet. The things you need to learn are network programming, ie Socket and ServerSocket classes, and multi-threading. Depending on how complex you want to make it, just using google can already help you … | |
Re: You do this using the java.util.regex package. Tutorial here: [url]http://docs.oracle.com/javase/tutorial/essential/regex/[/url] Should you encounter problems, feel free to ask :) | |
Re: What this means is that your JasperFillManager is null, or perhaps something in the method fillReport. Try to put some printlns on different spots, or just use the debugging tool to check what your variables are, and go back like that. | |
Re: First: the init() method is the equivalent of a constructor for an applet, as such it gets called first. Since you don't initialize your numbers before using them in the labels, Java takes them as 0 and displays it that way. Second: the problem lies in your actionPerformed method. The … | |
![]() | Re: Methods can only be called from within other methods, not in the class declaration like you did. Every method is called from within another method, starting with the main(String[] args) method. Also, I noticed you putting n=nombreDeLignesDeMonFichier, while it should actually be the other way around. You haven't initialised nombreDeLignesDeMonFichier, … |
Re: Do you mean something like microsoft Paint? In that case it's pretty easy to find some examples. If it isn't, you're going to have to be a bit more specific. | |
Re: 1) Where exactly lies your problem? 2) Why do write to the file again at line 58 when textfield1.getText() is unchanged? 3) The assignment is to display the string you got from reading the file, i.e. tempString, why print temp. On the outside it'll of course look the same, given … | |
Re: If the things you want are always on the third line, you can just let the scanner read the first two lines without saving it in a String, then just put the third line in a string, and there you have it? Then you just split the string using your … | |
Re: A simple requestFocus would probably do the trick, but there might be a more elegant solution. But for that I'd have to actually see some of your code. | |
Re: Look up JDom, it's a java developed XML parser and writer API. Depending on what API you use, an 'XML object' are different things. In JDOM it would be an Element object, In SAX I don't believe you can manipulate objects like that since it's a read only API. An … | |
Re: You can just put a [CODE]while(true)[/CODE] loop around your try-catch structure. That way it will keep running forever. It you want it to run say 5 times, you just replace the while(true) loop with a for loop. As a suggestion, doing System.exit(0); if the user types something that can't be … | |
Re: Have you tried it already and it didn't work? In case it shouldn't work, writing the text to a temporary file and loading from that file isn't an option? Why do you absolutely want to give a full text as a parameter? | |
Re: win32 is sort of the basis, the lower level end of c++. In my opinion it's about as fun to program as vomiting after a rollercoaster, you hope it was worth it. However it gives you a lot of freedom, but if you want I'm sure there are some libraries … | |
Re: As OP said, you can just make a new File with the constructor public File(String filename). Besides that, a file can generally read in 2 ways, using a scanner, or by using a bufferedreader. Both have their uses, though generally it doesn't matter. I suggest you look up both classes, … | |
Re: All import statements must be done before defining any classes. Your standard structure should be like [CODE] package something; import something; ... Class definitions[/CODE] | |
Re: Put brackets around your second if statement, it's good programming practice to use brackets, even for one line expressions, should you want to add more later. It should fix your problem I believe. | |
Hello everyone, I'm a java programmer writing a half graphical half text rpg. For the moment I read my data from text files, e.g. Enemies.txt id name hp and so forth. However, I want to make it a little more clear to handle, as in a database format. I can … | |
Re: As far as I'm aware it's not possible to 'show a website' in a java program. It is however possible to write a html doc with 3 iframes, modify that doc through java, and open it using the default browser though the function Desktop.open(). | |
Re: Besides what JamesCherrill said, you'll probably have to put parenthesis after "in.nextFloat". | |
Re: It isn't possible in Java. A workaround would be to create 20 or so white lines, or how many you see fit. | |
Dear Daniwebbers, I have a problem regarding the calling of methods on a protected parent object from within a child object, the protected parent object being a child object of the same class. I have a class HostileArea, wich has a "protected DungeonRoom[][] dungeon", DungeonRoom being a child of HostileArea. … | |
Re: Could you give us your main method, or how those 2 methods you posted are used together ? I don't see what a method with integer arrays have anything to do with your problem, unless they're the letter number of in the alphabet of each letter. | |
Re: I'm not entirely sure what you mean.. Java IO takes care of reading and writing to files and such. I suggest looking up the BufferedWriter class for writing and BufferedReader for reading. | |
Re: Also, unless you absolutely need AWT, use Swing, among other things it has built in double buffering. | |
Re: In case you solved the problem yourself, it would be good to list what you did to solve it, so others browsing this thread can profit from your solution. :) | |
Re: Search for a command line option to unzip with the program you're using, then execute it in the same way you did to start the program. | |
Re: [url]http://download.oracle.com/javase/tutorial/java/nutsandbolts/for.html[/url] They explain it well. For basic programming questions like these it's best to just google it. | |
Re: First, i suppose you're making a text-based game, running in a console window ? Second, in order to print your cards, you need to define what to print. Your computer doesn't know it needs to draw card shapes just because you named your class 'Card'. The toString() method does what … | |
Re: The choice of Applet vs Frame is one of where you are going to use it. Applets are basicly used in a webpage, implemented on the page by html. Frames are stand-alone applications. To 'go from one page to the other', I suggest working with different JPanels, and switching the … | |
Re: Please explain further what you want to achieve. From the title I take it you made a GUI Swing application and you want it to print reports? Also, you ask us how reports are made? First, this isn't a java question, rather an academical, and as such you would find … | |
Re: Perhaps Remote Method Invocation (RMI) is something you should check out if connection itself is troubling you. Basicly it's a little higher-level programming than the regular serverSocket/socket programming, taking care of http tunneling itself. [url]http://download.oracle.com/javase/tutorial/rmi/index.html[/url] Would be a good start. Good luck, I'd like to hear your progress :) | |
Re: I have quite some MATLAB experience, but you'll have to post specific questions as to where you are stuck, since no one will hold your hand and fix it for you, rather point you in the right direction. | |
Hello everyone. I've been programming on a co-op RPG for quite some time now, but my networking side has seen some troubles. I'm using the lower level serverSocket-Socket way. Everything runs flawless within my own network, however connection over the internet is where the trouble is. I understand this is … | |
Re: Post the error please. Without it we can't help you. | |
Re: In addition to what Jaydenn said, it is advisable to close the streams in the 'finally' section. That way, in case an error is thrown, the stream will still close. As it is now, you'll have bad stream control. So: [CODE] BufferedReader reader = null; try { reader = new … | |
Re: First, when you do "if(readArray[i] =="Exit" ) break;", you don't actually check the value of the string, rather the position in the memory. To check the actual value, use readArray[i].equals("Exit"). Second, you need to place your if statement after your input. As it is now, at your if statement, readArray[i] … ![]() | |
Re: What exactly does your IDs() method do, e.g. why does it return an unused vector, and you don't even use the returned Vector in your constructor ? | |
Re: The problem you are getting is one of appending to the file instead of replacing. The way you have coded it right now, the writer replaces the file with the last incoming sentence, instead of appending to the file. The trick is that there are 2 constructors for the FileWriter … | |
Re: First: picking up an almost 2 year old thread :sigh: Second: look up RMI (Remote Method Invocation) [url]http://download.oracle.com/javase/tutorial/rmi/index.html[/url] | |
Re: Make a sort of family tree. Just do it on paper. Basicly just do what the assignment says, just don't start coding right away if you haven't fully figured out what you want to do. It saves a lot of time recoding and bug squashing. | |
Re: Methods need to be called from within other methods, which are called from within other methods, etc, going back until your 'public void main(String[] args)' method. Outside the method structures in your class you can only create variables. | |
Hello everyone. I just started on 'converting' my multiplayer text RPG into a graphical form. What I am trying to do is this: Create a title window, basicly just a JPanel with one image filling the space. To this JPanel I add a MouseListener. When a user clicks the window … |
The End.