713 Posted Topics
Re: Start [URL="http://download.oracle.com/javase/tutorial/uiswing/"]here[/URL]. After you've worked through the tutorial, write a simple application that doesn't do anything interesting, and does it in a GUI - say, a pig-latin translator with a text entry box, a results display box, and a "go" button. If you have trouble, ask specific questions about the … | |
Re: Adding one more option, you can write a "PropsLoader" class and give classes access to that. This allows you to do things like load the properties on startup and keep them in memory in a centralized location, and to write back to them in an organized fashion (ie, set the … | |
So, I'm a tech writer, not a database guy, but I've been asked to develop documentation for my company's databases. This means I have some questions. It seems obvious to me that there must be some SQL documentation tools out there, but I have no idea what is used for … | |
Re: Probably anyone doing a PhD has plenty of tech books to read, and a list as long as your arm of books they're going to read next. I'd suggest you stay away from the more technical stuff. If they like reading, though, there's some excellent fiction out there that they're … | |
Re: For me, it's simply the taste of coffee on a rainy day, to get through my day on my way to work when i need to study. :) | |
Re: The return exits the method at that point. It means that none of the rest of the method executes if that branch happens. In this case, the effect is the same as [CODE]public void updateDisplay() { if (curIndex<0 || curIndex>=appObj.array.size()) { display.setText(""); } else { display.setText( appObj.array.get(curIndex).toString()); } }[/CODE] | |
I'm having some trouble with some low-level tools. Any advice would be appreciated. Here's the situation: I've been having trouble with screwy rendering of GUI elements in gimp. Submitted a bug, the gimp people say it's a gtk problem. Since I'd been meaning to upgrade from 10.5.8, I figured I'd … | |
Re: You'll find out as you post more. That's kind of the fun of it - what will I be next? (My girlfriend thinks it's hilarious - she's always asking when I'm going to level up) | |
Re: [QUOTE=boyne;1539168](Example: the refusal of doctors to accept the fact of sepsis spread by their unhygenic 'science') [/QUOTE] I always love it when people trying to knock down science end up demonstrating the main strength of scientific inquiry. Obviously, the reason you can cite this example is because 'science' figured out … | |
Re: [CODE]while (!(response.equalsIgnorCase(FLAG)))[/CODE] Read that very, very carefully. Maybe this will help: [CODE]while (!(response.equals Ignor Case (FLAG)))[/CODE] See it now? | |
Re: [QUOTE]Word: 'Day', !Word: 'Night'[/QUOTE] This could be confusing, so I want to reiterate what WolfShield said: this line DOESN'T WORK THIS WAY. The ! operator CANNOT be applied to a String, period. It is ONLY applied to a boolean, and then it negates the value given to it. That is, … | |
Re: Stutulske is right: your first problem is to work out what the component pieces of the expression are. [QUOTE]please elaborate little bit more[/QUOTE] Let's start simple. Suppose you had a String, like "asddf234fsdf" and you wanted to extract and print the integer part of that, so the output would be … | |
Re: The real answer is: if you're asking this sort of question, you shouldn't be using Eclipse yet. That's not the answer you want, though. There's probably something wrong with the way you're doing it, but since we can't see what you're doing, there's no way to know what you're doing … | |
Re: Obviously this is meant to generate arithmetic problems, so the random is fine. This gives you randomly generated subtraction problems. Why it stops is not obvious from this code. Potential problem spots would include the switch value - what is "choice" and does it change in the loop? If it … | |
Re: Make a printout of your input file, or just get it on screen next to the source file. Read through your source code and check it against the input file, line by line. You should see the problem pretty quickly. | |
Re: [CODE]int idNumber;[/CODE] A field is either an instance field or a static field. An instance field belongs to a particular object, each time you make a new object of that class it has its own idNumber. Fields are instance fields by default. If you prefix a field with the keyword … | |
Re: You might want to start by explaining what static and final mean. Having done that, you might want to go and read up on what they mean, you might be surprised. | |
Re: What do you mean? A hashmap maps key,value pairs - is that the sense of "key" you mean, or are you talking about "key" as in "keyboard" or do you mean "key" as in crypto, or what do you mean? | |
Re: [QUOTE]Also, does loop suppose to be less or equal to 3?[/QUOTE] Depends what you're trying to do. To understand a for loop, think of it as a while loop. Here's a standard construction (never mind that it's obsoleted by the enhanced for) [CODE] for (i = 0; i < array.length; … | |
Re: Don't have time to give it a really going-over right now, but I do see some nested loops. That's always a good place to look for time sinks - but don't just start optimizing them, check them out first. You can make some simple profile scaffolding by declaring a counter … | |
Re: What OS are you running on the Mac? 10.5 has real problems with Java 6. If you're running under 10.6, I'll be able to tell you more about that in a few days - I just upgraded yesterday. :) Shouldn't be a problem under Linux, though. Which distro? | |
Re: You want to give a type for that list: [CODE]ArrayList<Integer> x = new ArrayList<Integer>();[/CODE] This tells the compiler what type of object is allowed in there, which means that when you try to add, say, a JTextArea, it'll tell you "no dice". This in turn means that when you take … | |
Re: 1) Please use the code tags - select your code and click the (CODE) button above the text entry box 2) Please expand a little on what problem you're trying to solve. What happens when you run the program, and how does it differ from what you're trying to do? | |
Re: Remind me, Tracy, if you could... what does "Cannot find symbol" mean again? I know we went over this before, but I seem to have forgotten... | |
Re: Work it out on paper first. Suppose you have five index cards, each one has the information about the pets, and you have a piece of scratch paper. You can look at one card at a time, but you can look at them as many times as you like. On … | |
Re: RTFM*. [URL="http://download.oracle.com/javase/tutorial/2d/printing/index.html"]Here[/URL] it is. *Read the friendly manual | |
Re: Yes, you've just described how to do it: [QUOTE][B]take first column of twoDarray[i][0][/B] and make this array String[] newArray = {"s","s","w","r"}; [/QUOTE] | |
Re: James' solution is the one that I would have suggested. It's a good one if the file is pretty static, which is what I think you're describing. It occurs to me, though that if the file is dynamic it's a bit hard to keep your lists correct. If the application … | |
Re: Do me a favor and post the compiler output. Easier to diagnose the problem if I know what I'm looking for. | |
Re: I'd look at your braces. That lonely close brace on line 87 tells me that you're out of balance in buttonClicked, and you filled in a brace at the end, but that's not where it's needed. Go through and fix your indentation. Do it by hand and it should jump … | |
Re: James, I think if RefObject is an object (and not a primitive), then modify should modify the original. I think the following code is a fuller example of what the OP had in mind: [CODE] public static void main(String[] args) { ArrayList<String> l = new ArrayList<String>(); modifyArrayList(l); System.out.print("ArrayList l contains: … | |
Re: [CODE]public void printToken(String Arr[],int i){ for(int j=0;j<i;j++){ for(int q=1;q<=i;q++){ System.out.println(q+": "+Arr[j]); } }[/CODE] What this does is: for each of the values of j ranging from 0 to i-1, it executes a loop. In that loop, for each of the values of q ranging from 1 to i, it prints … | |
Re: 2118789 - the obvious question is, is this actually working as expected? could Ryan be 21 years old, 187 cm tall, and 89 pounds(?) in weight? Java doesn't insert any formatting when you concatenate strings, so if you concatenate three methods returning "Ryan Dun"+21+187+89, you'll end up with the string … | |
Re: Nor, we might point out, is it a site which is in the business of giving away contest answers. It's extremely poor form to cheat, which is what you're trying to do. It's extremely stupid to announce that you're [URL="http://www.daniweb.com/forums/thread326328.html"]entering[/URL] a java [URL="http://www.daniweb.com/forums/thread326216.html"]contest[/URL] and then ask for help giving the … | |
Re: Looks pretty intricate. Since you're not getting a compiler or run-time error, it's a logic error. The way to track those is to get a look into the program. What's happening when? So I'd start by looking to see how many times createCustomer is actually called. Create a static int … | |
Re: [QUOTE]BTW, most modern IDE's (or at least, Eclipse) will generate all the getters and setters for your private instance variables with a simple menu command. [/QUOTE] But if you're tempted to use this you need to ask yourself two questions: 1) Why am I exposing this data, even through a … | |
Re: What are you using as the index of the array? I'd use the character's integer value - but what do you do if you have a repeated character? | |
Re: Was there a question in there somewhere? | |
Re: The best way to solve something like this is to work backwards from where you know the problem exists. [CODE]for(int h = 0; h < 10; h++) { System.out.print(num[h]); }[/CODE] It's pretty obvious that this is okay. It walks the array for values [0..9] and prints each. If you say … | |
Re: I'm not sure what it is you're after here, but if you put a compareTo method in the abstract superclass or in each of the derived classes (if they sort differently) then you're good on comparable. If you need to implement quicksort, it's simple enough in principle, yancouto gave you … | |
Re: The first thing that comes to my mind for this is just to make an ArrayList of Strings. If the string isn't in the list (use the contains method), add it to the list and do whatever you do the first time you see an element. If it is in … | |
Re: [QUOTE]"The array without the max value is [I@38540408 " [/QUOTE] That looks like it's printing the address in memory of some object. Without looking at the code, I can guess that you're asking it to do something like [CODE]System.out.println ("The array without the max value is "+array);[/CODE] Since the array … | |
Re: Read the stack trace. Where it says "cannot find symbol", it means you're referring to a method or a variable that doesn't exist. For example, on line 14 - can't find any method called "toLowerCase" in String String has a method by that name, but phrases[] isn't a String, it's … | |
Re: Umm... Bach, Thelonious Monk, that sort of thing. I'm a musician, I need something chewy to distract that part of my brain. | |
Re: You have three conditions (two of which are wrong, but that's okay) All of them are pretty amenable to regex, though I don't know what's meant by "traditional" - that could be a gotcha. There are good regex tutorials available, read through one of them. If that doesn't work, read … | |
Re: If you don't enjoy coding, don't waste everyone's time taking programming classes. There's nothing worse than taking a serious programming class with someone who doesn't want to be there, unless it's teaching that class. You will be a pure waste of space. Don't do it. If you really want to … | |
Re: Coding styles are useful when you have a group of people working on a codebase. It's easier to read code when it's styled consistently, so someone says something like "use a 4 character tab, and we're using Allman style, camel case your variables and methods, and plesae don't use ternary … | |
Re: No, it's not good for advertising because anyone even vaguely serious about advertising here is going to know without looking that the number is bogus, and that counting everyone who's ever created an account gets you a completely useless number. At best, they ignore it. If they're smart, they read … | |
Re: Narue, if you're not careful you might wind up as a mentor to young coders everywhere. :) |
The End.