Results 1 to 13 of 13
  1. #1
    mansoor2 is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default A QUESTION U CAN ALL ANSWER, EXCEPT ME, (if not, come and sit with me lol)

    We studied basic stupid java, where all you did was draw pictures with "sop" statements, and program, HARDCODED, "Now what if i entered $10 for that item, how much change would i get back"

    waiiiit... "now wat if i went into your code and changed that value"

    lol and alot more junk, but i decided, THANKFULLY, to teach myself on my own.

    Unforunatly, the bad thing about java is so far, as i can see (and this is from a consistent perspective) that theres very little, if not, ZERO ground for beginngers, all the stuff isn't dum'd down for you (take for example when i google questions, they simply refer to a class page on sun's website, but even then, with the crappy examples, i (AND ALOT OF OTHER PPL << just self reassuring message to myself to sustain my pride hehe) cannot understand it.

    Something even worse is, i live in canda, in the sense, we do "turing", more precisely, is viable only in ontario (which is a province in a country called canada) In that language, it dums it down for you alot, and so the commands are easy, but u cant get too far, in terms of building complexity. What this means is that there things i can do on there, but not on here, java.

    Which is why, this is my first time ever asking for help in java, for if i cant solve the problem below, il just resort to building programs upon a dead language, that reigns through the population of approx 10,000.

    First off all i dont understand this swing dum stuff, i tried googling for many days, and all of that other dum stuff, as u may have noticed, its called dum, cause i dont understand it yet, itl become smart stuff, when i do though :).

    Either way; starting off from 0.. scratch...ground zero...or just zero... of java... i got this far.. (p.s i dont even know wat a project is, or how to call class's from each other LOL, all i know is wat a class file is)

    i somehow, learned 1 command, and OMG from that one command, i used my brain (left side of it only, the right side (artistic) doesnt mind sleeping)

    that one command, was

    Java Code:
    Robot myRobot = new Robot();
    and from there, i learned 3 other sub commands,

    Java Code:
    myRobot.mouseMove(x,y);
    Java Code:
    myRobot.delay(time);
    Java Code:
    myRobot.mousePress(InputEvent.BUTTON1_MASK)
    myRobot.keyPress()
    if u know more than me, then just know im better than u at everything else.. hehe

    either way, i need help

    i wrote several programs with these 3 commands of line, and set up em in methods and etc (i dont know how to return a value from method)... but one program, made me stuck..

    if i can figure it this one problem i have, THEN OMG il learn 4 commands, thats like omg 4^4= 64 possibilities! dudes, i can make so many programs out of that, that does sick things,

    either way before i go and ask, read this, i made several programs, using those 3 lines of commands, that all u have to do is click, and it directs your mouse (MOVES AND TYPES FOR YOU) like a robot! to the designated place, ie you wanna chk ur bank account or face book? itl do it for you. and then i wanted to make another that would take you to your lets stay bank page, BUT THIS IS WAT I HARD TIME ABOUT! AND IL ASK THIS PROBLEM IN ANOTHER POST, but was essentially was supposed to take picture of screen (i googled many times, for many hours, tryin to find a viable solution for this) and then from there, it interprets the image u just saved, and goes and does logic by analyzing pixel by pixel, and in a simple page, without u havin to go access your bank page, it puts it u p for you, like in a small click of hitting the .exe file, it tells you....
    either "OMG YOU OWE MORE MONEY AS YOUR BALANCE IS NOW:: X AT THIS TIME Y" and etc lol

    but I like i said in bracket above, this is for another thread, as i feel already POWERFUL with 3 commands i know, so its okay atm. ACtually i feel powerful only because i hope someone will help me increase the number to 4!!

    Either way my present problem is very simple, very difficult for me, (tried googling SO MANY TIMES, GOOGLE FEELS SERVER DRAG FROM MY ABUSE)

    ;; kk serious now;;;

    i wrote up a simple program, (IF U KNOW WHERE TO APPLY IT, YOU WILL FEEL POWERFUL LIKE ME, ELSE :rockon: )

    it goes like this, i hard coded mouse coordinates, meaning i hard coded values for where the mouse should move to, and it clicks on those coordinates;

    seems simple;

    this is wat i want,

    i want the program to run like this; this is the 4th command im asking for;

    when the USER (right) CLICKS ANYWHERE! it saves that mouse coordinate, or its x, y values.

    if that was easy for you, then write me up a program thats in a loop, that prints out the mouse coordinates, because to find specific coordinates of mouse, i hav to guess and check lol;

    it should go like this;

    start with endless loop;
    for (int x= 1000; x>0; x--) {

    (your command on how u retrieve mouse coordinates here)

    System.out.println("X value is " + X + "Y value is " + Y);

    }
    this holds 2nd priority, what holds first priority is the person who can teach me 1 more command line, that will put me up to 4, on how to save mouse coordinates when they click.

    ive gotten very far in java, and i like it because it requires logic, but it makes me very upset, when i have syntax issues, il nEVER EVER EVER EVER EVER EVER EVER EVER EVER EVER ask, or be man enough to ask, if the issue is a logic one only, because then i shouldnt be programming java in the first place duhhhh....
    i rmember when i was writing my 3k line code, i was alone, lonely, with my logic, teacher wouldnt help me, and so, only excuse i can use for help is when its a syntax issue, lik its not my fault i dont kno my abc's! DUH!

    either way thanks...

    ps that 3k line code program, omg if u saw it, it would of amazed you!!!!!!!!!!!!!!!!!

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    WTF?! Stop smoking that stuff immediately!
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    mansoor2 is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    wat do you mean? i dont understand!!!!!! LOL BRO, this is wat happens when you spend hours after hours, looking at 3000 lines of code, when you know, and this is the horror part, that it could be replaced with 1 sentence... either way, we d0ntz sm0ke, we n0t bad people here k?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    With the size of that post, the OP should look into being an author. Why waste this talent on programming.

  5. #5
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Quote Originally Posted by mansoor2 View Post
    ... either way, we d0ntz sm0ke, we n0t bad people here k?
    I doubt it. How could anyone being sober and sane type like that?

    BTW: I haven't yet found the question between all that drivel.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,309
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by mansoor2 View Post
    if i can figure it this one problem i have, THEN OMG il learn 4 commands, thats like omg 4^4= 64 possibilities! dudes [ ... ]
    4^4 == 4*4*4*4 == 256

    kind regards,

    Jos

  7. #7
    mansoor2 is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    DUDEZ THATS WAT HAPPENS WHEN YOU ALL DAY, YOU LOOK IN FRONT OF YOU, AND WAT DO YOU SEE?

    JUST 0'S AND 1'S (or rather lOL you'l see your code) BUT SAME to SAME!

    gets very boring, and the code doesnt talk back to you, and it drives me "crazy", ive never been driven crazy before, when i have syntax issue, its like wtf, i know how to solve the problem, but somehow some idiot who wrote java, wont make my life easy! cause hes jealous!

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,309
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by mansoor2 View Post
    but somehow some idiot who wrote java, wont make my life easy! cause hes jealous!
    Jealous? not drunk or stoned?

    kind regards,

    Jos

  9. #9
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    Well, that made for interesting reading. I'm 15, and read abbreviated things all the time, along with the txt msg stuff (lol), but that first post is unreadable...

    All I gathered is that you don't understand anything about java guis, and are using the Robot class. For the love of all thats holy, do NOT do that... start with AWT/Swing GUIs (SWING! :) ) THEN try to use the Robot class.

    The other thing I [think I] read was that you had a 3000 line program. Really? I've written some with 10000+ lines, but the classes are usually no more than 500 lines. If you had 3000 lines in one file, go write C or C++ code, its a contest to see who can understand the longest file :eek: (Otherwise read as - split the code up!)
    Last edited by Singing Boyo; 07-27-2010 at 08:55 PM.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  10. #10
    mansoor2 is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    it was all lines of procedures, not junk,,,, and u guys are bein the idiots i didnt expect, i was hoping you guys would me wit syntax, as i already have the preconceived logic, yet here you are, little bunch of brats trying to show off that paying for ur java course (1000$) was worth it... shame on all of you..

  11. #11
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    @Mansoor2:
    Just remember, you get what you pay for, all their help is free. :)

    No offense to you, but you did ramble a bit.
    If I understand your question correctly, you want to find out where a mouse click occured on screen.

    What you need is a MouseListener.

    Read the docs carefully. You are right, we have made up our own syntax and expect people to know it. It does have a bit of a learning curve, but its worthwhile. The java tutorials are actually very good once you understand how they are presenting the information - far better than other languages in my opinion.

    Anyway, some code. Say you have a JFrame, you can add a mouselistener like this:

    Java Code:
    mainFrame.addMouseListener(new MouseAdapter() { // mainFrame is an instance of a JFrame
        @Override
        public void mousePressed(MouseEvent e) {
            showPopup(e);
        }
    
        @Override
        public void mouseReleased(MouseEvent e) {
            showPopup(e);
        }
    
        private void showPopup (MouseEvent e) {
            if (e.isPopupTrigger()) {  // Right click
                System.out.println("X: " + e.getX() + " Y:" + e.getY());
            }
        }
    });
    This will work on a blank JFrame. However, if you place any components on it, they will "eat" the mouse event, and the listener will not detect the mouse click. Your component doing the mouse listening should be the top most component.

    BTW:
    your endless for loop could be more easily writted with a while loop:
    Java Code:
    while (true) {
    
    }
    berkeleybross

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default

    Quote Originally Posted by JosAH View Post
    Jealous? not drunk or stoned?

    kind regards,

    Jos
    I think that's an unfortunate side effect of txt spk. It makes you sound like a twit.

    To the OP. OK, from a quick scan of your original, rambling and occasionally entertaining post, I get the impression you're fairly new to Java and are asking how to do stuff. My answer is do not start with Swing.

    Learn the basics first. Do whatever it is you're trying to do using a Scanner and the command line. Learn how Java fits together. What a class is, does, and is for. What objects are, and how they "talk" to each other. Learn how to use the API (it is your friend). Whether this is done via the Sun tutorials (start with Getting Started), or some book or other doesn't really matter, so long as it's something you understand.

    But for gods sake do not start by doing Swing, JDBC, JSP, Servlets or any number of other technologies that people seem to latch onto and then wonder why nothing works, when they don't even have a basic grounding in how Java works.

Similar Threads

  1. Java Interview Question and Answer
    By gnomeom in forum Java Software
    Replies: 3
    Last Post: 06-04-2009, 11:53 AM
  2. How to loop a question when answer is negatve?
    By brazuca in forum New To Java
    Replies: 6
    Last Post: 04-23-2009, 05:46 AM
  3. Answer To Previous Question
    By herbozo2003 in forum Java Servlet
    Replies: 0
    Last Post: 03-02-2009, 02:22 AM
  4. Plz answer this question ...
    By raghu2114 in forum Advanced Java
    Replies: 2
    Last Post: 09-19-2008, 06:36 PM
  5. Replies: 1
    Last Post: 08-29-2008, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •