Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Here is a simple example of using a Map for something like what you are doing.

// simple map for rule patterns to their descriptions
Map<String,String> patternMap = new HashMap<String, String>();
patternMap.put("(?i)\\s*[a-zA-Z]+ing\\s*","Ends with 'ing'");
patternMap.put("(?i)\\s*[a-zA-Z]+ly\\s*","Ends with 'ly'");
patternMap.put("(?i)\\s*th[a-zA-Z]+\\s*","Starts with 'th'");

// now let's run this against some text
String someWords = "The early bird can be found eating the worm over there, Billy.";
for (String s : someWords.split("[ ,\\.]") ){
    for (String pattern : patternMap.keySet()){
        // if we find a match, print it along with its description
        if (s.matches(pattern)){
            System.out.println(s + ": "+patternMap.get(pattern));
        }
    }
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The table model is a bit much to digest for someone who is new to Java. If you are just trying to print the array contents into a text area, you can do something along the lines of this

String[][] stuff = {
    {"a","b","c"},
    {"x","y","z"},
    {"Bob","Mary","Steve"}
};
StringBuilder output = new StringBuilder();
for (int row=0; row<stuff.length; row++){
    for (int col=0; col<stuff[row].length; col++){
        output.append(stuff[row][col]);
        output.append("\t");
    }
    output.append("\n");
}
jTextArea1.setText(output.toString());

You just need to put together a string representation of each Adult object in your array and append those together into a single larger string that you can put in the text area.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It really depends on what you need to respond to. You can use key bindings in Swing: http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html
or you can use a KeyListener: http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, generally you only need to create a custom exception if you are wanting to pass along additional information that wouldn't be possible with one of the standard exceptions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Map is complicated? What is complicated about a key-value pair look up?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Specifically, you probably want to throw an IllegalArgumentException. You can set whatever message you want in the constructor.

stephen84s commented: The best option +7
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's as simple as incrementing by 2

for (int i=1; i<200; i+=2){
    System.out.println(i);
}

The printf documentation isn't the easiest read in the world, but here is how you can limit to 3 decimal places

double d = 4444.3434545;
System.out.printf("%.3f \t\t  %.3f      ", d, d*2.2);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, posting this in the Java forum isn't going to help you much.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>Caused a real stink locally.
The doll part or the homeless guys? :P

GrimJack commented: the homeless are a dime a dozen here - not much call for them, heh,heh -2
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That certainly isn't the only logic problem. Why are you opening and reading the same files over and over for each portion of your split() result?

I'll mention one last time: read up on HashMap.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just loop through the array and have a variable that keeps track of the highest. If the current array element is greater than that value, set the value to that elements value.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So just add them. I don't understand what part you are having trouble with

double total = weight[a][0] +weight[a][1] +weight[a][2];

String concatenation has nothing at all to do with math operations on variables.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

First, you start your own thread and pay attention to what you are typing so it actually makes sense (punctuation would be a bonus).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>If my assignment is right let me know but I need someone to explain to me why it is right.
Why? Are you completing them through automatic writing or channeling or something?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>Wouldn't that make religion a conjecture?
Well, it certainly is not a theory.

(Ancients is the word you're looking for, not "Achients")

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're correct that you need to create a copy of that object before you alter it. Using '=' is setting the two variables to be references to the exact same object in memory, hence it reflects the changes. If your Matrix class doesn't implement the clone method then you will have to take whatever steps are necessary to create a copy yourself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Or just step through and add every letter to a Set.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, it's definitely tough to fight with the urges constantly for days on end but it does get much easier to brush them off after about 3-4 weeks. The first 3 days are the absolute worst of it.

Thinking about the fact that I had already smoked 23 years and wondering how much longer I could get away with the roulette was enough to keep me from giving in - just barely though on many, many occasions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can clean it up a bit manually and save it as a bmp or png, but you can't just "unsave" the unwanted pixelation because it is now part of the image.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can be offended all you want, but Ancient Dragon is correct. MS Access is not good for large databases.

Just because you don't want to move beyond what you already know and are comfortable with doesn't make it a good solution.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sneek, you're asking this of a guy who wants to trade in a female companion for an operating system for his computer based upon a fantastical list of requirements written by some moon-eyed pre-teen girl - you're expecting lot if you want coherence.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Constructors can handle String[] just fine, but perhaps constructor writers cannot.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think it's a very necessary comment. Why on earth are you putting html forms into a JEditorPane?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Anyone can become a PHP programmer - or a Java programmer or a .Net programmer - it just takes effort and it's easier for some than others. PHP may have a slightly lower learning curve than some other languages but that does not make it trivial or a less useful language.

It sounds to me like your entire argument is rather useless.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can get that info from the MatchResult returned by the match() method.

It would probably be a lot easier to add a capturing group to your match pattern for the data you want to collect and extract it as part of the match result. More info on capturing groups (and regex in general) here: http://java.sun.com/docs/books/tutorial/essential/regex/groups.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>I add that html form in java using JEditorpane
Don't do that. Problem solved.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Look up HashMap in the API docs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>i'm prepared to leave either my email address or yours or a means of contact via the web ...
Ok, leave my email address and I'll contact it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The code you have posted is not Java.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do not hijack old threads merely to post "give me teh codez". If you have a question about an assignment, start a new thread and post the code that you have as a start.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Those are for the visual web designer do not apply to JTable.

See this tutorial on using JTable: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Caveat emptor.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, I guess I quit just before the recent price hike. I saw they're up to around $5.50 here. That's just crazy.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This may be useful if you are stuck with AWT: http://java.sun.com/docs/books/tutorial/2d/printing/set.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you're printing them through AWT, you'll probably need to use a Book for it. If you can get all of the content into a JTextComponent, it's printing API might make it a little easier: http://java.sun.com/docs/books/tutorial/uiswing/misc/printtext.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you want to look through any of them, I found some of these articles helpful: http://whyquit.com/ and Allan Carr's book "The Easy Way To Stop Smoking" is good too for dealing with the psychological "why" of smoking.

It took me many months (years?) of "next week..." or "in a couple of days..." before I bit the bullet and just put them down. It's still weird sometimes to not smoke, since I smoked for my entire adult life (23 years, started at 15), but realizing there is not one positive thing to offset all the negatives keeps me from picking up another one. If you decide to get free again, good luck!

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For future reference, the quickest way to not get help is to put "URGENT" in a thread title.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Also, note that most angle parameters to the Math methods are in radians, not degrees.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Add System.out.println() statements in the calculations themselves so you can debug the intermediate results.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are plenty of resources listed in the "Starting Java" sticky thread at the top of the Java forum. Start with that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just ran across a link to this thread so I thought I would update: I quit two months ago. One less smoker in the world.

Ancient Dragon commented: Great Job :) +36
jasimp commented: Congratulations :) +9
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You don't actually know many programmers, do you?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

sillyboy is correct in what's causing the problem and, with your particular code above, String.equalsIgnoreCase() would save you having to check the multiple forms separately.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>thats my main class.
I think you mean that's the main class you copied from someone else and can't get to run.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Then why did you post the question in the HTML forum - especially when you already have an active thread on this in the Java forum?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And what I meant was that you need to frame specific questions or post errors that you are getting. No one is going to just "fix it" because you posted some code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

See blackcompe's response above.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You don't include the parameter types in a method call. Remove them and only pass the variables by themselves:

Store.changeLoanStatus(bookname, authorf, authors);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Looks absolutely useless - except to spam ad links along the edges.