Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Reset your statement parameters and execute the statement - just like inserting any data into a table.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sure, with an embedded database it's no trouble. We do this with H2 for every new project when it's first created. You just run a script with your data definition code in it.

Edit: H2 can also create an in-memory database that does not persist when closed.

codeFaceMcGee commented: Exactly what I needed. +1
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Which line is the error occurring? Getting the connection or executing the statement?

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

You haven't initialized any of your array variables in your Matrix_Mult class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

paramGraphics.drawImage(localImage, 0, 440, 280, 200, this); Read the API doc on the drawImage method. Those numbers are the coordinates and dimensions of the image being drawn. If you want it drawn elsewhere, you have to change them.

> What do you mean by make some space?

Well, I assume you don't want to draw right over your other components, so you have to make some space in your layout to accommodate the image. I would actually recommend placing the image in a JLabel so it can be placed in your layout as a component.

You can add the image under the text the same way. Here's a link on using JLabels to display images: http://download.oracle.com/javase/tutorial/uiswing/components/icon.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> How do I move the image to the top (just below the title)?

Change the drawImage() coordinates. Of course, then you will have to make some space for it at the top. So you would have to change your component layout.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The simple spaces will work just fine. Perhaps you removed them in one of your revisions?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Add "\n" for a line break. You can inline that with the text if you like. ie +"\nBall position: " Edit: You can also look into the String.format() method if you like.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I guess you could start here: http://download.oracle.com/javase/tutorial/networking/index.html

Anything more specific would require a more specific question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Are you running this on a 64-bit machine with 32-bit MS Access installed?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Calculate the center point (appW/2, appH/2) and then use those to figure where to place your upper left corner of the rect.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do you have a DSN entry called "CBIRS"?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just a couple of minor things. The main trouble is that you don't reset y to zero, so it quickly goes right off the screen after the first call to paint.

Here's your painting method revised. You should normally override paintComponent() instead of paint() unless you need to change other things that paint() is doing. paintComponent() is the more specific method that is called to render the panel itself.

public void paintComponent(Graphics g) {
         super.paintComponent( g );
         Graphics2D g2 = (Graphics2D) g;

         // Reset your starting y value here 
         y = 0;
         for (int i = 0; i < 4; i++) {
             for (int j = 0; j < 3; j++) {
                 g2.drawString(twoDCells[i][j], x, y);
                 y += 30;
             }

         }

         // You don't really need these here.
        // Toolkit.getDefaultToolkit().sync();
        // g.dispose();
     }
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take the variable types out of your super() calls

super(int accountNumber, String accountOwner);

You just pass the variables themselves.

super(accountNumber, accountOwner);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, a for loop is appropriate. Post what you have so far and ask specific questions about the troubles you are having.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Add e.printStackTrace(); in your catch blocks to show the detailed stack trace for your exceptions.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Here you are checking pieces [a][b] for null, but calling print on pieces [9-a][b]

