Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to main the references to the buttons if you want to be able to alter their properties. An array or list would suffice.

Just so you're aware, many of the LookAndFeel implementations don't show button background changes well. JLabels set to opaque with a raised bevel border might work better for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can use:

ExceptionCode.values()[code];

to access the values array by declaration index. (I can't put that in code tags though because it contains half a code tag :) )

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have paymentFormat declared as Object, but I'm assuming it should be a DecimalFormat?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The first two posts both gave links on how to accomplish this. Did you read them?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For website review, you can make a post in the Website Reviews forum with a link to your site.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, your errors are mostly stemming from the fact that you've mangled in together a couple of different classes and have braces/blocks scattered all over the place.

Fix your class structure and you'll have a place to start. Half of that code isn't even in a method at all.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please post the exact exception info when you are referring to one. We can't quite see over your shoulder from here.

One thing to note first. You are declaring new variables and initializing them in the constructor

public PayrollTracker()
	 {
	   final int NUM_EMPLOYEES = 7;
	 	int[] employeeID = {5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489}; // employee id in an array
		int[] hours = new int[NUM_EMPLOYEES]; // int array for 7 employees hours
		double[] payRate = new double[NUM_EMPLOYEES]; // double array for payrate of 7 employees
		double[] wages = new double[NUM_EMPLOYEES]; // double array for the wages of 7 employees
	 }

Drop the type info from the front of those if you want to initialize the variables you've declared at the class level.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You haven't posted enough code for anyone to help with this. What context are those calls being made in? What is "fixdecimal"?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The docs are not vague. Did you bother to read the FAQ?

Just download the jar files and add them to your Netbeans project. If you don't know how to do that, read the Netbeans help files.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm guessing it's this interactive design form? https://alliancetag.com/tagdesign.aspx

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You forgot to mention the exact problem.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You really should consider using a Timer for your slideShow() method and ditch doPause(). You don't want to use a loop like that for pausing.
http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Haven't you learned anything from your previous posts asking others to do your work for you?

Get to work and show some effort.

Salem commented: Apparently not. +20
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, you've just dragged up a year-old question that has already beed resolved and posted some code with no explanation. Do you think that is helpful?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You just glanced at the first page and didn't read any of it, did you? It explicitly covers drawing lines and geometry.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It looks like you're having trouble with your iterator. To access the next object you need

while( iterator.hasNext() )
{
    YourObjectType nextObj = (YourObjectType)iterator.next();
    if( nextObj.string3.equals( stringA ) )
    {
                
    }
}

Where "YourObjectType" is of course whatever object you're using that contained the strings.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You'll need a mechanism to associate the Light or Door object with the action for a given menu item. One way you might do it is with an action listener that takes a reference to the object you want to operate on, such as

class LightOnAction implements ActionListener{
    Light light;
    public LightOnAction(Light light){
        this.light = light;
    }

    public void actionPerformed(ActionEvent e) {
        light.on = true;
    }
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I dropped a label into a scroll pane and loaded an image that was larger than the viewport and checked mouse coords from label.getMousePosition(). They seem to work just fine. The coords are in the coordinate space of the scrollable target (ie they aren't limited to the visible dimensions of the scroll pane component.)

edit: Glad you got it working. There are usually several ways to get there with Swing :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Store them from the right-click mouse event perhaps?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What do you need to use them for? Typically you would get them from a MouseEvent with a MouseMotionListener on the component that needs to respond to them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Looks to be ProStores markup.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Try looking through the Sun tutorial on How To Use Editor Panes as a starting point. Also, be sure to look over Text Component Features

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you tried creating linked tables in an Access database to the MySQL data? You might be able to pull it through DTS that way.

MySQL dump files fed into the bulk loader for MS SQL may be another possibility.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's a copy of a broken color tag from javaAddict's code above. The bold and color tags don't work right with the java syntax highlighting in code tags. That line should just read

Scanner sc = new Scanner(input);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The quickest and easiest way is to use icons within labels. Take a look at this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you compiled Gen.java yet with 'javac'?

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

I'm running 64-bit Java 6u18 on Windows7 and it runs great. No performance issues at all that I have seen, and our app is extremely computationally intensive.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Dumb question, but I've searched everywhere and found nothing specific: is it possible for HSB values to translate directly into a colour (eg. a hue of zero equals red) instead of passing them through an RBG conversion?

See Color.getHSBColor(float,float,float)

Also, dumber: I'm not understanding the arrrays people are using, for example here and here.

Some of the methods take a three or four element array for the component values (rgb, rgba, hsb, etc) such as this one Color.RGBtoHSB(int,int,int,float[]) Read the API docs for the details on the parameter and return values for the methods you are wanting to use. The array sizes and ordering area specified.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

isCellEditable() gets called by the table when you double click a cell to see whether or not to the editor should be invoked. If you want to respond to a data change immediately, you'll need to use a TableModelListener most likely.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Closing the thread. I've had to delete too many offers of work for hire.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You may also want to consider creating a new "nextPoint" object in your loop instead of re-adding the same reference to the list multiple times and changing the x and y value each iteration.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

no i'm not ok.

what should i do?

Maybe a custom t-shirt would help you feel better?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm curious why you chose to drop this thread: http://www.daniweb.com/forums/thread271568.html and start a new one when you're still working on the same thing?

Did you get the program to work without these extra Point collections and just want to modify it now?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You would probably have a much easier time with GridBagLayout instead.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This version uses an offscreen buffer image to draw on. Erasing is trivial with this one, but you don't have the easy shape management like the other one. Hold down 'shift' to erase

class ScratchPanel2 extends JPanel implements MouseMotionListener, MouseListener{

    BufferedImage image;

    public ScratchPanel2(){
        addMouseListener(this);
        addMouseMotionListener(this);
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                panelResized(evt);
            }
        });
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.drawImage(image, 0, 0, this);
    }

    private void panelResized(ComponentEvent evt) {
        if (getWidth()>0 && getHeight()>0){
            // create new temp image
            BufferedImage tempImage = (BufferedImage)createImage(getWidth(),getHeight());
            // draw old image to the new one
            Graphics2D g2 = (Graphics2D)tempImage.getGraphics();
            g2.drawImage(image, 0, 0, this);
            // swap
            image = tempImage;
        }
    }

    public void mouseDragged(MouseEvent e) {
        Graphics2D g2 = (Graphics2D)image.getGraphics();
        g2.setColor(e.isShiftDown() ? getBackground() : Color.BLUE);
        g2.fillRect(e.getX(), e.getY(), 2, 2);
        g2.dispose();
        repaint();
    }

    public void mouseMoved(MouseEvent e) {}

    public void mouseClicked(MouseEvent e) {}

    public void mousePressed(MouseEvent e) {
        mouseDragged(e);
    }

    public void mouseReleased(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ah, I thought you wanted to erase the whole shape. Determining if a path contains a point is very easy, but like you mentioned, I don't see any direct way of removing a point from that path. You may be right that drawing a new shape with the background color might be the easiest way to accomplish an "eraser" mode.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You were creating a new GeneralPath with each point in mouseDragged and adding it to your vector. You really only need one for each "shape" since the path is just a series of connected points.

Path2D.Float is just the more recent incarnation of GeneralPath. GeneralPath is an older legacy class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Okay, this may work a little better for you. It keep a list of the shapes, so erase should be pretty easy for you to implement. If you need to check a shape for a point, there is a contains() method on Path2D.Float.

class ScratchPanel extends JPanel implements MouseMotionListener, MouseListener{

    List<Shape> shapeList = new ArrayList<Shape>();
    Path2D.Float currentShape=null;

    public ScratchPanel(){
        addMouseListener(this);
        addMouseMotionListener(this);
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        for(Shape s : shapeList){
            g2.draw(s);
        }
    }

    public void mouseDragged(MouseEvent e) {
        currentShape.lineTo(e.getX(), e.getY());
        repaint();
    }

    public void mouseMoved(MouseEvent e) {}

    public void mouseClicked(MouseEvent e) {}

    public void mousePressed(MouseEvent e) {
        currentShape = new Path2D.Float();
        currentShape.moveTo(e.getX(), e.getY());
        shapeList.add(currentShape);
    }

    public void mouseReleased(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the stack trace from the "crash". If you don't have one, put that your whole click handler block in a try-catch and print the stack trace in the catch block.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

liujanet, if you copy all of your answers from the internet, you are going to remain "completely computer science idiot". Study, think, and ask specific questions about the parts you don't understand.

If you expect to paste homework and get the answers to turn in, you've wasted your time and ours here.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you're still having a lag problem, post your revised code and I'll take a look.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Okay. First, you need to read the rules:

We strive to be a community geared towards the professional. We strongly encourage all posts to be in full-sentence English. Please do not use "leet" speak or "chatroom" speak.

Do not piggyback threads (aka "hijack" threads) by posting your question as a reply to another question.

Then you can read the "Read Me: Starting java" thread that is permanently stuck at the top of this forum.

If you have further questions after that, you can start a new thread for them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just adding a point to a path and repainting shouldn't really be causing a noticeable lag.

shape.lineTo(e.getX(), e.getY());
repaint();
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your other option is to use an offscreen buffer image to draw on and then render that in paintComponent(). That adds a couple of additional issues with resizing and clearing, but it's another option if you don't want to save shapes.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You want to calculate the points based on their offset from the center, so this

[B]x[/B] + (radius * Math.cos(A))

should really be

[B]midX[/B] + (radius * Math.cos(A))

Also remember that cos/sin are still based on the standard cartesian x-y axes where angle 0 is towards unit x=1, y=0 and increases counterclockwise towards the y axis. So you are drawing from "3:00" towards "12:00" as you increase the angle. Based on that, you may want to reconsider the location of your first point.

You really don't need to maintain the array unless you have other uses for the points outside of the drawing method.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, otherwise how does it know how to redraw it on repaint? You can use a GeneralPath for that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are taking the sin/cos of the same angle each iteration. You need to increment that angle.

I would also recommend starting (x,y) at your first point and starting your loop at 1.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Nope. Things don't work that way around here.

Start a new thread, ask specific questions, and post what you have so far. If you haven't made any effort on it, don't expect much help.