Stefce 146 Posting Pro

Sorry for late reply but yesterday daniweb was down so i was unable to reply, anyway the user_id is placed in login.php and core.php so what i have done... I copyed the getUserData and paste it like getReceiverData with different session variable in this case receiver_id so now when im tryng to get the receivers data i get error Notice: Undefined index: receiver_id in C:\xampp\htdocs\Training\core.php on line 46 here is the code for getReceiverData

function getReceiverData($field) {
        $DBServer = 'localhost';
        $DBUser   = 'root';
        $DBPass   = '';
        $DBName   = 'upstrey';
        $conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);

        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }
        //$_SESSION['receiver_id'] = 'receiver_id'; <- here need to be ?
        $sql = "SELECT `$field` FROM `users` WHERE `ID`='".$_SESSION['receiver_id']."'";
        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
            while($row = $result->fetch_assoc()) {
                return $row["$field"];
            }
        }
        $conn->close();
    }

So this error gives me hint to store somewhere the session variable like you said in previous post but the problem is i do not know how and where to store, is there any option that you can change the code and store it the session because im really confuzed, Thank you alot for replying here and have a nice day or night, depends.... :D

P.S i almost forgoted, i have a really small error over here for Undefined variable: count take a look ever here and why is showing me the error btw its working just the error bothering me. Im sorry for asking theese questions in same …

Stefce 146 Posting Pro

Thanks and where should i place this code in which file login.php, core.php, donate.php ?

Stefce 146 Posting Pro

anyone ?

Stefce 146 Posting Pro

How do i set the receiver_id session to get the receiver data from the fields in this case i want to get the payCheck field.

Stefce 146 Posting Pro

But it gives me error Notice: Undefined index: receiver_id in C:\xampp\htdocs\Training\core.php on line 46 what should i do to place receiver_id in the session ?

Stefce 146 Posting Pro

So it will be something like this ?

function getReceiverData($field) {
        $DBServer = 'localhost';
        $DBUser   = 'root';
        $DBPass   = '';
        $DBName   = 'upstrey';
        $conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);

        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }

        $sql = "SELECT `$field` FROM `users` WHERE `ID`='".$_SESSION['receiver_id']."'";
        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
            if($row = $result->fetch_assoc()) {
                return $row["$field"];
            }
        }
        $conn->close();
    }

Im using the same code for getUserData but just the session is $_SESSION['user_id']

Stefce 146 Posting Pro

Oh found the error in $result->num_rows > 0 it needs to be $result->num_rows == 0 :D ... thank you alot Traevel and broj1 really helped :)
Also i really need to ask how do i update the receiver data with the current balance he have, how do i get his payCheck field and substract with the receiving amouth and than just add the total amouth in the database

Stefce 146 Posting Pro

I have changed the code into this but still showing Username doesn't exist.

<?php
    if(isset($_POST['howMuch']) && isset($_POST['where'])) {
        $howMuch = $_POST['howMuch'];
        $where = $_POST['where'];

        if(empty($howMuch) && empty($where)){
            echo "You cant leave it empty!";
        } else {
            $user_mBalance = getUserData('payCheck');
            if($howMuch > $user_mBalance) {
                echo "You cannot donate more than you have!";
            } else {
                $sql = "SELECT `ID` FROM `users` WHERE `First Name`='".$where."'";
                $result = $conn->query($sql);
                if($result === false) {
                    trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
                } else {
                    if($result->num_rows > 0) {
                        echo "Username doesn't exist.";
                    } else if($result->num_rows > 1){
                        $sender = getUserData('First Name');
                        if($where == $sender) {
                            echo "You can't donate to your self!";
                        } else {
                            $total = $user_mBalance - $howMuch;
                            $query = "UPDATE `users` SET `payCheck`='".$total."' WHERE `First Name`='".$sender."'";
                            die($query);
                            $res = $conn->query($query);
                            printf("You have donated $ %d to %s", $howMuch, $where);
                            }
                        }
                    $conn->close();
                }
            }
        }
    }
?>
Stefce 146 Posting Pro

Oh daamn :D but now its showing always username doesn't exist

Stefce 146 Posting Pro

Hello i have this code and something isn't working but i dont know what, the code it does not updating the database at all and i don't get any errors.

