3,927 Posted Topics
Re: Use [URL="http://java.sun.com/javase/6/docs/api/java/io/PrintStream.html#printf(java.lang.String,%20java.lang.Object...)"]formatted output[/URL] then[code]String[] test = new String[]{"X","","O"}; System.out.printf(" %s | %s | %s ",test[0],test[1],test[2]);[/code] | |
Re: [QUOTE=MxDev;1051784]Hi guys, I demand to know the correct order of the following topics to study [COLOR="Green"]Object Oriented Design and Analysis[/COLOR], [COLOR="Red"]Design Patterns[/COLOR], and [COLOR="Green"]UML[/COLOR] Thanks in advance [EL-Prince][/QUOTE] Learn manners first. | |
Re: You can't declare methods inside other methods. Get consolidate() out of main(). | |
Re: No, you don't put javadoc comments inside methods. Edit: On an unrelated note, "Number" would be a really bad name for a boolean variable. Number is the base class for numeric wrapper classes like Integer. Variables should also begin with a lowercase letter. "isNumber" would be a better choice and … | |
Re: That is because it has nothing to do with Java itself. You're just sending a DDL statement to the database. Any difficulties with it would be specific to that database and the JDBC driver. | |
Re: You don't need to re-create all of those things when you pick another file for the table. Just create a new table model from that file and use [URL="http://java.sun.com/javase/6/docs/api/javax/swing/JTable.html#setModel(javax.swing.table.TableModel)"]setModel()[/URL] to set the JTable to the new model. There is no reason to discard the GUI components themselves. | |
Re: This version[code]int max; for (int i = 0; i < array.length; i++) { if(max < array[i]) { max = array[i]; } }[/code] will not compile. You will have to initialize max to something - either the first value of the array or Integer.MIN_VALUE. | |
Re: You can also use [URL="http://java.sun.com/javase/6/docs/api/java/util/Random.html#nextInt(int)"]Random.nextInt(int)[/URL] for the random int. Keep in mind that the suggestions tendered so far will allow the chance that an element is selected multiple times. If you don't want that to be possible then you'll need to put additional measures in place to prevent it. | |
Re: Here's the "Hello World" tutorial for Netbeans from the Sun site: [url]http://java.sun.com/docs/books/tutorial/getStarted/cupojava/netbeans.html[/url] It walks you through all of that. | |
Re: Simple way? Not that I know of. JList is not really considered an editing component and doesn't expose methods for it list JTable does. What you need is a cell editor in addition to your renderer. You could take a look at this guy's blog entry where he builds an … | |
Re: And I agree with Niek_e: airing this out in a public thread in Community Feedback is probably not the most productive way to address the situation. | |
Re: You haven't asked a question. Posting your assignment isn't the same thing. What are you specifically having trouble understanding? What are your thoughts? What have you tried (anything at all)? | |
Re: [QUOTE=MosaicFuneral;1048045]I didn't see a single mod around, just an admin.[/QUOTE] Sometimes you can't see us... ;) | |
Re: [QUOTE=cwarn23;1047497]If you mean is there any better design I could follow without appending then I'm am not exactly sure because basically I have 4 tickboxes in the gui and when one is ticked the variable in the if statements changes to true. The tricky part is that the result is … | |
Re: You really are confused I guess. Your username would indicate you have Java questions and yet you post in the C++ forum. Additionally, you seem to have missed the announcements that state we only offer homework help to those who show some effort. I'm not seeing a whole lot of … | |
Re: Note that Math.sin() and cos() take radians for their parameters. 22.5 is perhaps more radians than you want to add to your angle. | |
Re: [quote]But I think that the people who become 'regulars', aren't here for blocks or stars, ...[/quote]Blocks and stars are my only [I]raison d'être[/I]. My soul will die without them. | |
Re: Just a note: it's preferable to override paintComponent() in most cases instead of paint(), since paint() is also responsible to painting children and the border. [url]http://java.sun.com/docs/books/tutorial/uiswing/painting/closer.html[/url] | |
Re: [QUOTE=RunTimeError;1046694]Er...do you even need to use all those data types?? [/QUOTE] Well, according to the OP, yes... [quote]i have to write it using stacks and queues and using LinkedList with an iterator[/quote] | |
Re: So get to work writing it. Post code and specific questions here when you get stuck. | |
Re: You can start with [URL="http://www.exampledepot.com/egs/java.net/ReadFromURL.html"]Reading Text From A URL[/URL] and [URL="http://java.sun.com/docs/books/tutorial/essential/regex/"]Regular Expressions[/URL]. | |
Re: You can't declare methods within other methods, so those that you have crammed into the switch statement have to be moved out. | |
Re: [QUOTE=mahgobb;1016131]Do u still read today? I mean, in today's world, do u still read books? The printed books?[/QUOTE] Definitely. Especially authors that actually take the time to put all of the letters in their words. | |
Re: Try adding a revalidate() and possibly a repaint() in your runnable after you set the new screen. | |
Re: Well, you [U][I]can[/I][/U] but it's rather unwieldy[code]ArrayList playerinfo = new ArrayList(Arrays.asList(new Object[]{"blah","blah"}));[/code]It would be much cleaner to just make a small static method to build and return the test data. | |
Re: You just need to "get()" the info that is there. The code you posted is trying to create a new ArrayList. It looks more like you want [icode]playerinfo.get(0).get(0)[/icode]. | |
Re: Use a JTable. What you are describing is not a list. You could override toString() on the object you add to JList to present the description you want, but if you want to present those as separate fields, use a table. | |
Re: Try [URL="http://java.sun.com/javase/6/docs/api/java/util/List.html#removeAll(java.util.Collection)"]removeAll(Collection)[/URL] instead of [URL="http://java.sun.com/javase/6/docs/api/java/util/List.html#remove(java.lang.Object)"]remove(Object)[/URL]. | |
Re: In your Netbeans installation directory, go to "etc/netbeans.conf". There you will find an entry for "netbeans_jdkhome". | |
Re: Well, looking at that brace on line 64, your code to add the listener is not in a method at all. So you've left out some other code in your post or that piece above won't even compile. | |
Re: Agreed that this is more of a HTML/CSS question. Moving it over there. Carry on :) | |
Re: But your post still offered nothing of value at all and just a spam link to your hosting site. | |
Re: Only if you start a new thread for your request and demonstrate that you have made some effort on your own. | |
Re: [QUOTE=JamesCherrill;1039342]... and it always makes me wince).[/QUOTE] ++ Me too. Not only is it unnecessary, the code just reads a whole lot cleaner without them.[code]if (isComplete) {...[/code] | |
Re: [QUOTE=Nyna;689849]hi.... 'm in my final yr engineering... really confused as to wat topic to take up as my project.. can u pls help me...[/QUOTE] Write a translator that converts "IM speak" to intelligent, professional language. Use it yourself and encourage your classmates to use it as well. It will be … | |
Re: Why not stick with the ButtonGroup? You can put both radio buttons and check boxes in the button group just fine. CheckboxGroup is for use with AWT Checkbox. (By the way, you forgot [code]add(noSelectionButton);[/code]in your code above. You created the button but didn't add it to the panel.) | |
Re: "It didn't work" is not a question. And use code tags if you post code. | |
Re: You are trying to assign a single int value to an int[] array. You need to assign that int to a specific element in your array, such as [code] stateCode[count] = input.nextInt(); [/code] | |
Re: You already have a thread on this question here: [url]http://www.daniweb.com/forums/thread235128.html[/url] Do not create multiple threads for the same question. | |
Re: My suggestion: learn how to type and communicate effectively. It will serve you well. | |
Re: Personally I'm surprised there aren't more sig link spamming "thanks for this informations!" posts in this thread yet. | |
Re: Using the pattern [iCODE](\w+?[RK])[/iCODE] with the regex [URL="http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html#find()"]Matcher.find()[/URL] method will capture all of those groups except for the last one, which doesn't end with R or K. Edit: This pattern [iCODE]\w+?[RK]|\G\w++$[/iCODE] seems to produce the result you wanted.[code]Pattern pat = Pattern.compile("\\w+?[RK]|\\G\\w++$"); String input = "AMLARMLAKFGFP"; Matcher matcher = pat.matcher(input); while … | |
Re: Are you expecting it to print the "f"? Doubles and floats don't look any different as output. | |
Re: Because you are calling that method statically but it is not declared as a static method. To call it as you have defined it, you would need to create an object of that type and call the method on it. That method doesn't return anything though, so trying to capture … | |
| |
Re: That isn't Java code. Perhaps you meant to post this in another forum? |
The End.