Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (516)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: paintComponent on: 2011-06-05 18:09:13
-
2  Game Development / Newbie & Debugging Questions / Re: paintComponent on: 2011-05-22 17:57:20
I still don't know the difference between paint and paintComponent. I also have no idea what JComponent is.
3  Game Development / Newbie & Debugging Questions / Re: paintComponent on: 2011-05-21 19:38:38
Thanks guys,

what I was doing wrong is not sending (Graphics g) to the method I was calling.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
@Override
    public void paintComponent(Graphics g)
    {
   super.paintComponent(g);
   this.setBackground(Color.WHITE);
       
   g.setColor(Color.BLACK);

        drawBox(g);

        for(i=0; i<n-1; i++) // change for the purpose of testing, so paintComponent draws only the first and second box
        {
   g.drawRect(x[i], y[i], l[i], w[i]); //Class
        g.drawRect(x[i], y[i]+w[i], l[i], w[i]); //Variables
        g.drawRect(x[i], y[i]+w[i]*2, l[i], w[i]); //Methods
        g.drawString(className[i], x[i]+15, y[i]+15);
        g.drawString("VARIABLES", x[i]+15, y[i]+w[i]+15);
        g.drawString("METHODS", x[i]+15, y[i]+w[i]*2+15);
        }
    }

    public void drawBox(Graphics g)
    {
        i=2; // this method draws only the third box
        g.drawRect(x[i], y[i], l[i], w[i]); //Class
        g.drawRect(x[i], y[i]+w[i], l[i], w[i]); //Variables
        g.drawRect(x[i], y[i]+w[i]*2, l[i], w[i]); //Methods
        g.drawString(className[i], x[i]+15, y[i]+15);
        g.drawString("VARIABLES", x[i]+15, y[i]+w[i]+15);
        g.drawString("METHODS", x[i]+15, y[i]+w[i]*2+15);
        repaint();  //this is optional if called in this way
    }

4  Game Development / Newbie & Debugging Questions / paintComponent on: 2011-05-21 17:37:07
Hi

I'm trying to make a kind of UML design software and I was going to use the paintComponent to draw boxes.

However I cannot include paintComponent in a method or using multiple painComponents or calling methods in paintComponents as it says I haven't declared the Graphics g.

So I thought to use arrays to have multiple elements, but this way everything gets way too complicated, am I using a wrong approach?
Can you help me sort this out?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
package graphicdraw;

import javax.swing.*;

public class Main
{
    public static void main(String[] args)
    {
   JFrame f = new JFrame("UMLIDE");
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        draw d = new draw();
   f.add(d);
   f.setSize(800, 250);
   f.setVisible(true);
    }
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
package graphicdraw;

import java.awt.*;
//import java.awt.event.*;
import javax.swing.*;

public class draw extends JPanel
{

    int i;
    int n = 3;
    int[] x = new int[n];
    int[] y = new int[n];
    int[] w = new int[n];
    int[] l = new int[n];
    String[] className = new String[n];

    public draw()
    {
        i = 0;
        x[i] = 25;
        y[i] = 25;
        l[i] = 100;
        w[i] = 30;
        className[0] = "CLASS 1";
        className[1] = "CLASS 2";
        className[2] = "CLASS 3";

        for(i=1; i<n; i++)
        {
        x[i]=x[i-1]+110;
        y[i] = 25;
        l[i] = 100;
        w[i] = 30;
        }
    }
   
    public draw(int $x, int $y, int $l, int $w)
    {
        i = 0;
        x[i] = $x;
        y[i] = $y;
        l[i] = $l;
        w[i] = $w;
    }

