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  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  ) 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... 
|
|
|
|
|
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  (there is no way i've been able to get the panels painted on the image  ) 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 
|
|
|
|
|
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() { 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); 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); 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 { 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 { 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.jpgThe 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....
|
|
|
|
|
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  Btw... what is a layout?
|
|
|
|
|
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 
|
|
|
|
|
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  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  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  ) 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{ 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()); } catch (IOException e) { System.out.println("Excepcion al intentar leer la carta de archivo"); } } |
|
|
|
|
|
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)
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|