Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

what was the need for this, if the problem is solved please mark the thread as solved

I would rather ask what was the need for this post of yours? You dragged up a two year old thread to ask that it be marked solved?

You've done this recently on several threads that you did not even contribute to. I fail to see how that is helpful and only serves to bump old threads for no reason.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I guess you would have to either write a constructor that takes the radius as a parameter for your Circle class or use the Circle default constructor and set the radius through your method.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It is telling you that the Circle class does not have a constructor defined that takes a double parameter.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is rather amusing. I posted a long, insightful write up on why I don't use Windows. And guess what - my reputation is instantly modded down. Now why would that be. Is it possible that Microsoft Trolls hang out here?

I think so.

Perhaps because your entire post comes across as a long troll? I didn't find much of it very insightful - just another anti-Microsoft rant.

/yawn at your indignation.

majestic0110 commented: Agreed +0
tux4life commented: Seconded +0
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please keep in mind that although ArrayList might be a better choice, students may be required to use arrays on certain assignments as part of their course progression.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can use 3D apis like OpenGL or Java3D - or you can apply the perspective transformations yourself to generate the 2D representations.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

kimbsan,
This is not a "code by request" site. No one is going to just send you this code. Show some effort and post your code with specific questions in the appropriate forums when you get stuck.

It's up to you to make the effort first though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Keep in mind your array elements ("slots") are null until you put something in them. If you declare the array to have 10 and only fill three then the remaining seven will throw errors if you attempt to read data from them - hence a "null pointer" error.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The super.paintComponent() call just let's the component perform whatever normal painting the super class would if the method weren't overridden.

To the OP: you may want to glance over this bit of info on the Swing painting mechanism: http://java.sun.com/docs/books/tutorial/uiswing/painting/closer.html

Your paintComponent() code is painting the JPanel portion and then paintChildren() renders the other components (such as the label with image) on top of that JPanel area.

If you created a class that extended JLabel you could paint over its icon image just fine by placing your custom code after a super.paintComponent() call.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You declare it as an array of CD objects, like so

CD[] cdList = new CD[10];

and create them in the array like so

cdList[0]=new CD("Kaiser "," up the khazi ", 9.99);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can see an example of drawing multiple shapes here: http://www.daniweb.com/forums/post951298.html#post951298

The point of that post was to show how make a shape draggable with the mouse, but you should get the idea of how to draw more shapes pretty easily.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Start with the information in the Read Me: Starting Java thread stickied at the top of the forum. That is exactly why it was put together.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

As a general rule, threads are not deleted upon request. Once it's posted, it's out there for good.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

How does the action for point1 differ from point2? That is what matters for the mouse handler.

Do you actually have a frame class called NewWindow? Does it make itself visible in it's constructor?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have an outline, so start coding. If you get stuck, post your code and specific questions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You already know which point was clicked, because that point itself is the mouse handler, so all you need to do is create and show the new frame. You can pass whatever information you need from the point label to the frame.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think it offers a lot of good material and things to think about to someone young in the industry.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't see how giving you the code for that is going to help you at all. The whole point of the class is to learn something and that doesn't mean turning in something you got from the 'net.

Think.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You could use something like this in your MapPanel to manage the "spots"

import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.*;

public class MapPanel extends JPanel {

    Image map;
    ImageIcon spot1, spot2, spot3, note;
    JLabel point1, point2;

    public MapPanel() {
        Toolkit kit = Toolkit.getDefaultToolkit();
        map = kit.getImage("cebumap.jpg");

        spot1 = new ImageIcon("spot.gif");
        point1 = new MapLabel(spot1, "p1");
        point1.setBounds(168, 30, spot1.getIconWidth(), spot1.getIconHeight());

        spot2 = new ImageIcon("spot2.gif");
        point2 = new MapLabel(spot2, "p2");
        point2.setBounds(203, 55, spot2.getIconWidth(), spot2.getIconHeight());

        setPreferredSize(new Dimension(457, 540));

        setLayout(null);
        add(point1);
        add(point2);
    }

    public void paintComponent(Graphics comp) {
        Graphics2D comp2D = (Graphics2D)comp;
        comp2D.drawImage(map, 0, 0, this);
    }