    @Override
    public void paintComponent(Graphics g)
    {
   super.paintComponent(g);
   this.setBackground(Color.WHITE);
       
   g.setColor(Color.BLACK);

        for(i=0; i<n; i++)
        {
   g.drawRect(x[i], y[i], l[i], w[i]); //Class
        g.drawRect(x[i], y[i]+w[i], l[i], w[i]); //Variables
        g.drawRect(x[i], y[i]+w[i]*2, l[i], w[i]); //Methods
        g.drawString(className[i], x[i]+15, y[i]+15);
        g.drawString("VARIABLES", x[i]+15, y[i]+w[i]+15);
        g.drawString("METHODS", x[i]+15, y[i]+w[i]*2+15);
        }
    }  
}


5  Discussions / Business and Project Management Discussions / Re: [Paid] I need graphic 2/3D and programmer for an MMO possibly in London on: 2011-04-17 21:29:21
Thanks everyone again for the advice and mostly to make me understand better some aspects that I ignored in game programming. I bought a book called "Killer Game Programming in Java" for 2/3D and network games. So far, so good and also the level of knowledge I have is enough to understand the content of the book. Hopefully I will progress in my Java skills and make something to show you, so that you can give me further advice. Until then good luck to everyone with your projects.
6  Discussions / Business and Project Management Discussions / Re: [Paid] I need graphic 2/3D and programmer for an MMO possibly in London on: 2011-04-15 14:58:49
Frann as someone who's been a project manager for a MMO nearly 3 years, you probably not going to get any luck. The best way to start a MMO without the start up cash is to start it yourself. Get a small playable demo out(even if its crappy) and a place for a community to hang out, then start recruiting people who want to help in the project.



Well the idea behind this post was indeed to make the crappy demo - but I guess everyone else thought I wanted to make WoW in a month.

Thanks again for the advice.
7  Discussions / Business and Project Management Discussions / Re: [Paid] I need graphic 2/3D and programmer for an MMO possibly in London on: 2011-04-14 23:46:43
I don't think £50 is a ridiculus amount for a junior programmer or artist to spend a bunch of hours a week on a side project, but hey - that's me.
8  Discussions / Business and Project Management Discussions / Re: [Paid] I need graphic 2/3D and programmer for an MMO possibly in London on: 2011-04-14 22:33:26
I appreciate your comments.

I am currently studying programming in my own time and at uni. I had previous experiences in gathering people - for free, mostly friends - and do smaller projects and none has ever been finished. Everyone is off to a great start, but commitment always seem to lack in the end. That's why I made this post offering money, even if is a small amount I hope would have been a motivation for whom is not a senior programmer but commit on doing it. Apparently I was wrong again.

But I am not discouraged. Eventually I will finish my projects and I will be able to provide some documentation for people to actually get interested in my projects. Until then - I will build up my skills.

Thanks again.
9  Discussions / Business and Project Management Discussions / Re: [Paid] I need graphic 2/3D and programmer for an MMO possibly in London on: 2011-04-13 07:17:40
I'm aware that is a big project and I have a little to no-experience, and I have got no background in game designing. I have ideas, I can invest time on it, but I need someone else to do the development for me, that is why I am willing to pay. How much can I invest economically? So far a £1000, however I need to speak with whomever is going to code for me, and see what is feasible and what not, and how long will take.
I believe I can start something up from scratches, and sure for now I am not aiming at Diablo's high standards but something more simple, and then have iteration to implement feature on it.

For the graphic side, I really, really need some sketches -  this I reckon at the moment has the highest priority to present my product.
10  Discussions / Business and Project Management Discussions / [] Newbie that looked for MMO's developers in London but got advice instead. on: 2011-04-12 23:53:01
Hi,

I'm a Software Engineer student at the first year, I'm studying Java and I only have a grasp of it as I'm at the first year.

I like to make up projects however, I never get anything done as I always lack in some areas. Thats why I'd like to have a team that can develop one.

I'd like to start an MMO RPG/Hack'n'slash from scratches, I have the concept and I'm writing it down for my team to read in the future. For the time being however I'd like at least two members; a graphic artist and a programmer.

Graphics: I first would like to have sketches of what the game will look like and after that I will need 1 animated character + basic enviroment. The style will be like Diablo.

Programmer: You have to be able to make a game style that resemble Diablo and Minecraft, and be able to make it working online.

I'm sorry for the poor language used and low information. Feel free to ask more about it.

Payment: I cannot pay by hour, as would result extremely expensive for my budget, but I can pay by project. I can pay £50 a month each for the time spent on the project. I will eventually pay more depending of the progress done and other agreements.

I'm looking for a serious commitment in this project.

Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (33 views)
2014-10-27 03:28:38

TehJavaDev (26 views)
2014-10-27 03:27:51

DarkCart (41 views)
2014-10-26 19:37:11

Luminem (22 views)
2014-10-26 10:17:50

Luminem (27 views)
2014-10-26 10:14:04

theagentd (33 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (58 views)
2014-10-16 15:22:06

Norakomi (47 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!