<?php
if(isset($_POST['howMuch']) && isset($_POST['where'])) {
$howMuch = $_POST['howMuch'];
$where = $_POST['where'];

if(!empty($howMuch) && !empty($where)) {
    $user_mBalance = getUserData('payCheck');
    if($howMuch > $user_mBalance) {
        echo "You cannot donate more than you have!";
    } else {
        $sql = "SELECT `ID` FROM `users` WHERE `First Name`='".$where."'";
        $result = $conn->query($sql);
        if($result === false) {
            trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);

        if($row = $result->num_rows > 0) {
            echo "Username doesn't exist.";
        } else {
            $sender = getUserData('First Name');
            if($where == $sender) {
                echo "You can't donate to your self!";
            } else {
                $total = $user_mBalance - $howMuch;
                $query = "UPDATE `users` SET `payCheck`='".$total."' WHERE `First Name`='".$sender."'";
                $res = $conn->query($query);
                printf("You have donated $ %d to %s", $howMuch, $where);
            }
        }
    $conn->close();
    }
}
} else {
    echo "You can't leave empty! ";
}
}
?>
Stefce 146 Posting Pro

Yeah, i dont know why that is still there and i know it will never be shown :D
And yeah i forgoted to put the header.php code, but its just simple 2 PHP lines which is getting data from the core.php

<?php
    $firstname = getUserData("First Name");
    $lastname = getUserData("Last Name");
    echo "<a style='color: white;'>$firstname $lastname</a>";
?>
Stefce 146 Posting Pro

I know im not alowed to do this but Anyone ?

Stefce 146 Posting Pro

Anyone with different solution ?

Stefce 146 Posting Pro

Thank you now doesn't show any error but the values arent showing any other options ?

Stefce 146 Posting Pro

Hello i im confuzed with this problem, i have converted the php code into the right format MySQLi and i get this wierd error Notice: Array to string conversion in C:\xampp\htdocs\Training\core.php on line 25 So i dont know where is the problem in the login.php or core.php look at the codes and please tell me where should i correct something thank you :)

function getUserData($field) {
        $DBServer = 'localhost';
        $DBUser   = 'root';
        $DBPass   = '';
        $DBName   = 'upstrey';
        $conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);

        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }

        $sql = "SELECT `$field` FROM `users` WHERE `ID`='".$_SESSION['user_id']."'"; // this is the line 25 in the error
        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
            if($row = fetch_assoc($result)) {
                return $row["$field"];
            }
            // so i want to make getUserData function so i can use it like getUserData('First Name') in other files
        }
        $conn->close();
    }

login.php

if($result->num_rows > 0) {
                    session_start();
                    $user_id = mysqli_fetch_row($result);
                    $_SESSION['user_id'] = $user_id;
                    /*$_SESSION['user_id'] = "1"; <-- this line giving me data from the first ID in the database*/
                    header('Location: home.php');
                    echo "Email and Password Accepted";
                } else {
                    session_start();
                    $_SESSION['user_id'] = ''; // and also tell me if this line is ok ?
                    echo "Invalid Email or Password";
                }

Thank you again

Stefce 146 Posting Pro

hahahaha :D daaamn guys you are too stubborn but anyway thanks for the help and the spended time on this question :D BTW i made a misstake its about 10 hours of "working" on this error :D Thank you again :)
PS: Taywin dude don't get mad that fast i was just too much pissed for what i did today :D . But anyway my apology for that

Stefce 146 Posting Pro

Do you mean on this ? this actualy worked but not correct i think i need to define the First Name of the query but i dont have any variables in this class core.php

function getReceiverData($field) {
        $query = "SELECT `$field` FROM `users`";
        if($query_run = mysql_query($query)) {
            if($query_result = mysql_result($query_run, 0, $field)) {
                return $query_result;
            }
        }
    }
Stefce 146 Posting Pro

No i im sure and please if you can help me what im asking please answer the question because im tired already 7 hours of sitting on the PC for nothing ...
And those who see this question just do it in the code dont post some tips and tricks of how to do it !

Stefce 146 Posting Pro

Here is the script feel free to change something because im changin all day and cant figure out PLEASE

