Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (790)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
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 01:45:59

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 04:33:43
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 a very very short period..and I'm still stuck at things like 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 20: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()
           ImageIcon icon = new ImageIcon("map.jpg");
           JLabel l = new JLabel(icon);
     public static void main(String args[])
           Game1 application = new Game1();

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 19:12:26

thx for the code, 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...

5  Java Game APIs & Engines / Java 2D / Re: Trouble displaying an image.. on: 2003-04-01 04:11:27
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 03: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 03: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 02: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());
           //JButton butt = new JButton("Butt");


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]
hadezbladez (2832 views)
2018-11-16 13:46:03

hadezbladez (1022 views)
2018-11-16 13:41:33

hadezbladez (2795 views)
2018-11-16 13:35:35

hadezbladez (547 views)
2018-11-16 13:32:03

EgonOlsen (3818 views)
2018-06-10 19:43:48

EgonOlsen (4229 views)
2018-06-10 19:43:44

EgonOlsen (2540 views)
2018-06-10 19:43:20

DesertCoockie (3352 views)
2018-05-13 18:23:11

nelsongames (3463 views)
2018-04-24 18:15:36

nelsongames (4456 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 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‑
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!