Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 / simple question about java.mail.* on: 2008-03-08 15:52:32
I wrote the previous topic in a hurry because i was going out of home and i was expecting an answer when i returned home so i'll rewrite the question:

I want to add the possibility of sending an email to my application.

I've heard that you need the java.mail package but it is not in the java standard edition, it is included in the java enterprise edition.

Can i distrubute the application to my client, without the need of installing more things that the JRE?
2  Java Game APIs & Engines / Tools Discussion / Has someons heard about jGRASP? on: 2008-03-01 00:23:02
I discovered that one friend of mine, who has developed java tools for college for some time know was using jGRASP for programming.

Do you think is a good or a bad tool?

Seems like it is a "hardcore" tool because it doesn't even expand the methods of an object when you write the dot after the objects name making the development with a mostly unknown class more difficult  Undecided

I've done a pair of tests with it and it starts up fater than eclipse and netbeans (few things start up slower than netbeans nowadays  Roll Eyes) but apart from that it doesn't shine
3  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-07 21:06:10
I think i've read all of the tutorials, (i dont have time to read ALL the tutorials of everything '^^)

Now what i do is draw some rectangles over the panel with the image, BUT after they are drawn, they dissapear... ive tryed to overwrite the paint method too but with no success (although the tutorials say that this is a no no...)

I'm starting to getting embarrased of asking here... Embarrassed  Embarrassed
4  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-07 19:35:33
kova, you "win", i'll draw directly the cards without using a panel for every card Tongue (there is no way i've been able to get the panels painted on the image Sad)

I think it will be harder to manage, but i wont do miracles nor a wow game with them so is worth the extra code Tongue
5  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-06 20:59:31
My point is, i think that the best solution is put my cards with absolutie posicioning, the user won't be able to resize the window anyway...

But i dont understand why the cards aren't shown..