<?php
    require 'connect.php';
    require 'header.php';

    if(isset($_POST['howMuch']) && isset($_POST['where'])) {
        $howMuch = $_POST['howMuch'];
        $where = $_POST['where'];

        if(!empty($howMuch) || !empty($where)) {
            $user_mBalance = getUserData('payCheck');
            if($howMuch > $user_mBalance) {
                echo "<br><br><br>You cannot donate more than you have!";
            } else {
                $query = "SELECT `ID` FROM `users` WHERE `First Name`='".mysql_real_escape_string($where)."'";
                $getReceiver_payCheck = "SELECT `payCheck` FROM `users` WHERE `First Name`='$where'";

                if($query_run = mysql_query($query)) {
                    $query_num_rows = mysql_num_rows($query_run);

                    if($query_num_rows == 0) {
                        echo "<br><br><br>Username doesn't exist.";
                    } else if($query_num_rows == 1) {
                        $sender = getUserData('First Name');
                        if($where == $sender) {
                            echo "<br><br><br>You can't donate to your self!";
                        } else {
                            $total = $user_mBalance - $howMuch;
                            $total2 = $getReceiver_payCheck + $howMuch;
                            $query = "UPDATE `users` SET `payCheck`='$total' WHERE `First Name`='$sender'";
                            $query2 = "UPDATE `users` SET `payCheck`='$total2' WHERE `First Name`='$where'";
                            $query_run = mysql_query($query);
                            $query_run2 = mysql_query($query2);
                            echo "<br><br><center>You have donated $$howMuch to $where</center>";
                        }
                    }
                }
            }
        } else {
            echo "<br><br><br><center>You can't leave empty!</center>";
        }
    }
?>
Stefce 146 Posting Pro

Im doing that like this but doesnt work like i said in the previous comment

$getUser_payCheck = "SELECT `payCheck` FROM `users` WHERE `First Name`='$where'";
                            $total = $user_mBalance - $howMuch;
                            $total2 = $howMuch + $getUser_payCheck;
                            $query = "UPDATE `users` SET `payCheck`='$total' WHERE `First Name`='$sender'";
                            $query2 = "UPDATE `users` SET `payCheck`='$total2' WHERE `First Name`='$where'";
                            $query_run = mysql_query($query);
                            $query_run2 = mysql_query($query2);
                            echo "<br><br><center>You have donated $$howMuch to $where</center>";
Stefce 146 Posting Pro

Can you please do that in code because i tryed too much ways of doing that and its just adding the money into the field and not summing the values

Stefce 146 Posting Pro

Please anyone ?

Stefce 146 Posting Pro

Hello i need little help overhere im confuzed getting user data from mysql database i want to update the payCheck column in the database but that column is located in the receiver or where (in the code) field i have this code please someone help me...

<?php
    require 'connect.php';
    require 'header.php';

    if(isset($_POST['howMuch']) && isset($_POST['where'])) {
        $howMuch = $_POST['howMuch'];
        $where = $_POST['where']; // this is the receiver

        if(!empty($howMuch) || !empty($where)) {
            $user_mBalance = getUserData('payCheck'); // getting already logged user field 'payCheck'
            if($howMuch > $user_mBalance) {
                echo "<br><br><br><br><br>You cannot donate more than you have!";
            } else {
                $query = "SELECT `ID` FROM `users` WHERE `First Name`='".mysql_real_escape_string($where)."'";

                if($query_run = mysql_query($query)) {
                    $query_num_rows = mysql_num_rows($query_run);

                    if($query_num_rows == 0) {
                        echo "<br><br><br>Username doesn't exist.";
                    } else if($query_num_rows == 1) {
                        $sender = getUserData('First Name'); // getting already logged user field 'First Name'
                        $total = $user_mBalance - $howMuch; // calculations of loged user 'payCheck' + 'howMuch'

                        $query = "UPDATE `users` SET `payCheck`='$total' WHERE `First Name`='$sender'"; // updating the sender `payCheck` field
                        $query_run = mysql_query($query);
                        echo "<br><br><br>You have donated $howMuch to $where";
                    }
                }
            }
        } else {
            echo "You can't leave empty!";
        }
    }
?>

So simply i just want to get the receiver payCheck balance and than to add the money which sender sended to him something like $total = $receiver_moneyBalance + $howMuch;

And also here is the code for getUserData();

