Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your question is not clear. Perhaps if you restate it with a little more detail it would help.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, you don't have a no-argument constructor defined in the class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It actually sort of did concern me since I had the same problem and I am in the same boat. I understand that you want to try to teach folks so that they learn themselves. That is noble.

So I'll just end with thankyou for your assistance. Those of us that are not in the know appreciate it when those that have the knowledge are willing to assist in anyway that they can.

The assistance is offered with the stipulation that the poster is making an effort to understand the problem and learn. In the other post that masijade is referring to, there is no effort discernible. It was just a "fix it for me" attitude and when the exact solution was not handed out the poster created a new thread to ask the same question, rather than working through the explicit hints that were given or asking questions to clarify points not understood.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

They are in different packages, so you need to import those classes or put them in the same package as the inventory class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, that's correct. You want to set "thirdVar" equal to the expression "firstVar + secondVar".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"thirdValue" needs to be on the left side of the assignment operator in the form variable = <expression>

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

HI

I m using excel as a database...

Bad idea. Use a real database if you need a database.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are better off using a regular expression pattern for things like that. Here's a tutorial link: http://java.sun.com/docs/books/tutorial/essential/regex/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you have the jdbc driver jar for Oracle, the best place to start is with the Sun tutorial on jdbc: http://java.sun.com/docs/books/tutorial/jdbc/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That is part of the "Commons-lang" jar, you can probably figure out where it's residing by looking in your library references in Eclipse.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is another good source for small code snippets demonstrating all kinds of things in Java:
http://www.exampledepot.com/index.html

It only covers Java 1.4, so newer language features in 1.5 and 1.6 will be missing, but most of it is still very relevant.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The Sun tutorial should cover it pretty nicely: http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html

Keep that Swing tutorial trail bookmarked because there is a wealth of info and demo code on using the various components.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

ok, i need help adding to a list after the list have been made. Its the only thing stopping me from getting this thing done, help please....

import java.util.Scanner;
import java.io.*;
import java.util.*;

public class Dairy {