Edit: now no big black rectangle is shown...

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  
public MesaGrafica() {
        //Note: X offset = 4, Y offset = 30
       super("Mus");
        fondomesa = new Fondo();
        ssalida = new JScrollPane();
        salida = new JTextPane();
        puntuaciones = new JPanel();
        puntuacion1 = new JTextPane();
        puntuacion2 = new JTextPane();
        infoderecha = new JPanel();
        this.setLayout(null);  //For the absolute posicioning
//The next lines are to create the infomation panels that are shown correctly (there should be no problem from here
       SimpleAttributeSet centrado = new SimpleAttributeSet();
        StyleConstants.setAlignment(centrado,StyleConstants.ALIGN_CENTER);
        puntuacion1.setParagraphAttributes(centrado,true);
        puntuacion2.setParagraphAttributes(centrado,true);
        puntuaciones.setLayout(new BoxLayout(puntuaciones,BoxLayout.X_AXIS));
        puntuaciones.add(puntuacion1);
        puntuaciones.add(puntuacion2);
        infoderecha.setLayout(new BoxLayout(infoderecha,BoxLayout.Y_AXIS));
        ssalida.setPreferredSize(new Dimension(196,266));
        puntuaciones.setPreferredSize(new Dimension(192,260));
        JLabel estado = new JLabel("Estado");
        estado.setForeground(new Color(0,0,255));
        estado.setAlignmentX(Component.CENTER_ALIGNMENT);
        infoderecha.add(puntuaciones);
        infoderecha.add(Box.createRigidArea(new Dimension(0,20)));
        infoderecha.add(estado);
        infoderecha.add(ssalida);
        ssalida.setViewportView(salida);
        this.setBounds((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth()/2 - 400,(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()/2 - 300,800,600);
//to here
       cartasEnMesa = new CartaGrafica[4][4];
        cartasEnMesa[0][0] = new CartaGrafica(156,428,57,85);
        cartasEnMesa[0][1] = new CartaGrafica(233,428,57,85);
        //(...)
       for (int i=0;i<4;i++)
        {
            for (int j=0;j<4;j++)
            {
                cartasEnMesa[i][j].setLayout(null);
                this.add(cartasEnMesa[i][j]);
            }
        }
        this.add(infoderecha);
        this.add(fondomesa);
        infoderecha.setBounds(600,0,192,566);
        puntuacion1.setBorder(BorderFactory.createLineBorder(new Color(0,0,0),1));
        puntuacion2.setBorder(BorderFactory.createLineBorder(new Color(0,0,0),1));
        puntuacion1.setEditable(false);
        puntuacion2.setEditable(false);
        this.actualizarPuntuaciones(null);
        salida.setEditable(false);
        salida.setFont(new Font("Arial",Font.PLAIN,10));
        this.setVisible(true);
        this.setResizable(false);
        fondomesa.setVisible(true);
    }

CartaGrafica "code" the important thing is the paint method, the gets and sets are omitted here...
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  
public class CartaGrafica extends javax.swing.JPanel {
   
    /** Creates a new instance of CartaGrafica */
    private StringBuffer rutaImagen;
    private int jugador;
    private boolean tapada;
    public CartaGrafica() {  
    }
   
    public CartaGrafica(int x, int y, int width, int height)
    {
        super();
        this.setBounds(x,y,width,height);
    }
    public void paint(Graphics g)
    {
        if (rutaImagen == null)
        {
            g.setColor(new Color(0,0,0));
            g.fillRect((int)this.getBounds().getX(),(int)this.getBounds().getY(),(int)this.getBounds().getWidth(),(int)this.getBounds().getHeight());
             return;
        }
        if (this.estaTapada())
        {
            g.setColor(new Color(0,0,255));
            g.fillRect((int)this.getBounds().getX(),(int)this.getBounds().getY(),(int)this.getBounds().getWidth(),(int)this.getBounds().getHeight());
        }
        else
        {
            try
            {
                //((Graphics2D)g).setTransform(java.awt.geom.AffineTransform.getQuadrantRotateInstance(1,this.getWidth()/2,this.getHeight()/2));
               g.drawImage((Image)ImageIO.read(new File("C:\\" + rutaImagen.toString() + ".jpg")),0,0,this.getWidth(),this.getHeight(),null);
            }
            catch(IOException e)
            {
                g.setColor(new Color(0,0,0));
                g.fillRect((int)this.getAlignmentX(),(int)this.getAlignmentY(),this.getWidth(),this.getHeight());
                System.out.println("Ha fallado al leer la imagencita");
            }
        }
    }
}


It could be nice to print directly into the frame but the image to print depends on the values of another class (a non graphical Card) and this way (with a JPanel) i think is easier of implement...
6  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-05 20:43:45
Well, after some tries, i will tell what i've got:

I've got a frame of 800x600 which it should show, a JPanel that shows an image of about 600x600, in the right side of the screen i have 3 textpanels that show different information, until here everything is okay.

The 3 textpanels are organized in different layouts but they show everything i want like i want. The problem comes with the main image.

Over this image, there should appear 16 different pannels on a distribution like:

http://img236.imageshack.us/img236/2096/cardlayoutta0.jpg

The problem is: if i use no layout (JFrame.setLayout(null)) then only the components with layout will be shown (the info on the right side of the screen and with their right size) but no cards and no background image is shown.

If, in the other hand, i use the default layout (a box one?) then a big black square appears instead of the background (this is, i believe, because when the cards are init they look like black rectangles).

Can someone help me in choosing the correct layout? if absolute posicioning must be used, can someone help me use it? because i've done what java tutorials say but with no success
7  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-05 13:53:20
to put the cards in the field i won't use a layout but for the other components i'll use a layout, because the cards will have a more or less arbitrary position and no layout can help me. Anyways, the user wont be able to resize the main frame....
8  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-04 20:32:22
thank you kova

EDIT: i believe that the problem of anchoring is because the layout says what position must the components be in. I think i'll make my game without a layout until i've "played" more with layouts
9  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-03 21:12:43
what is anchoring?

When designing the frame, you put components and the IDE automatically puts them in a precise position, seems that if you move the component in execution time (like with 4 buttons editing their bounds) the component seems to move yes, but it usually automatically returns to it's starting position...

The solution for this, is to write yourself the code of the JFrame Cheesy

Btw... what is a layout?
10  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-03 18:25:26
there is any way to prevent the components to automatically anchor?
11  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-03 00:09:28
I have a new problem, when rotating a image 90 degrees it gets cut some pixels.

The rotated image has some of the upper and lower parts of the original image missing, does anyone know why it happens?

1  
2  
((Graphics2D)g).setTransform(java.awt.geom.AffineTransform.getRotateInstance(Math.toRadians(90),this.getWidth()/2,this.getHeight()/2));
g.drawImage((Image)ImageIO.read(new File("C:\\" + rutaImagen.toString() + ".jpg")),(int)this.getAlignmentX(),(int)this.getAlignmentY(),this.getWidth(),this.getHeight(),null);


I've been tweaking with the code and it seems that the component holding the image does not draw the full image or the component is taller than wide when the image is wider than tall

I'll go to sleep, it's too late now  Undecided
12  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-02 22:58:48
finally yesterday i managed to print the card in a jpanel, thanks to the example in the tutorial you recomendend, thank you!, now i will review your code.

Summering up, that does the layout class do?
13  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-01 23:08:54
the tutorial with the example is usefull ^^

The event is in fact called, but it does nothing that i want '^^

i'll take a loot at that actionhandler

the IDE automatically blocks some code, it's true that you can edit the code directly with the notepad but i don't use those workarounds, yet  Embarrassed

i know i know, its paintComponent(Graphics g)
14  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-01 20:37:30
I've been trying those things you've said to me with no success, maybe i've forgotten to say that the event is in a class named MesaGrafica that is a JFrame, does this change the things? :S

JFrame created automatically by the NetBeans IDE, not by me.

I believe that i found a serious question to ask: What graphics Class must i pass as parameter of the paintComponents method of the JPanel?
15  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-06-01 12:39:55
I've discovered that i have a program to make an online chess game but i still cannot make a card appear in the playfield Sad i need help.

From now i want to make appear a card in a JFrame when a JButton is pressed,  looking to an example on this forums i decided to make an especial JPanel class named CartaGrafica (GraphicCard self explanatory  Roll Eyes)

Here i attach the code, someone help me?

The class code
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class CartaGrafica extends JPanel{
   
    /** Creates a new instance of CartaGrafica */
    public CartaGrafica(int x, int y) {
        super();
        this.setBounds(x,y,100,139);
    }
    public void pintaCarta(Graphics g)
    {
        super.paintComponent(g);
        g.drawImage(Toolkit.getDefaultToolkit().getImage("C:\\carta.bmp"),0,0,100,139,null);
    }
}

code of the event
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
        try
            {
                cg1.pintaCarta(ImageIO.read(new File("C:\\carta.jpg")).getGraphics()); //cg1 is an instance of CartaGrafica
           }
            catch (IOException e)
            {
                System.out.println("Excepcion al intentar leer la carta de archivo");
            }
}
16  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-05-30 17:47:34
no suggestions?
17  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-05-29 21:37:22
any suggestion on what should i use to make the cards appear in the jFrame? i was thinking about a panel but i've started to think it isnt a good idea...
18  Java Game APIs & Engines / Java 2D / From bufferedImage to Image on: 2007-05-28 22:05:52
There is any way to convert a BufferedImage to an Image? Because the toolkit.createImage() method cannot be found (or that does it say my netbeans IDE  Huh)
19  Game Development / Newbie & Debugging Questions / Re: Making a card game on: 2007-05-27 18:39:59
just use java2d, it's more than enough. I assume you will go for swing and passive rendering.

Thank you, i have to download anything else that the jdk 1.6 with netbeans to use that?

and... what is passive rendering?
20  Game Development / Newbie & Debugging Questions / Making a card game on: 2007-05-27 16:26:44
Hi! i'm doing a subject at university that is about java application development and i'd like to make a card game (something like solitaire) but i don't know what api use?

Can someone suggest me one? (im using the netbeans ide and i dont need to have an excelent performance and the game will not be graphics intensitive, its a card game)
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.

Riven (11 views)
2014-07-29 18:09:19

Riven (8 views)
2014-07-29 18:08:52

Dwinin (9 views)
2014-07-29 10:59:34

E.R. Fleming (25 views)
2014-07-29 03:07:13

E.R. Fleming (10 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (27 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!