function loggedin() {
        if(isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) {
            return true;
        } else {
            return false;
        }
    }

    function getUserData($field) {
        $query = "SELECT `$field` …
Stefce 146 Posting Pro

@Slavi i have understanded your post and thanks for sharing it with me it helps me alot but im still trying to figure out, but im failing if you can change it here in the code i will be very happy here is my last try...

String[] items = { "Iphone", "Computer", "Car" };

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        String field = Field.getText();
        String text = "I want a";
        Scanner scan = new Scanner(text);
        String[] bits = text.split(" ");
        String last = bits[bits.length-1];

        for (int j = 0; j < items.length; j++) {
            String next = scan.next(last);

            if (next.equals(items[j])) {
                infoLabel.setText("You want a: "+items[j]);
            } else {
                infoLabel.setText("Not found.");
            }
        }        
    }
Stefce 146 Posting Pro

what its doing this line String last = yourSentance.substring(yourSentance.lastIndexOf(' ') + 1); can you explain me and where should i put this too ? Also i want to know is this is a good way of doing this ?

for (int i = 0; i < text.length(); i++) {
            Scanner scan = new Scanner(text);
            while (scan.hasNext()) {
                String next = scan.next();
                for (String item : items) {
                    if (next.contains(item)) {
                        infoLabel.setText("You want a: " + item);
                    } else {
                        infoLabel.setText("Item not found.");
                    }
                }
            }
        }
Stefce 146 Posting Pro

Can anyone tell me what im doing wrong here ? I just want to detect the last word of the sentence and if not found to show "Not found." here is the code:

String[] items = { "Iphone", "Computer", "Car" };
String field = Field.getText();
        String text = "I want a ";
        Scanner scan = new Scanner(text);
        for (int i = 0; i < text.length(); i++) {
            while (scan.hasNext()) {
                String next = scan.next();
                for (int j = 0; j < items.length; j++) {
                    if (next.equals(items[j])) {
                        infoLabel.setText("You want a: "+items[j]);
                    } else {
                        infoLabel.setText("Item not found.");
                    }
                }
            }
        }
Stefce 146 Posting Pro

I have replaced the CSS in the head tag but still the button hovers the header

Stefce 146 Posting Pro

I dont get it what you mean i have the header in the <head> tag so whats the problem here ?

Stefce 146 Posting Pro

Hello im really confuzed in the HTML and CSS language i have maked a footer and some div elements in the body so when i scroll up the footer doesnt is alwaus visible when i scroll down the button is hovering the footer and also the other div element i have this code and please some one explain me why this happens, and how do i make when the page is zoomed by the browser to be zoomed correctly and that two buttons in the top right corrner to not coming in the left while you zooming..

Copy and Paste the code to test it to see what i mean thanks :)

