masijade 1,351 Industrious Poster Team Colleague Featured Poster

Nevermind, got my library APIs mixed up.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First of, use your algebra skills to "turn the equation around" until you have an x= .... equation. Then the rest should be self-explanatory.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

First, remove that jar file from the ext directory, it does not belong there, and you would have to do it again with every upgrade to Java so it wouldn't be worth it anyway. Then, you can forget about the CLASSPATH environment variable your IDE won't use it to run your project, and, if you later create a jar, it wouldn't be used either. Add the jar as a library in the project settings for your project within your ide.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

i have never learned JNI nor anything related to it :( i read that whole page but didn't find the specific answer !

Because that page won't give you "the specific answer" (i.e. cut-n-paste code). It tells you how JNI works and shows you how to do it, but it is not a cut-n-paste do my work for me site, of course.

And, of course, the statement about "never learned anything about JNI" is meaningless as that is what that tutorial is teaching, of course.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That question seems to be backwards as JNI is meant to allow Java to use things written in other languages, not the other way around. Now, if that question is to "use printf from C in Java" then I would understand it, and that tutorial would help. IOW, find the library in which C's printf resides and write a JNI interface to that.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

please I am not student ,I am a software professional.. .......

So then you should have some idea of what you need to do, and if not, you should have some idea of how to figure it out. If you don't that's not saying much for your being a "software professional".

Do some research (you can find all you need with one single, simple, google search), give it try, and post that back here with a real question, any, and all, error/compiler messages, and/or a complete, but concise, descritpion of the difference between the expected and the actual results.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? For the first one a simple substr in a loop. In the second one a simple substr in a loop combined with charAt to determine the index.

Using those hints, give it a try and then post your code with a specific question.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
masijade 1,351 Industrious Poster Team Colleague Featured Poster

How did you determine that?

I assume then, that this is not the real program? If not, then show the method, and how you are using it, from the real program.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

It's called reflection. Google that and find a tutorial.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, toArray(new String[0]) , maybe? See the API docs for Vector.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Where did you show the output? You probably casted to int there.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, if you did it correctly and the GUI code is not mixed in with the data and logic code, all you need to do is to write a new view (gui) using JSP, but, probably, you have it all mixed together and so need to simply rewrite the entire thing. Have fun.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay, readLine is BufferedReader. In any case, those things I mentioned are using InputStream, BufferedInputStream handles those things for you.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Whether you want to do the work yourself, or you want to control the read size of the buffer, or you don't want line endings getting hacked off (if using readLine), etc, etc.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

That could be, too. We won't know unless the OP bothers to respond.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I guess I'm not sure what the original poster is looking for precisely - I read it as "alpha characters only", but looking again I guess it could be "isn't mappable to an int" (or a double, or whatever you want to check for)

I read the post as to identify any string that is not a number (i.e. the phrase "not int double etc etc" from the OP).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

im curious, is there any reason Integer.parseInt would be a bad approach? you could certainly use that to to solve this problem and the above problem you mentioned. plus its not too complicated an approach. im just curious?

There is overhead to doing that parse. Also, the objective is to match the entire string. So, either you do parseInt on every character (which will then fail on positive, negative, and decimal point signs) or you do parseInt on the entire number, and parseLong on the entire number, and parseFloat on the entire number, and parseDouble on the entire number (although a single parseDouble should be enough). As a matter of fact, I would use my regex presented above, and then, to check for the few Strings that might get through, call parseDouble when the regex indicates a number.

Once again, though, all of this gets complicated if separators are allowed (i.e. the comma after every third position) and even more so if it should be "international" capable.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, that regex will match all of the following strings

123
123.45
+123
+123.45
-123
-123.45

unfortunately, as already mentioned, it will also match the following strings

1.2.3
+1.2.3
-1.2.3

Also, that original ^ means beginning of String and the $ means end of string to ensure that you are matching the entire string.

Also, the [a-zA-Z] won't work (and \\w would be better, as that is [a-zA-Z_]) as "String" also includes !, $, %, &, and anything else that is not a number. That is why it is better to match a number (and negate that) than it is to try and match all possible non-numbers.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

btw, you would probably need to use Integer.parseInt somewhere in order to do the comparisons..

No.

I would say to simply do

if (!string.trim().matches("^[+-]?[0-9\\.]+$")) {
    System.out.println("is not a number");
}

The only problem is that that misses things like 001.002.003 (i.e. strings with numbers and multiple dots). The other question is, though, "is 234,567,890.21 a number in your mind"? If so, it just got infinitely more complicated, and even more than that because that number in European notations is "234.567.891,21".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Remove the JTable and the JLabel, then remove the JLabel and add the JTable.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

JDBC?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You can do better than that. If not then start here starting with the Getting Started link.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? So show what you've tried.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? So, what, exactly, is your problem with that?

Post your code, any and all error/compiler messages, and/or a brief description of expected vs. actual bahaviour/output.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Of course. Do you need it outside of the try block, though? Currently you have declared it within so it will go out of scope there, too.

P.S. I hope that that is not your real catch block, though.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, hopefully you declared and defined the ArrayList as ArrayList<Contact> and then you also need to to use the T[] form of the toArray method Contact[] ia = contactObj.toArray(new Contact[0]);

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Do not use == ( if(answer==Answercheck.correct) ) to compare Strings use the equals method

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, that's not what you said

so when i run the progg...no ques is displayed..only after i click on b1, is the first question displayed.....

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well then, display one (or fire an event programettically. Really, the "initial" display never comes as the result of an action event, so, if you want a question displayed right away, than you need to display one, and not only display them in the Action Listener (which won't, obviously, be accessed until an Action Event is fired).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm, the getSource() method of the Event?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Okay? What exception do you get? Have you printed the query to make sure you are executing what you think you are executing?

You are not committing the transaction and you are not closing either the statement or the connection.

Edit: And do not cobble together statements like that unless you want sporadic SQL syntax errors as well as innocent, as well as malicious, SQL injection attacks. Use a PreparedStatement.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Good for you. Maybe you'd be willing to tell us what the problem is.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

:sigh:

If you really have to ask, you probably shouldn't be doing it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What does this have to do with Java?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm sorry (not) but this?

Nick Evan commented: Yup. +16
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Stick with your JSP Thread.

Closing this thread.

P.S. its called "actually making use of the session".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Many people here can, ask a specific question. Otherwise the answer is frame.setVisible(true) in an ActionListener.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Uhm,

pane.addTab("New Tab Title", new JPanel());

?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

The voucher contains instructions.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
this.getClass().getProtectionDomain().getCodeSource()

see the API docs for Class and ProtectionDomain and experiment a bit.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Can we see what you've tried?

Otherwise a simple remove and add on the JTabbedPane (its remove and add as pertaining to it's tabs, or place another panel on the tab in question and place your login panel in that panel and remove and add from that panel) and don't forget to call validate and/or repaint on the JTabbedPane (or the component that contains that JTabbedPane).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

What got into you? Not that most of that information is not both misled and misleading. In any case, closing this zombie.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Possibly another.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Possibly another.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Possibly another.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Essentially crossposts
Number 1
Number 2
Number 3
Number 4

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Essentially crossposts
Number 1
Number 2
Number 3
Number 4

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Essentially crossposts
Number 1
Number 2
Number 3
Number 4