Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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
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 04: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 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()
     {
           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 19: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 04: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 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());
           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]
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (46 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (60 views)
2014-11-29 21:32:03

toopeicgaming1999 (124 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!