Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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  Java Game APIs & Engines / Java 2D / how can i make a modal JInternalFrame? on: 2003-04-08 03:45:59
Hi,

I have a JInternalFrame subclass object that I placed onto a JFrame. But when it is placed, I cant see the border of the JInternalFrame object. And when I click on the its title bar to make the border appear, the JInternalFrame disappears into the back(since I also have other JPanels filling up the JFrame already before placing the internal frame), and only when my mouse hovers over the positions of the buttons that were in the now disappeared internal frame, those buttons appear again, but not the entire internal frame.

So my question is, how could i make the internal frame modal, so that it wont go to the back until I close it? Also, how could i display the missing border of the internal frame in the beginning?

I've thought of using JOptionPane, but it seems it can only be used for small windows of OK, canel..etc
But my Internal frame is actually a buying screen for my game..

I hope someone can help me..
Thank you in advance.
2  Java Game APIs & Engines / Java 2D / Re: Trouble displaying an image.. on: 2003-04-02 06:33:43
Quote
If you are going to make a game or some sort of graphical applikation that doesn't need buttons, list from AWT or Swing I strongly recommened that you take a look at BufferStrategy or LWJGL.


yeah...I'm trying to make the GUI for a Risk type of game...in a very very short period..and I'm still stuck at things like this...im pathetic  Cry

can u elaborate on BufferStrategy and LWJGL?
thx again
3  Java Game APIs & Engines / Java 2D / Re: Trouble displaying an image.. on: 2003-04-01 22:40:26
I can finally get it to work!!! By adding it as a JLabel!!
and it can support images of size larger than 512x512!!

this is how I implemented:

public class Game1 extends JFrame{
     
     public Game1()
     {
           super("Game1");
           ImageIcon icon = new ImageIcon("map.jpg");
           JLabel l = new JLabel(icon);
           this.getContentPane().add(l);
           setSize(1600,1000);
           setVisible(true);
     }
           
     public static void main(String args[])
     {
           Game1 application = new Game1();
           
           application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     }
}


I can finally display an image~~~thx to all who have helped me out during the last 12 hrs~~ Smiley

But now I have a simple question
what is the difference between using paint to display an image (which i thought was required for all this time) compared to using JLabel? advantages..disadvantages?
4  Java Game APIs & Engines / Java 2D / Re: Trouble displaying an image.. on: 2003-04-01 21:12:26
Backmask:

thx for the code, but....it still doesnt show anything, not even the black blackground that u've set, it's still grey.

but I've discovered something, thx to
System.out.println("image size: " + map.getWidth(this) + ", " + map.getHeight(this));
it's that when the code runs, it returns : -1, -1

This means the image isnt loaded properly..right?
But I'm sure my path to the filename is 100% correct..since I'm storing it in same folder...

Cry
5  Java Game APIs & Engines / Java 2D / Re: Trouble displaying an image.. on: 2003-04-01 06:11:27
Backmask:
I've tried using ImageIcon now...but it doesnt work still.
this is what i've done:

I added
ImageIcon tempImage = new ImageIcon("javalogo.gif");
I cannot add the .getImage() at the end as u've stated..

and then I've added
container.add(new JLabel(thing1.tempImage));
in the main


still not showing...
and also, I dont think MediaTracker is really needed in this case since I'm only loading an extremely small java logo gif file...but thx for the recommendation, I'll keep that in mind. Thx again for ur reply Backmask!  Smiley

arghh...this is driving me insane...why cant i do something as simple (supposedly) as this... Cry
6  Java Game APIs & Engines / Java 2D / Re: Trouble displaying an image.. on: 2003-04-01 05:28:33
I just tried what u said, taking out the setLayout, but it still doesnt work, it is still all grey.
I even just tried to load the small Java logo on top of this page, which I saved onto my PC, but it is still the same... :-/
thx again for ur reply though !
7  Java Game APIs & Engines / Java 2D / Re: Trouble displaying an image.. on: 2003-04-01 05:03:59
thank you very much for ur reply jbanes!
well the original image i intended to display is quite large..but the file size is small...
but thats not really the issue here, since I've already tried displaying a very small jpg file, and nothing is still showing, it's just all grey.
I really think my code has some problem....can u kindly try my code with an arbitrary image on ur machine to see if it loads? thanks again!!  Smiley
8  Java Game APIs & Engines / Java 2D / Trouble displaying an image.. on: 2003-04-01 04:36:33
Hi, I'm a beginner to Java graphics, and all I'm trying to do now is to display an image, but I have no idea why the image is not showing, all it shows is the default grey background of the JFrame object..

Here is the simple code:


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

public class Test extends JPanel{
     
           
     public Test()
     {
           Toolkit toolkit = Toolkit.getDefaultToolkit();
           Image map = toolkit.getImage("map.jpg");
       }
     
     
     public void paintComponent(Graphics g)
     {
                g.drawImage(map, 0, 0, this);    
       }

     
     public static void main(String args[])
     {
           Test thing1 = new Test();
           
           JFrame window = new JFrame("Testing");
           
           Container container =        window.getContentPane();
           container.setLayout(new FlowLayout());
           container.add(thing1);
           
           //JButton butt = new JButton("Butt");
           //container.add(butt);
           
           window.pack();
           window.setVisible(true);
           window.setSize(800,1100);
           window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     }

}




I think the component that draws the image (thing1) is not showing, since I have no probelms showing a button...
Can someone please point out for me what I'm missing...I've spent 4 hrs already on the problem.....your help would be much appreciated...thank you!
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your 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.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (123 views)
2013-05-17 21:29:12

alaslipknot (131 views)
2013-05-16 21:24:48

gouessej (161 views)
2013-05-16 00:53:38

gouessej (153 views)
2013-05-16 00:17:58

theagentd (166 views)
2013-05-15 15:01:13

theagentd (151 views)
2013-05-15 15:00:54

StreetDoggy (195 views)
2013-05-14 15:56:26

kutucuk (219 views)
2013-05-12 17:10:36

kutucuk (218 views)
2013-05-12 15:36:09

UnluckyDevil (221 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.117 seconds with 21 queries.