masijade 1,351 Industrious Poster Team Colleague Featured Poster

If it is a "distributed" app, I assume you have a GUI. Look at the JFileChooser class.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So find a JavaScript forum.

Java != JavaScript

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Regardless of the fact that the thread is well over a year dead, I doubt the OP's ability to use the resources, considering the OP's ability with Google.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

On the line

pop = 4 * double pow(e, t);

is the class name that the method "pow" belongs to double or Double, and isn't there a character missing between those two words (yes, there is a character missing)?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I still don't understand exactly what you want.

If this is a web application, then the "File" and "DeskTop" classes don't come into play (if you mean an application used through a browser), and so I don't know what you're getting at.

If it is not a web application, but rather a "distributed" application, then you would insert books using the same connection as you do to query them. In this case, see Sun's JDBC Tutorial.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Without mentioning any classes, describe exactly what it is you want to do again, because the first post, to me, doesn't make much sense.

Where is the "file" coming from?
Why do you need to "copy" it?
And, if you are copying it, why don't you know where you are copying it?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Off topic - I guess somebody nailed your a$$ masijade :D , or somebody uses same name on Sun forum (highly unlikely)

No. It's my nick, and DeskTop, and getDeskTop are valid, it's "Copy" and "Move" that don't exist. ;)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Where are you getting these methods from? Neither I, nor the API documentation, knows anything about them.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Request all developer to send codes....

Thanks in advance

What a maroon.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Where did you download Mozilla from?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Ask them, maybe?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Debug the code to find the actual type number returned and what it equates to. If you don't know how to use the debugger then print out the varying types at the top of the method as follows

System.out.println("Integer TYPE:  " + Types.INTEGER);
  System.out.println("Float     TYPE:  " + Types.FLOAT);
  ...

Then, just before the switch do

System.out.println(rsmd.getColumnType(1));

And see what that equates to.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Maybe you can get one of your fellow grade schoolers to do it for you for that price. If you multiply the price by ten, you may get some semi-competent unethical "working person" (I won't say professional) to do that simple thing for you, but I wouldn't expect quality, even then.

Salem commented: Quite so. +29
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Those are not tcp/ip commands. Those are simply executables (of whatever form) for a specific OS whose purpose just happens to be in listing/verifying/modifying interface/network information.

In any case, every language has the ability to perform (at least most) of those actions, just not in a one method "here you go" method call. No language, AFAIK, has those processes as single-method "here you go" methods/functions.

Edit: As an example, all of the information listed in an ifconfig command is available in Java using the NetworkInterface class. You can't, AFAIK, change any of that info using that class, like you can with different options to ifconfig, but you can see it.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Are you actually asking us what you should include on your resume to fake one years experience in Java?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And don't forget to acknowledge the help you received here to your instructor, ah, I mean friend, of course. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Every IDE available that allows the development of Web Applications, have an option to create a "war" or "ear" file of the application, which then needs simply be imported by the web container / application server in question. There is no need for any type of Windows style "installer" program.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Your "web application" should, obviously, be deployed to a web container, and then, as long as the app is set to "autostart" in that container, starting that container will start that app (and the container usually does have "an exe", as you all like to say).

If you have a completely standalone program that does it's own ServerSocket and protocol work, then create a jar, they are also "double-clickable" (as you all like to say).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You need to use a session to keep track of what the user has entered, then during the loading of each page, you can check whether a session key exists for that question, and if so, check the radion button for that answer checked.

Peter's answer was a suggestion of what you should do, not a question about what you are doing.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Use the "getters and setters" properly?

If you show your code (and use code tags), we could probably give a better answer.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I am quite sure that you can, the question then is, however, "Will the monitor/graphics card support it?" And the answer to that is "Probably not".

masijade 1,351 Industrious Poster Team Colleague Featured Poster

And to follow up on what Masijade said, you can use the Scanner class to do so. Google for Scanner class documentation as well as the java sun tutorial on use of the Scanner class.

Among other things.

masijade 1,351 Industrious Poster Team Colleague Featured Poster
int answer;

System.out.print("Please type a number < 1 for Ali, 2 for Ahmad, 3 for Ah Chong, 4 for Muthu, 5 for Ramasamy >: ");


if(answer == 1)

Where, above, do you give "answer" a value?

The answer, you don't. I assume you want to read user input some time after the println and before the if?

Salem commented: I think they outsmarted themselves with your signature ;) +29
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Your problem, is that with a JDBC connection

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/","root","");

You must provide a db instance. Since you're connecting with root, anyway, use "mysql". But, I would advise against using this, and against using root.

Connect to test.

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