<html>
    <head>
        <div class="headerr">
        <header>
            <a class="upstrey_logo" href="index.php">Upstrey.com</a>
            <input class="rBtn" type="submit" value="Register" />
            <input class="sBtn" type="submit" value="Sign In" />
            <input class="search-box" type="search" name="search-box"/>
        </header>
        </div>
    </head>
    <body>
        <style>
            body {
                opacity: 0.93;
                margin-left: 10%;
                margin-right: 10%;
                color: black;
                font-family: sans-serif;
                visibility: inherit;
                overflow: auto;
                background-color: white;
                min-height:100%;
                border-radius: 20px;
                text-shadow: 50%;
                font-size:100%;
                line-height:1.125em;
                -webkit-text-size-adjust: auto;
            }
            input.status-box {
                opacity:1;
                border-radius:9px;
                width: 450px;
                height: 100px;
                background-color: #E6FFFF;
                border: 1px solid gray;
            }
            div.updated-box {
                opacity:1;
                position: relative;
                border-radius:4px;
                background-color: #E6FFFF;
                border: 1px solid gray;
            }

            div.headerr {
                opacity: 1;
                position: fixed;
                width:100%;
                height:53px;
                vertical-align: middle;
                background-color: #E6FF8F;
                border: 0px solid gray;
                right: 0px;
                left: 0px;
                top: 0%;
                -webkit-text-size-adjust: none;
                -webkit-box-shadow: 1px 0px 5px 1px rgba(0,0,0,0.47);
                -moz-box-shadow: 1px 0px 5px 1px rgba(0,0,0,0.47);
                box-shadow: 1px 0px 5px 1px rgba(0,0,0,0.47);
            }
            input.pBtn {
                opacity:1;
                position: relative;
                border-radius: 9px;
                width:100px;
                height:35px;
                right: …
Stefce 146 Posting Pro

Yup i have a database on Godaddy but i still cannot figure out how to make it :D
BTW i need every new post is posted to go on top of the last post so i think this make sense :D

Stefce 146 Posting Pro

I have this code but this is just the look of the "Status update box"

<html>
    <body>
        <style>
            textarea.status-box {
                opacity:1;
                border-radius:9px;
                background-color: #E6FFFF;
                border:2px solid gray;
            }
            input.sBtn {
                opacity:1;
                position: relative;
                border-radius:9px;
                width:100px;
                height:35px;
                right: 34%;
                background-color: #E6FF8F;
                border:2px solid gray;
            }
            div.updated-box {
                opacity:1;
                position: relative;
                border-radius:9px;
                background-color: #E6FFFF;
                border:2px solid gray;
            }
        </style>
        <center>
            <div style="opacity:1; border-radius:10px; width:500px; left:20%; top:20%; height:180px; background-color:white; border:3px solid gray;"><br>
                <form action="index.php" method="GET" name="update-status_form">
                    <textarea class="status-box" type="text" name="status-box" rows="6" cols="60" placeholder="What you thinking of ?"></textarea><br><br>
                    <input class="sBtn" type="submit" value="Post"/>
                </form>
                <?php
                    $date = date('H:m:s');


                    if(isset($_GET['status-box'])) {
                        $update = $_GET['status-box'];  
                        echo "
                            <br><br>
                            <div class='updated-box'>
                                <br><br><a>$update</a><hr>
                                Posted on: $date
                            </div>";
                    }
                ?>
            </div>
        </center>
    </body>
</html>
Stefce 146 Posting Pro

Hello im not too sure how is this called but i will try to explain.. I want to make the form to get updated on every "Status Update" so for ex. like Facebook when you are posting a new status it gets updated the "body" of the page with new "Updated FORM Box", so if anyone can tell me how its called that so i can search around the internet and find some good stuff or someone give me an example how is done that ?
Thanks :)

Stefce 146 Posting Pro

This code not working its just adding in the same line "ASDFGHJKL"

Stefce 146 Posting Pro

I'm trying like this:

String lozinka = "Vnesete ja lozinkata: \n";

    @Override
    public void paint(final Graphics g) {
        super.paintComponents(g);
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        Font font = new Font("Serif", Font.PLAIN, 17);
        g2.setFont(font);
        g2.setColor(Color.red);
        g2.drawString(lozinka+"\n", 20, 130);
    }

    private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {                                     
        repaint();
        lozinka = "ASDFGHJKL";
    }

so after i click the label there is just a "repaint" and no text under the first line

Stefce 146 Posting Pro

Ohh, but i meaned to appear under the first line and all the way down till the end of the "virtual display"

Stefce 146 Posting Pro

Im trying to make it like this but it gives me error

String asd = g2.drawString("Verificiranje na akauntot !", 20, 130);
Stefce 146 Posting Pro

How do i add string variable please give me some example ?

Stefce 146 Posting Pro

I want to make new string to show under the first ("Verificiranje na akauntot !") text but i dont know what to do in the "jLabel3MouseClicked" class, please help me how do i paint the graphic after i press the label ? here is some code:

@Override
    public void paint(final Graphics g) {
        super.paint(g);
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        Font font = new Font("Serif", Font.PLAIN, 17);
        g2.setFont(font);
        g2.setColor(Color.GREEN);
        g2.drawString("Verificiranje na akauntot !", 20, 130);
    }

    private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {                                     
        // what should i do here ?
    }
Stefce 146 Posting Pro

You can remove the battery in the motherboard and place it aggain that will solve the problem ...

Stefce 146 Posting Pro

Format the PC or reinstal drivers again, i don't know what has left ...

Stefce 146 Posting Pro

Hello i have a little problem with moving ball around screen, also i'm confused why i cannot put this variables double x = 0, y = 16, muvx = 0, muvy = 0; at the public class MainActivity to be local variables and also i don't know how to set the timer to be on 0.5 sec. Timer t = new Timer(this, 5); its shows me error at this line too. Here is the code please explain me what causes the errors and how do i make the ball move, Thank you