    /** Small convenience class to manage all of your special point label functionality in one place */
    class MapLabel extends JLabel implements MouseListener {
        Icon icon;
        String name;

        public MapLabel(Icon icon, String name) {
            this.icon = icon;
            this.name = name;

            setIcon(icon);
            setToolTipText(name);
            addMouseListener(this);
        }

        public void mouseClicked(MouseEvent e) {
            JOptionPane.showMessageDialog(this, "You clicked " + name);
        }

        public void mouseEntered(MouseEvent e) {
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }

        public void mouseExited(MouseEvent e) {
            setCursor(null);
        }

        public void mousePressed(MouseEvent e) {}
        public void mouseReleased(MouseEvent e) {}
    }
}
nagatron commented: Impressive, Great, Good Job +2
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
nagatron commented: Thank you again for the help. . .eventhough I am anoying. .hehehe +2
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

- Labels do not have to be opaque. setOpaque(false); - setLayout(null); will allow you to place a component anywhere you like.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I already gave him a link to a tutorial that demonstrated this, but obviously he didn't feel compelled to read it (nor the instructions to use code tags).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Doing those things would be much easier if you use JLabels to hold the "spot" images:
http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you actually asked a question then perhaps someone could answer it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You'll need to use JNI: http://java.sun.com/docs/books/jni/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Welcome back :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The only tags on my profile are "give me teh codez" and "spam magnet". :)
They are still small though. "give me teh codez" should be much, much larger. I'll have to work on it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The tutorial on using icons also has an example of using JLabels for this: http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would recommend reading Code Complete, 2nd Edition.

majestic0110 commented: Good Book! +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

He did tell you how to do it. Read the last two sentences again carefully.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, if the catch expression is appropriate to catch that particular exception type. The exception will be passed up the call stack until it is handled or causes termination.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's telling you that you can't use constructors that don't exist.

majestic0110 commented: Beat me to it lol :) +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There is a little red triangle icon in the upper righthand corner to report the private message. It's in the same frame as the title of the PM.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That would depend on the details you haven't supplied - such as where this data is coming from.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

float discount = 0.25f;

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Edit: Nevermind, I misread.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just add placeholder columns on the smaller query, such as "null as code" or "0 as code".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You solve it by keeping up with your coursework and asking specific questions in the appropriate forums when you cannot figure it out on your own.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You may as well change the method parameter to Component, since anything you would want to add like that would extend Component.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just copy everything from lines 3-10 into your method and change the variables to use your method parameters.

KirkPatrick commented: I didn't realize object had to be changed to component. Thanks for the help bud +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I can only point to the docs:
http://db.apache.org/derby/docs/10.5/devguide/cdevdvlp40350.html
and experimentation with the path you're using in the connection string.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You proceed by reading the documentation provided and asking specific questions when you are confused about something:
http://dev.mysql.com/doc/refman/5.0/en/connector-j.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, that is just a path issue.
http://db.apache.org/derby/docs/10.5/devguide/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your code is loading the EmbeddedDriver class, but using the ClientDriver network url for your connection string. The EmbeddedDriver uses the database name instead of the //servername url.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

File > New Project...

jasimp commented: haha +12
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And what do you figure you are going to learn from that?

Show some effort and ask specific questions if you want anyone to help you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hi, i'm vyshak. I'm at final year and am thinking of doing a project on Java.
Can you please name some websites where can i get java projects with source code. Kindly, help me!

Doing a project and downloading the source code of a completed one are not the same. Perhaps you aren't ready for your final year if you can't understand that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use setIcon() instead of setText() in your action listener.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

mseck, it sounds as if you are working with Javascript, which is not the same as Java and there is a separate forum for that here: http://www.daniweb.com/forums/forum117.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm not sure what part you are confused about, but "process cant assign to an object" doesn't have anything to do with what I said.

This tiny example shows what I was referring to.

try {
    Process[] proc = new Process[2];
    proc[0] = new ProcessBuilder("calc.exe").start();
    proc[1] = new ProcessBuilder("notepad.exe").start();
    
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ex) {
    }
    
    proc[0].destroy();
    proc[1].destroy();
    
} catch (IOException ioe) {
    ioe.printStackTrace();
}