Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

err i post just to tell you that the thread is irrelavent and should be deleted i don't think thats contributing to it...=]

I guess you have failed to realize that most threads in the Geeks Lounge are irrelevant and it's whole purpose is to serve as a place for such off-topic discussions. A forum specifically for dating is outside the intent of the site, but a lounge thread on it is no different than any other random lounge post.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... i'd say to have a method that reads the time from thr base then get the HOURs convert it IF needed ex:

public Date convert(Date time){
int mask 12;
if (time <= mask)
time=time+12

This code is not valid and appropriate solutions have already been provided.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

telekinesis has been demostrated many times througout time go and see for your self there are many famous psychic out there.view all the articles in mytelekinesis.com

Ok enough plugs for that ridiculous site.

i am not asking you to believe me.

That's good. At least you are being realistic on one point.

decide for yourself

Done. You're delusional.

Salem commented: That works for me :) +17
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No they shouldn't. But Starbucks doesn't have a "singles table" right?

This.

A lounge thread is one thing, but a "Singles Scene" forum really has no relation to a technical forum site. A dating forum is a different genre altogther and adding one would only serve to commingle unrelated user populations.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is even more extensive and perhaps more relevant to you:
http://java.sun.com/developer/technicalArticles/javase/mvc/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Here's an article that describes the separation and interaction as it pertains to Swing apps:
http://www.javaworld.com/jw-04-1998/jw-04-howto.html

peter_budo commented: Another 100% score for you, great link +8
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And is there a particular reason you need a separate controller and don't want the view to serve that role? If you don't have the answer then you probably don't need to. Keep the model separate and let the view interact with it as needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Or why not read the "Starting Java" read-me thread that is stickied at the top of this forum? That is why it's there after all.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why not write one or search the 'net for an implementation that meets your needs? It's doubtful that anyone here has one to give you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post your code within [code] [/code] tags and specific questions regarding the parts that are troubling you.

Also consider that your sample text file does not give any hint of a hierarchical relationship between those two entries.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, you definitely do not want to be adding components in paint().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Check the doc for SimpleDateFormat. You want to use "HHmmss" instead of "hhmmss".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@Ezzaral--- Thanx for your suggestions dude.But I think we are here for not these type of stuffs.... If you can help then you are welcome otherwise please not post these type of stupid threads...

Those suggestions are in accordance with the forum rules that you agree to abide by when you create an account. http://www.daniweb.com/forums/faq.php?faq=daniweb_policies#faq_keep_it_clean
Perhaps you should read them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You may want to use a GeneralPath or Path2D.Float or Graphics.drawPolyline(int[],int[],int) for this. All of those provide methods to draw a series of points connected by lines.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Plzz solve my problem.........
@JavaAddict-- look through it,plzzzzz

"Plzz" is not a word. Please have the consideration to use proper English (at least as much as possible if your English is limited) if you are requesting help. Demanding help in bold text with gibberish words is just plain rude and not likely to get much help.

VernonDozier commented: I agree. +3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There is no built in calendar UI. You will need to create your own or find one that someone else has written.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Update Checking:
Currently, my program connects to a URL and checks if a new version is available. If one is, it simply opens up a dialog saying a new version is out and to go download it...
Is there a way to have it automatically open the path to the newest version in the users browser? Or if it's not too confusing, have it auto download the latest update?

Web Start would certainly handle that. As for your program downloading the update itself, sure, you could download a new version as a stream from a socket. If you want it to auto-update though, the updater will have to run as a separate JVM process since you can't replace your jar file while you are running it.

Score/Record keeping:
I can make it save high scores during the single gaming session, but once the game exits and the user opens it back up, all the scores start at 0 again... I'm thinking the easiest way to do this is to have the highest score write to a .txt before exiting and on next run, retrieve the highest score from that .txt file again, that way it's never lost.
My concern with this, is someone cheating and just editing the value in the .txt file and bragging that they finished the game in 3 seconds. Is there a better way to do this?

You could write the file as binary instead of txt, but really if …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

After you create the "mainPane", you need to set it's layout to GridBagLayout like so

mainPane.setLayout(new GridBagLayout());
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you tried

