4,084 Posted Topics
Re: ehm ... [Code=Java] try{ //yourCode } catch(YourSpecificException yse){ // handleException } catch(YourOtherSpecificException yose){ // handleException } catch(Exception e){ // handle all other exceptions, just in case } [/Code] | |
Re: either on DB level, you state that 'name' must be unique (tough luck for all John Smith's out there) or, you first check whether or not the name already exists in your db, and, if so, do nothing (or give an error message, that the user knows his data is … | |
Re: it doesn't ignore it, as you say yourself: it shows the message. call your action from within your javascript, that 'll stop the action being called if your result was 'false' | |
Re: well .. if your one button does store the data in the DB and the other doesn't, you may want to check the differences between the actions performed. you can print that particular data, by selecting just that particular data. have you tried anything so far? show us your code … | |
Re: you mean by running it on the smallest possible int value -2147483648 ? | |
Re: 1. what do you mean 'validates it with'? you mean: formats it to look like? and ehm ... what is stopping you from doing so? | |
Re: if you do use this approach, I would recommend you to initialise lastInput as [Code=Java] String lastInput = ""; [/Code] otherwise, it's a nullpointerexception in the making. an approach I would recommend, is entering the first name before you enter the loop. | |
Re: String host="jdbc:oracle:thinoraserver.in.cs.… con=DriverManager.getConnection(host,uNa… String First=rs.getString("Producer_First_Name"… String Compressed=rs.getString("Compressed_Name… String First=rs.getString("Producer_First_Name"… String Compressed=rs.getString("Compressed_Name… JOptionPane.showMessageDialog(producer.t… err.getMessage()); either this is your code, and you shouldn't be wondering why you are getting errors, or, you've replaced parts of your code by putting ... to hide variable names or ... whatever, for us. by this, you … | |
Re: if you want that, you have to put all of it in one String and show it using one JOptionPane MessageBox one option: [Code=Java] String before = " Grade Computation" + "\n" + "Student No. : " + studNo + "\n" + "Student Name: " + studName + "\n" + … | |
Re: is that a problem? I don't really check the forum at [URL="http://www.java-forums.org/"]java-forums[/URL], and I assume there will be more members who don't. | |
Re: ehm .. sure you can choose not to use the WYSIWYG-editor from NetBeans, and write the code yourself: no messy generated code or, you can create that one method and refer to it from within the by NetBeans generated methods (which still may look a bit messy) | |
Re: you 're not being turned down. we're willing to help you correct your code, but if you don't show us your code, we can't see where you are going wrong, that's all. | |
Re: since you are already using 'split', I would guess you're ... heading for a fall, as the song says. I'm not sure what you mean by 'calling the arrays before the word and after', but I'll tell you what to do if you mean what I think you mean: 1. … | |
Re: what do you mean: it looks messy? since you haven't posted your complete code, we can't just 'run and look' | |
Re: are we talking about different applications, or about different classes extending JFrame? there is a very, VERY, big difference there. | |
Re: [Code=Java] Image combined = img1 + img2; [/Code] this is ... wow .. 1. you can't create your Images like that, since (in java terms) ImageIcon does not pass an 'is-an-Image' test 2. you can't combine Images with the '+' operator. next to numerical tasks, there is not that much … | |
Re: no, it will always add 1, but, without synchronization, you may have: ... At thread 28 sum is 28 At thread 29 sum is 29 At thread 30 sum is 30 ... but, you can also get: ... At thread 29 sum is 29 At thread 28 sum is 28 … | |
Re: what kind of 'Dialog' do you want to open? a class extending JFrame? a JOptionPane DialogBox? | |
Re: suggestion nr 1: show your code. we can't really tell anything without having a look at it, now can we? | |
Re: ehm ... what are you having trouble with? and no, I'm not going to read every single piece of code that is copied and pasted into this forum. | |
Re: you forgot to mention what problems you are having. if it's as you posted it above: it's badly indented and hardly readable | |
| |
Re: have you tried if ( mnth == otherDate.getMonth()) for as far as I can see, your code as you describe it should be returning true. | |
Re: actually, they are, but in most cases they can be written in another way, which a lot of developers prefere, since, whether it's known or not, developers with less experience might find the code a bit harder to read, and might have a bit more trouble predicting the flow a … | |
Re: you're trying to create methods within your main method . don't. also, you have a return statement in your main method, while the main method is void also, you're using A and B, but you're never declaring them. | |
Re: what code do you have so far? the IDE you are using has no impact on the code you should have, or the logic you should use | |
Re: well .. I'm not sure what you want that 'Events' to do but .. anyway, you'll want to declare your labelAnsWin outside of your main method, that way you'll be able to use it, or set its value outside of the main method. and then, you'll replace that: [Code=Java] Events … | |
Re: don't double post questions. JamesCherril made it in your other post quite clear why this isn't a 1 + 1 = 2 kind of answer. for some types, you'll need method a, for some types, you'll need method b, for some types, it's impossible, so please, either give us something … | |
Re: honestly, I have no idea what exactly you're asking here. why would you mean by 'so what condition can be applied in such a way that the user can enter 2 different species with the same breed name...' my first answer would be: insert two with the same breed name. | |
Re: imho, the best method would be to go over the basics of Object Oriented design in Java, you may want to take a look at the sticky thread on top of the Java forum. you may want to start by giving us a list of what classes you think you'll … | |
Re: why should it be? both for writer and for reader, there is NO open() method, so I doubt it was ever supposed to be an available option. | |
Re: you've got your setters messed up. you are not setting the actual values, you are just getting them. replace your setters to [Code=Java] public void setLength(double length){ this.length = length; } [/Code] | |
Re: according the error message you're trying to parse a null-value (a variable in which you haven't stored a value yet) into an integer. you 've stored a value in ls2, not in s2, which you are trying to parse. | |
Re: and what do you mean run in netbeans? as a part of a bigger application, or do you want to edit the code of the application you are talking about. | |
Re: the split method only exists for [Quote="API"] String[] split(String regex) Splits this string around matches of the given regular expression. String[] split(String regex, int limit) Splits this string around matches of the given regular expression. [/Quote] or, as your error message stated: "cannot find symbol, symbol : method split(char)" here's … | |
Re: indexOf would do exactly that, but if you don't have the same case (upper vs lower) in your original String and in the one you are searching, then it won't work. @pro_learner: how would the choice of IDE (that is, if the OP even uses one) have any impact on … | |
Re: could you give us an example of one of a program you are trying to write and what your solution is? maybe you're just making minor mistakes against other parts of the logic that make you think your way of iterating over data is incorrect or inefficiënt | |
Re: sure you can, as long as you keep an eye out for the biggest and smallest as well .. (just piece of the logic, not actual code) a = smallest, b = second smallest, c = input ... if ( a > c ) b = a and a = … | |
| |
Re: well, you don't. a String is not a numerical value, so you can't use numerical operators on them. you can however use the 'compareTo' method of the String class. | |
Re: where to ask for input: that would depend on where YOU want he input. detect in which range it is .. use the operators <, = and > and you'll have it to work in no time. creating a main method is the very most basic thing in Java. you … | |
Re: thines: I'm pretty sure the charAt(index method will return a char | |
Re: 1. don't start several threads for one problem 2. try and compile your code, you'll no doubt get some very clear error messages that'll tell you you are doing some things quite wrong, like having two methods with exactly the same name. 3. also: realize that getSubject… is not a … | |
Re: count the nr of chars of your first line, subtract two. for the next n lines, print *, then the number found earlier in spaces, and print another * then, print a complete line again | |
Re: how exactly do you want us to know anything from that code? your comparing an m object without informing us what m is (is it a book, a subject, a penguin, ... ) also, informing us of what's in the book, booksub, subtitle class could help out | |
Re: read the lines as String objects divide the String objects in parts and use if statements to check in which case you are. just a basic question: how exactly do you think you can convert a String in which you have a - and a = character to an integer? | |
Re: that is because Venus needs to implement the Comparable interface and have the compareTo(Object o) method of Comparable. also b.str="obj1"; is a bad thing to do. I suggest declaring your variables as private and use setters and getters to get to the values or change them. | |
Re: you need to put your test after inputting the number. | |
Re: would depend. do you know beforehand how the string object will look like? and with this, I mean: do you know before running the application at which position there will be (an) integer(s)? otherwise, it might be quite tricky, you'll have to check char by char whether it's a digit, … | |
Re: what exactly do you mean : bring bitmap to java? show an image in a JFrame, edit a bitmap, ... |
The End.