if(pieces [a][b]!=null){
  array[a][b]=pieces [9-a][b].print();                    
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>how could i try and change it?
As already stated, make sure that the reference is not null before you operate on it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That is just an annotation added by the IDE.

In that specific case, it's actually just an anonymous implementation of the ActionListener interface.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

edit: nt, server double posted my reply

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The error occurs on line 212, which we can't determine when only portions of the file are shown here, but I would be suspicious of this part

pieces [9-a][b].print()

potentially executing against a null reference.

This could also be problematic if you are using a sparsely populated array

for (int b = 0; b < pieces[a].length; b++){
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You stack trace will indicate the exact line that the error is occurring on.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you're using Tomcat, try putting the jar in $CATALINA_HOME/common/lib See this for more info: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_Example

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Another option is the Desktop.open() method. You have more control with the Process the NormR1 mentioned, but it is OS-specific. The choice depends on your particular needs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This forum is a customized version of vBulletin, which is not an open source system.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can probably use BorderLayout for that with your tree in the center and buttons at south.

There are plenty of other layout options if you want to gain more control over positioning. Just take a look at the contents listing at the left side of that tutorial link.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Since nextGuassian() will give you a double with mean 0 and std dev of 1.0, perhaps you can use a std deviation of 1/3 of half of your range: rand.nextGaussian()*0.33*halfRange to get 99.7% of your values between [-halfRange,halfRange] and add that to your midpoint?

Random rand = new Random();
        int x0 = 10;
        int x1 = 50;
        int xRange = x1 - x0;
        int halfRange = xRange/2;
        int midPoint = x0+halfRange;

        for (int i=0; i<50; i++){
            System.out.println(Math.round(midPoint+(rand.nextGaussian()*0.33*halfRange)));
        }

You cannot absolutely guarantee that you won't get an invalid value, but it should be outside of the 3 std dev range or around 0.3%. You can just discard those values.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Adding a few more observations:
- Those "wink" smilies are showing due to ;) , which is invalid syntax in those if() statements.

- No parameter type in the process() method declaration.

- Multiple return statements in the display() method - code beyond the first is unreachable. And the method declaration itself doesn't have a return type stated, so it's an invalid declaration.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

From what I could determine, it looks like the only way to accomplish that is to dynamically create the query with the desired criteria. Pass-through queries cannot use parameters and they are parsed and run on the remote server. They don't have any knowledge of your local database and its forms.
Here's just one of the links I ran across that discusses it: http://www.pcreview.co.uk/forums/thread-1182381.php

You could probably create the query based on the update event from the combo box if you wanted to go that route.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm uncertain about the best name for it. "Java Web Development" may be just fine, but I wonder if it might draw many Javascript questions. I think we will always have some misplaced posts between the Java-based forums though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, 'Database Design' speaks more to generic relational design issues such as normalization.

A single "Databases" forum might be workable under the current volume of posts. Right now the aggregated front page of those forums goes back 6 days; the second page 12 days. That would certainly solve the "where to put this post" issue.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I agree that an "Other Databases" forum would be useful.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just go ahead and use the Point class.

Edit: Ok, nevermind. Cross-posted as you posted the above. If you do need to work with other single points, there are convenience methods to test Point containment with various shapes, including Rectangle.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You could try with UAC disabled I suppose. I'm not sure what else would be preventing you from editing that property file.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It may just be a UAC thing with Win7 or Vista. Do you have administrator access on that machine?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You must add the KeyListener to a component with the addKeyListener() method. It's similar to what you did with the ActionListener for the buttons.

Implementing the interface just defines what the listener does. Then you attach it to the component you want to listen to.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Re-read NormR1's second question and check your code again.

are they connected to any components?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Look in your text book. It is the mechanism to handle an exception.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just like you wrote it above (x1+x2, y1+y2).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Create a method in your Dimensions class to add a Dimension to the instance and return a new Dimension with the result

public Dimension add(Dimension d){
  ... add dimensions and return the result ...
}
Xufyan commented: thnX :) +0
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use a try-catch around the parseFloat() call and only set the object value if a valid float has been entered.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I ran into this before with the jdbc-odbc bridge and Access. You can only read from each field of the current row one time. If you try to read it again it throws an exception. I have no idea why and it's irritating. So if you need to capture that value, do that on the first read.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It seems to work fine if you make the combo box uneditable and add the key listener directly to the JComboBox component instead of the editor

fromComboBox.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent event) {
            fromComboBoxKeyKeyPressed(event);
    }
});
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

From my understanding the combobox must be editable to have a KeyListener on it. I need the keylistener because the app only uses scan guns to capture keystrokes (no keyboard or mouse is accesssible).

Have you tried it? My personal experience from many years of Swing programming is that the only way to negotiate the nuances is to keep trying until it works :)

I am unfamiliar w/ the DocumentListener but will look into it. Any more info you can provide?

Thanks.

The DocumentListener interface gives you control over how changes to the content of a text component are processed. The default combo box editor is basically a JTextField which uses a Document interface to encapsulate its content.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I only have a moment here before I head out, but two options come to mind:
- Make the combo uneditable? Is the user really needing to edit entries?
- Install a DocumentListener on the combo box editor component that discards the '>'

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Switching to use keyReleased() instead of keyPressed() and consuming the key event will fix it.

addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent event) {
                fromComboBoxKeyKeyPressed(event);
        }
});
private void fromComboBoxKeyKeyPressed(KeyEvent e) {
        int num = fromComboBox.getItemCount();

        if ((e.getKeyCode() == 51) && (e.isShiftDown())){
                //use # to scroll through From dropdown
                if (fromComboBox.getItemAt(num - 1).equals(fromComboBox.getSelectedItem())) {
                        fromComboBox.setSelectedIndex(0);
                }else{
                        fromComboBox.setSelectedIndex(fromComboBox.getSelectedIndex() + 1);
                }
                // consume here so nothing else processes it
                e.consume();
        }
}

You can see that the '#' is still being appended temporarily by the editor, but the selection on release is setting the selection to the original item, so the appended text is replaced.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, having a master PO table would alleviate the need altogether, but aside from that, you could use max() instead of 'top'. Top is dependent upon the returned order of the rows, whereas max() is not. i.e.

select max(maxId)+1 from
(select max(Id) as maxId from a 
union 
select max(Id) as maxId from b
union
select max(Id) as maxId from c) as allIds
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I understand what you mean, but subscribing to a thread is the only function I'm aware of that would be close to what you're wanting.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Click the "Subscribe To This Thread" envelope icon at the top of the thread. It will then appear in your Subscribed Threads list in your User Control Panel.