public class MainActivity extends Activity  {

static int F_WIDTH = 800;
static int F_HEIGHT = 600;
static int MIN_X = 0; // left - ball
static int MIN_Y = 16; // up - ball
static int MAX_X = 742; // right - ball
static int MAX_Y = 521; // down - ball
static int BALL_SIZE_X = 100;
static int BALL_SIZE_Y = 100;
Timer t = new Timer();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new ArcView(this));
    RelativeLayout rlayout = (RelativeLayout) findViewById(R.id.main_layout);

    rlayout.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            right(); // <---- this is the error
        }

    });
}
static class ArcView extends View {
    Paint paint;
    Path path;
    RectF rect;

    public ArcView(Context context) {
        super(context);
        rect = new RectF(50, 50, BALL_SIZE_X, BALL_SIZE_Y);

        paint = new Paint(Paint.FILTER_BITMAP_FLAG);
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.CYAN);
        paint.setStrokeWidth(30);

        path = new Path();
        path.addArc(rect, 360, 360);
        setBackgroundColor(Color.WHITE);
    }
    float x = 0, y = 16, muvx = 0, muvy = 0;

    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas); …
Stefce 146 Posting Pro

Excuse me but can i know what do you mean by "I have this shell script" ?

Stefce 146 Posting Pro

Oh i have not focussed on reading thank i have make it :)

@Override
    public void mousePressed(MouseEvent e) {
        if(e.getButton() == MouseEvent.BUTTON1) {
            int xpos = e.getX();
            int ypos = e.getY();
            x = xpos;
            y = ypos;
            System.out.println("Position: x: " + xpos + " y: " + ypos);
        }
    }
Stefce 146 Posting Pro

I have this code but its shows me error at @Override

@Override
    public void mousePressed(MouseEvent e, Graphics g) {
        if(e.getButton() == MouseEvent.BUTTON1) {
            int xpos = e.getX();
            int ypos = e.getY();
            Graphics2D graphics = (Graphics2D) g;
            graphics.fill(new Ellipse2D.Double(xpos, ypos, BALL_SIZE_X, BALL_SIZE_Y));
            System.out.println("Position: x: " + xpos + " y: " + ypos);
        }
    }
Stefce 146 Posting Pro

Can you show me in the code above how to do that ?

Stefce 146 Posting Pro

I have the coordinates on mouse click and i have the ball already i need just the ball to move to the mouse cursor when ill put Graphics g in the mousePressed class its showing me error... so what should i do to make the ball move to the cursor

Stefce 146 Posting Pro

I think this should help you JDBC Connection and also you have another way of doing this, you can use URLConnection, i like more this way i dont know why :)

Stefce 146 Posting Pro

Hello i have a little problem over here im trying to make a mouse listener and on mouse click the ball to come to the mouse pointer... i have maked a small "game" which is not bunch of confusing code... i have maked the ball to be controlled by the keyboard arrows but i want to use the mouse too, so when ill click somewhere in the area the ball to come to the mouse, here is the code...

package fungame;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Ellipse2D;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;

public final class FunGame extends JPanel implements MouseListener, ActionListener, KeyListener {

    Timer t = new Timer(5, this);
    int points = 20;
    double x = 0, y = 16, muvx = 0, muvy = 0;
    static int F_WIDTH = 800;
    static int F_HEIGHT = 600;
    static int BALL_SIZE_X = 40;
    static int BALL_SIZE_Y = 40;
    static int MIN_X = 0; // left - ball
    static int MIN_Y = 16; // up - ball
    static int MAX_X = 742; // right - ball
    static int MAX_Y = 521; // down - ball

    public static void main(String[] args) {

        JFrame f = new JFrame();
        FunGame fungame = new FunGame();
        f.add(fungame);
        f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(F_WIDTH, F_HEIGHT);
    }

    public FunGame() {
        t.start();
        addMouseListener(this);
        addKeyListener(this);
        setFocusable(true);
        setFocusTraversalKeysEnabled(false);
    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D graphics = (Graphics2D) g;
        graphics.fill(new Ellipse2D.Double(x, y, BALL_SIZE_X, BALL_SIZE_Y));
        g.drawString("|     Points: " + points, 170, …
Stefce 146 Posting Pro

Please i cannot make it i tryed again the same thing on the page you give me but the menu does not appear in the index.html site ...

Stefce 146 Posting Pro

Im putting the php code under the first <html> tag but doesn't work please tell me where to put the code ?

<html lang=mk>
    <? php include('menu.html'); ?>
    <head>