    public static void main(String[] args) {
        Scanner keyboard = new Scanner(System.in);
        String[][] job = new String[200][7];
        int choice = 1;

        System.out.print("Please enter the amount of friends you want to enter in the start: \n");
        String Friends = keyboard.next();
        int friends = Integer.parseInt(Friends);
        System.out.println();

        while(choice!=0) {
            System.out.println("Please choose an option: "+"\n1. Create your friend list with information."+"\n2. Edit an entry."+"\n3. Add a friend to the list."+"\n4. Sort your information."+"\n5. Print the information to the console."+"\n6. Send your friend information to .txt or .doc file."+"\n0. To Exit the Program.");
            System.out.print("\nPlease make your choice by number: ");
            /* Reads in Choice for menu */
            String Choice = keyboard.next();
            choice = Integer.parseInt(Choice);

            switch(choice) {
                case 1://Enter in People
                    for(int x = 0; x<friends; x++) {
                        System.out.println("Information for friend "+(x+1)+": \n");
                        System.out.print("Enter in the friend's First Name: ");
                        job[x][0] = keyboard.next();
                        System.out.print("Enter in the friend's Lazt Name: ");
                        job[x][1] = keyboard.next();
                        System.out.print("Enter in the friend's email: ");
                        job[x][2] = keyboard.next();
                        System.out.print("Enter in the friend's School(No Spaces): ");
                        job[x][3] = keyboard.next();
                        System.out.print("Enter in the friend's classification: ");
                        job[x][4] = keyboard.next();
                        System.out.print("Enter in the friend's major(No Spaces): ");
                        job[x][5] = keyboard.next();
                        System.out.print("Enter in the friend's number of pictures: ");
                        job[x][6] = keyboard.next();
                        System.out.println();
                        System.out.println();
                    }

                    break;
                case 2://Edit Entries
                    System.out.println("What would you like to Edit?"+"\n1. Frist Name."+"\n2. Last Name."+"\n3. Email …
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's in the list in the second link that you posted above, but it's the last one. I haven't tried any of the others (I have enough to do without playing with different install builders and IzPack worked :) )

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@OP
Refactoring does not necessarily mean "poorly written". It simply means you want to accomplish what is being done ina different manner.

Yes, that's a good point worth noting.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

We use IzPack here and it works fine for our purposes.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ah, I misunderstood you. I thought you wanted to add refactoring capabilities to an existing editor.

Other than Google, I couldn't say where to find a poorly written program that you could use for demonstrating refactoring - but I'm sure there are a ton of them out there ;)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

While not really being "infinite", while(true) { } loops are seen fairly often in concurrent processes for things like polling for tasks in a work queue. They execute in a try-catch block for InterruptedException and that provides the mechanism for shutting them down gracefully.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You might look at jEdit. Source code is available and it also supports plug-ins. You may be able to do the work as a plug-in instead of trying to modify the source itself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a look at the Java Media Framework. Some of the demo solutions here http://java.sun.com/products/java-media/jmf/2.1.1/solutions/index.html may be useful.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your classes should provide methods to access the information that is needed. To call those methods, you need a reference to an instance of that class. I'd recommend reading through some of this material http://www.faqs.org/docs/think_java/TIJ304.htm

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Compare strings with String.equals(), not the "==" operator.

user.equals("admin")

or if you want to avoid null pointer issues

"admin".equals(user)
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You might want to take a look at the free online book Thinking In Java, 3rd Edition. It is a bit dated since it doesn't cover any of the Java 1.5 or 1.6 changes, but the language basics are still solid and you'd probably find it a good reference for questions like this.
If you prefer an offline copy, you can download it as a PDF here: http://mindview.net/Books/TIJ/DownloadSites

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

...I am using the java.awt.Graphics.drawString and drawImage methods to draw each part of my object. If I have set my graphics component's font to have a size of 12 say, does this mean that each character takes up 12 x 12 pixels?

No, it's a little more complicated than that, but still easily available. You'll need to call Graphics.getFontMetrics() to obtain the font metrics for the current font. FontMetrics provides methods for obtaining dimensions of a particular string for that font and graphics context, such as getHeight() and stringWidth(java.lang.String). That should be all you need to center up any given string on your image.

Edit: You can find more detailed info on FontMetrics and handling text in the graphics context if you need it in the 2D graphics tutorial: http://java.sun.com/docs/books/tutorial/2d/text/measuringtext.html

darkagn commented: Thanks for the tips :) +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Here is a place to start: http://java.sun.com/docs/books/tutorial/2d/index.html

(Assuming you mean drawing graphs, not graph data structures)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The only way that you would be able to set the system time is through JNI calls to the OS.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Netbeans does have a plugin Eclipse Project Importer, I don't know if it's part of the standard install and I have not used it personally. You might want to look at it if you have several projects in Eclipse. Plugins are managed through the Tools > Plugins menu.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The JDK does come with the JRE bundled in and no, I don't believe you can get just the JDK portion by itself.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are some, but I would say they are fairly trivial. Both are good open-source IDEs and really the choice will come down to your personal preference. Try them both and use the one you like better.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Between the built-in help, the Start Page (Help > Start Page), and this tutorial http://www.netbeans.org/kb/60/java/quickstart.html (which is actually the one that the Start Page takes you to), you should have plenty of documentation available.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, actually your matchlist class has nothing at all to do with the interface. If you are going to separate them, make sure you know why and what each of them is supposed to do.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You still have no reference to that instance, so whether they are public or private makes no difference. You can't call methods on objects you don't have a reference to.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Those text fields are in another class. You can't just access private variables in another class. Matchlist shouldn't be setting those values directly anyway. The interface should call methods on MatchList to get results and then set the text in it's text fields as needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would add System.out.println(chatText); after the code that reads from the socket to make sure you're getting the response because your there's nothing wrong with the chat.append() statement.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can either use a Calendar and set the day, month, year, time values individually or if you have an existing string date that you need to parse you can create a SimpleDateFormat and use the parse(String) method to convert it to a Date object.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are replacing "chatText" with every line that gets read from the stream. I believe you probably want to append the new text to "chatText" instead of replacing it.

String response = "";
while ( (response = in.readLine()) != null) {
    chatText += response+"\n";
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, Calculator actually uses Fraction, so really Fraction should be an inner class of Calculator if you have to combine them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's an HTTP request to the adserver. Ad blockers prevent that request from being made.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The same as you load any JFrame.

pay payFrame = new pay();
payFrame .setSize(500,500);
payFrame .setVisible(true);

(It wouldn't hurt to read Sun's recommended coding conventions document either: http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html Class names should be capitalized so as not to be confused with a variable or method name)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just put [code] before and [/code] after your code - or highlight it and click the code tag button at the top of the editor (the advaced editor, not the little quick reply one at the bottom of the thread)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the code in CODE tags, the exact error, and what about it you don't understand.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This version

int max;

for (int i = 0; i < array.length; i++)
{
   if(max < array[i])
   {
      max = array[i];
   }
}

will not compile. You will have to initialize max to something - either the first value of the array or Integer.MIN_VALUE.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If by "help here" you mean "write this for us", then no, I'm afraid not.

See the Announcement at the top of the forum regarding homework help:
http://www.daniweb.com/forums/announcement14-2.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
int qDifference = q[1] - q[0];

or even more explicitly

int qDifference = q[index] - q[index-1];

I really don't see how I could give you any more than that without writing it directly in your program (which, before you ask, I will not do).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you have all of the data - just make the calculation. For each division you have each quarters numbers, so that is a simple subtraction of one quarter total from another. The same is true for the company after you have finished the "qtrtotal" array calcs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Code up what you can and if you have troubles post that code with your questions. Writing the code for you isn't the point of the forums.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't see any code to make those calculations, so I guess that is "trouble" you are having?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I flagged it as a "Bad Post" with a note about the copyrighted code so a moderator can edit that out. Users can only edit their post for 30 minutes after it's been posted.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't really understand why you are striping the data into those arrays quite like that (if I'm even reading your intent correctly), but I guess that's beside the point. I'd recommend keeping a 12 element array of the values you have read from the file, place the "input" values into the correct positions in your "input" array, copy over the "outputs" in the same manner, read the next item from the file, roll off the value you no longer need from the working array and add the new value, and repeat the whole process until you have reached the end of the file.

You can maintain a "head" index to the "first" data item in the working array and not bother with actually shifting the array contents in memory. To add a new item just advance the head index and overwrite the value at the previous insertion point. The copy operations should start from that head index.

Hopefully that makes sense and I haven't misunderstood how you are wanting to write out the values.

Edit: If you don't know how many elements will be in the file, you'll also have to manage the resizing of the target arrays as well, obviously.