I would strongly advise against doing any of this, though. Create the "base" DB once, localy, on your development machine, the way you want to see it by the client, then mysqldump that DB, then modify this dump file and add the sql commands necessary for creating the application user and granting it it's rights. Then have the client simply execut this file with the mysql command with a redirect indut (or, if you absolutely must have the app do it, then use a runtime exec).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I just say it, because I am assuming (you know what they say about that word, although I feel it is correct this time) that the OP is attempting to find someway to get his GUI (whatever form that may take) to update whenever something happens to the backend DB.

And, I can only hope, that it is not one client making a change and another client hoping to catch it. If the server is written properly (using an MVC architecture and registering and using listeners or observers or whatever) then the clients should not need to poll anything, as the server should be contacting every concerned client everytime one of them changes something.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

A trigger will not be able to notify the DB. The "easiest" way is to set an autoupdating timestamp field on the concerned table, then, every so often, retrieve all records with a timestamp newer than the last time you checked.

To repeat, the DB cannot (at least in the frame of JDBC and "normal" Java) notify the program, so the program needs to poll (i.e. periodically query) the DB.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

You would need to occassionally "poll" the DB (and hopefully you have a timestamp field to make it "easy").

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Then check in VB and or Batch forums as this forum is for Unix Scripting, as Windows Scripting is referred to as either VB or Batch, not Shell, Scripting.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

So, I assume "AppStarter" extends JDialog? And, I assume you are wanting to cahnge the Image on the title bar, and or task bar?

Also, in this case, it is JDialog's Icon, not JFrame's Icon, as you won't have a JFrame here.

Also, try using the setIconImages method and pass it a List containing the same image several times. I.E.

Image i = new ImageIcon("untitled.gif").getImage();
    dialog.setIconImages(Arrays.asList(new Image[] { i, i, i, i, i, i }));

Just a WAG, as I haven't tried changing the Icons, myself, in a very long time.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

type "time" at the command line and check it out.

Then type "man time" at the command line and read that carefully (assuming, of course, that you are using a Unix system, as that is what this forum concerns).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

See the "time" command.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Could we see the "AppStarter" code. At least the constructor, and the setIconImage method (if you have overridden it).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I'm not certain, but I think you are simply hitting up against some "minimum size" type restrictions. As you can see the orange (dark yellow?) square is the same size as the green and yellow squares and it's relation to the red square has become even more skewed than the other relations, but it still has the same size as the yellow and green. In any case, the code is correct, and I don't know of any other way to "do it" that would have any chance of changing what you're seeing.

Sorry. I won't, at this point, be able to contribute anything else to this thread. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Actually, the thing you need to remember is that weightx and weighty are column/row weights. They don't apply to the component to which they are added to they apply to that component's column and row. So, the combined and conflicting weights you provided were counter productive and couldn't be fulfilled, and since nothing existed in column 2 alone, its width was compressed to a pixel or three (if anything at all).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

There is a Java3D API library available. Google for it. ;-)

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Give it a try, but remember that if you need to retreive the "rows" from the Map in the same order in which you inserted them, then make sure you use a LinkedHashMap, and not a standard HashMap or TreeMap

masijade 1,351 Industrious Poster Team Colleague Featured Poster

A slight correction, since set returns the previous element.

// could also be void, make Vecotr so that it can be "chained"
	public Vector sortContacts(Vector v) {
	   for(int i = 0; i < v.size() - 1; i++) {
		   ContactListLabel cll = (ContactListLabel)v.elementAt(i);
		   for(int y = i + 1; y < v.size(); y++){
			   ContactListLabel cll2 = (ContactListLabel)v.elementAt(y);
			   if(cll.getNameLabel().toLowerCase().compareTo(cll2.getNameLabel().toLowerCase())> 0){
				   v.set(i, cll2);
				   cll = v.set(y, cll);
			   }
		   }
	   }
	   return v;
	}

Very minor difference, but you just well use what Vector provides. ;-)

peter_budo commented: Neat solution, I :* +16
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I would have done it this way (as long as you can modify the Vector passed in, conceptually, as technically you can).

// could also be void, make Vecotr so that it can be "chained"
	public Vector sortContacts(Vector v) {
	   for(int i = 0; i < v.size() - 1; i++) {
		   ContactListLabel cll = (ContactListLabel)v.elementAt(i);
		   for(int y = i + 1; y < v.size(); y++){
			   ContactListLabel cll2 = (ContactListLabel)v.elementAt(y);
			   if(cll.getNameLabel().toLowerCase().compareTo(cll2.getNameLabel().toLowerCase())> 0){
				   v.set(i, cll2);
				   v.set(y, cll);
				   cll = cll2;
			   }
		   }
	   }
	   return v;
	}
masijade 1,351 Industrious Poster Team Colleague Featured Poster

See if you can spot the reason. If you can't just ask. ;-)