sid = input.nextInt();
if (isUnique(sid)){
  a[counter] = sid;
 ...

The problem is just that you are putting the id in the array and then searching that array to see if that id is already there. Search first, then add it if it's not found.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are putting the id into the array before you check if it's unique, so of course the id will be found in the array

a[ counter ] = input.nextInt();
           	sid=a[counter];
           	if (isUnique(sid))
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you figured out delete, you can at least get a start on edit. If you run into problems with it, post the code and specific questions or errors that you have. This is your homework - not ours.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What is the "length" variable? You should be looping to "a.length" over that array. If "length" is not the same as the array length, you are missing parts of your array in the loop.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I can't believe the degree to which people try to advertise crap on forums in the guise of being interested in the product.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, um, lol... or something.

This really has nothing to do with feedback on DaniWeb.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

who to find largest value of an array that we entered(in pseudocode)

Who? Well, the obvious answer is you. If you are having trouble, post what you have so far in a new thread and ask specific questions about it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

At the most basic level, you override the equals() method and test whether the object properties meet the criteria that you consider them "equal". Here is a bit more information: http://java.sun.com/docs/books/tutorial/java/IandI/objectclass.html

In practical usage there are more considerations to overriding equals() than just comparing the objects' properties, such as also overriding hashCode(), dealing with distinctions of subclasses, etc., but first you need to understand what equals() is supposed to be doing and try to get a working basic implementation into your classes.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It will draw the lines from whichever (x,y) to (x', y') that you specify, so you have to vary those four parameters each iteration as needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are only using the 'row' variable in drawLine() and I suspect you want to also use 'col', otherwise you are drawing over the same area several times.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I did change it as you said but now I got....
"variables col and row might not have been initialized"....Why?
I thought they were initialized at the top...

You declared them - you did not initialize them, meaning set them to a specific value. Declare them like this instead

for ([B]int col=0[/B]; col<7; col++) {
            for([B]int row=0[/B]; row<3; row++) {
               page.drawLine( 0, 100, (int) status(0,0), 100);
            }
         }
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> Sorry for not mentioning it before but, I do want to print 21 lines...

Yes, that was understood. Your code, as written, would have executed the setColor() statement 21 times and drawLine() only once, because the drawLine() call was not in the for() {} block. My point is that you should always include the braces on a for() block

for( ... ) {
    doSomething();
}

even though the compiler allows an implicit block of a single statement after the for()

// DON'T USE THIS FORM
for ( ... )
    doSomething();

Without the braces, the for() only applies to that single statement directly following it.

The implicit block form is completely acceptable, but it is less clear and prone to insidious problems when later another line of code is added to what should be a block but is not.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For the exact reason that I have been telling you to use braces to delimit your for() blocks. That for statement is only applying to the line directly after it and the variable "row" that you declared is only in scope for that single statement. You need to use blocks with the for() statements if you wish to execute more than a single line

public void paintComponent (Graphics page)
      {
         super.paintComponent (page);

         // setColor() only needs to be called once - not each iteration	
         page.setColor(Color.red);
         
         for (int col; col<7; col++) {
            for(int row; row<3; row++) {
               page.drawLine( 0, 100, (int) status(0,0), 100);
            }
         }
      }
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ah, ok, you are trying to cast it to an int. You need to place parens around the cast like so

page.drawLine( 0, 100, (int)status(0,0), 100);
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This line

page.drawLine( 0, 100, int status(0,0), 100);

is not a valid method call because you have placed the type definition ('int') in it. Drop the 'int' part.

And get braces around those for() blocks unless you expect to set the color to red 21 times and only draw a single line.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Seems like you should do some searching on that error with NB 6.1 or post to the nbusers mailing list. Your error has nothing to do with Java really, rather it's a specific program installation problem.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Surely that is not all of the code? Post the rest and please place it within [code] [/code] tags.

Also, always use braces around for() blocks. Even though a single statement without braces is allowed after for() and if() statements, you are likely at some point to add additional code and then wind up trying to figure out why it isn't working right because what you thought of as a block really isn't. Just get in the habit of using braces even for single statements.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the eval() function from the scripting control might get you there:
http://support.microsoft.com/kb/184740

If you have to use that function a lot, it might be worth writing your own wrapper function to bundle those parameters into a parameter array.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't believe there is any facility to report "both mouse buttons clicked" because the buttons are separate. I doubt the mouse can even report "simultaneous" clicks on multiple buttons from the hardware. The nearest approximation you can capture is "one button clicked soon after another while the other is still held down". That code I posted above only reports "Both down" when both buttons are pressed down on my machine here, so I can't speak to why it's behaving differently for you.

Perhaps you should put some debug statements in to print the values of the modifiers and the masks, or if you are using an IDE debugger, set a breakpoint and examine the values.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

A parameter array would make it a lot easier: http://msdn.microsoft.com/en-us/library/538f81ec(VS.71).aspx

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why not use arrays instead?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please note that Java and Javascript are not the same thing. Flagging to see if this can be moved over to the Javascript forum.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For one thing, override paintComponent() instead of paint() and be sure that you call super.paintComponent() before your custom code.

As for the specific of your question, it's a bit unclear. Post the relevant sections or example code that demonstrates the problem behavior.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The default FlowLayout gives you very little control over component sizing/resizing behavior. Try a different layout manager to achieve the behavior that you want:
http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do not resurrect old threads to ask new questions. Start a new thread if you have a question. Do not use "text-speak" gibberish like "u" and "plzz" in your post. If you are too lazy to type full words then don't expect help.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You are just hitting a resource location problem. Your relative file path is not being found and because of the specifics of getImage() and drawImage(), the only visible symptom is no image being drawn. The MediaTracker that load the image is actually creating an image with no dimensions because it can't find the file resource.

I'd recommend loading the image as an ImageIcon through the class loader like this:

Image ZERO = new ImageIcon(getClass().getResource("images/0.gif")).getImage();

If you plan on building the game in a jar file, you would need to include the "images" directory as a package in the jar. You can read a bit more about this here if you like: http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html#getresource

To make it easier on yourself, I would also suggest putting the gifs in an array of Image[] so you can access 0-9 by index instead of having to translate digits to each named variable like ZERO.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually, you don't even need to put them on the top-level window. I had a slightly different scenario in mind when I suggested that. You can bind them to whatever panel you are drawing to for the game screen. Perhaps this tiny example will help

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.geom.Ellipse2D;
import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.KeyStroke;

public class KeyDemo extends JFrame {

    public KeyDemo(){
        super();
        DisplayPanel display = new DisplayPanel();
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(display, BorderLayout.CENTER);
        
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(200, 150);
        setVisible(true);
    }
    
    class DisplayPanel extends JPanel{
        private Ellipse2D.Float ellipse;
        
        public DisplayPanel(){
            super();
            getInputMap(WHEN_IN_FOCUSED_WINDOW).put(
                KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),"MoveLeft");
            getActionMap().put("MoveLeft", new MoveLeftAction());
            
            getInputMap(WHEN_IN_FOCUSED_WINDOW).put(
                KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),"MoveRight");
            getActionMap().put("MoveRight", new MoveRightAction());
        }
        

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setBackground(Color.WHITE);
            g2.clearRect(0, 0, getWidth(), getHeight());
            
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setColor(Color.BLUE);
            if (ellipse==null){
                ellipse = new Ellipse2D.Float(
                    (getWidth()-50)/2,(getHeight()-50)/2,50,50);
            }
            g2.fill(ellipse);
        }
        
        class MoveLeftAction extends AbstractAction{
            public void actionPerformed(ActionEvent e) {
                if (ellipse.x>2){
                    ellipse.x -= 2;
                    repaint();
                }
            }
        }
        
        class MoveRightAction extends AbstractAction{
            public void actionPerformed(ActionEvent e) {
                if (ellipse.x < (getWidth()-ellipse.width-2)){
                    ellipse.x += 2;
                    repaint();
                }
            }
        }
    }
    
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                new KeyDemo();
            }
        });
    }
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Not knowing a thing about how you structured your program I really couldn't say. You need to register the input keys and their actions with the top-level window. How you go about that depends on the rest of your structure. It has nothing at all to do with keyTyped. It's a separate input-action model altogether.
http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Given that KeyListener is somewhat sensitive to component focus issues, it's often easier to use the InputMap and ActionMap of the root pane of the top level window (JFrame most likely). This is done by registering the keystroke inputs to actions like so:

getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
      KeyStroke.getKeyStroke("A"), "MoveLeft");
    
    getRootPane().getActionMap().put("MoveLeft", new AbstractAction() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            // move left
        }
    });
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And... ?

You haven't stated a question. Also, why would Movement be a class of it's own? A class encapsulates state and behavior. What state and behavior would be represented by Movement?

Edit: It looks like your post got cut off initially and you have added more to it, so the part about no longer really applies. The rest does though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The Deal class is really just performing a function of the Game and has no intrinsic value as a stand-alone class.

Consider that any game of cards has a number of players and each receives a number of cards. Different games involve different numbers. Those parameters belong to the Game and should thus be defined there. Giving the Deck a method deal() that returns a single card so long as there are cards remaining in the deck most closely mirrors a real-world deck that you are trying to model in your code. The Game class just needs to cycle through the play hands and deal() a card to each until they have the requisite number of cards - which is what I showed above.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to call repaint().