import java.awt.*;
import javax.swing.*;

public class GridBagExperiment extends JFrame {
	JPanel redPanel, bluePanel, greenPanel, yellowPanel;
	double col1Weight = 0.4;
	double col2Weight = 0.2;
	double col3Weight = 0.4;
	double row1Weight = 0.4;
	double row2Weight = 0.6;

	GridBagConstraints gbc;
	Container container;

	public static void main (String args[]) {
		GridBagExperiment gbe = new GridBagExperiment();
	}

	public GridBagExperiment() {
		setSize (400, 400);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		container = getContentPane();

		redPanel = new JPanel ();
		bluePanel = new JPanel ();
		greenPanel = new JPanel ();
		yellowPanel = new JPanel ();
		redPanel.setBackground(Color.RED);
		bluePanel.setBackground(Color.BLUE);
		greenPanel.setBackground(Color.GREEN);
		yellowPanel.setBackground(Color.YELLOW);

		GridBagLayout gbl = new GridBagLayout();
		container.setLayout(gbl);
		gbc = new GridBagConstraints ();

		AddPanel (redPanel, 0, 0, 1, 1, 0.0, 0.0);
		AddPanel (bluePanel, 1, 0, 2, 1, 0.0, 0.0);
		AddPanel (greenPanel, 0, 1, 2, 1, 0.0, 0.0);
		AddPanel (yellowPanel, 2, 1, 1, 1, 0.0, 0.0);

		gbl.columnWeights = new double[] { col1Weight, col2Weight, col3Weight };
		gbl.rowWeights = new double[] { row1Weight, row2Weight };
		setVisible (true);
	}

	public void AddPanel (JPanel panel, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty) {
		gbc.gridx = gridx;
		gbc.gridy = gridy;
		gbc.gridwidth = gridwidth;
		gbc.gridheight = gridheight;
		gbc.weightx = weightx;
		gbc.weighty = weighty;
		gbc.fill = GridBagConstraints.BOTH;
		add(panel, gbc);
	}
}
VernonDozier commented: Thank you. +12
masijade 1,351 Industrious Poster Team Colleague Featured Poster

I can't see the bit where you add the TextArea to your JPanel or any part thereof (?)

Because he's adding it to the ScrollBar (which is why it should probably be a ScrollPane).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

I think you want

final JScrollPane scroller = new JScrollPane();

and not

final JScrollBar scroller = new JScrollBar();
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Well, seeing as how we have no idea what you did, we have no idea what's wrong with it.

Salem commented: Tsk Tsk, you mean you lost your magic crystal ball which allows you to remote view other peoples code ;p +29
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Hi,

I am new to java I have a project to be done with early deadline. Can u please help me how to write code in java to send GET request to server from client. Thank you in advance.

So, you accepted a job you're not qualified for, or you're in college and waited until the last minute to start on your project. In either case, you now want us to do your work for you. Sorry buddy, it's not going to happen.

I will tell you to the read the API documentation for HttpURLConnection, then give it a try, then post the code and all compiler/error messages you're getting and we will help.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

All that for a three year dead thread?

masijade 1,351 Industrious Poster Team Colleague Featured Poster

here then

change

String indexAmount = JOptionPane.showInputDialog (null, "Please enter the amount of numbers you will enter");
         int pIndex = Integer.parseInt(indexAmount);

                while (pIndex <= 0)
                {
                JOptionPane.showMessageDialog (null, "That integer is not valid. Enter an integer greater than 0");
                indexAmount=JOptionPane.showInputDialog(null, "Enter the amount of numbers you will enter");
                pIndex = Integer.parseInt(indexAmount);
                }

to

int pIndex = 0;
         while (pIndex <= 0) {
             String indexAmount = JOptionPane.showInputDialog (null, "Please enter the amount of numbers you will enter");
             try {
                 pIndex = Integer.parseInt(indexAmount);
             } catch (NumberFormatException nfe) {
                 pIndex = 0;  // just to be sure
             }
         }
masijade 1,351 Industrious Poster Team Colleague Featured Poster

Try making a "smaller" try/catch block (i.e. only around the "pIndex =" line).

Edit: And, that way, you can, of course, simply do nothing in the catch block (although you would, normally, at least log the fact that the exception occurred, even if you don't do anything about it).

masijade 1,351 Industrious Poster Team Colleague Featured Poster

No, there isn't. It sounds like you're talking about operator overloading, which Java, by a conscious decision, does not have.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Start the program with an administrator user and don't give the users administrator privileges.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

"It doesn't work" is absolutely meaningless.

What is the desired result and what is the actual result?

Run it through a debugger.

masijade 1,351 Industrious Poster Team Colleague Featured Poster

Post the errors you're getting.