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   
Pages: [1]
  ignore  |  Print  
  JDesktopPane in a UIWindow?  (Read 719 times)
0 Members and 1 Guest are viewing this topic.
Offline aNt

Senior Member




AFK


« Posted 2004-04-30 14:37:11 »

Anyone no how to get it working? i get:

java.lang.IllegalArgumentException: adding a window to a container

Maybe im pushing the Xith swing angle a little to far?

here me code- nice and simple:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public class InternalFrame extends UIWindow {
  public InternalFrame(int width, int height, boolean includeExitButton) {
    super(width, height, true, true);
   
    JDesktopPane desktop = new JDesktopPane();
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
   
    JFrame j = new JFrame("hello there");
    j.setBounds(30, 30, 200, 400);
    j.setVisible(true);
   
    desktop.add(j);
   
    setRoot(desktop);
  }
}
Offline StefanD2

Senior Newbie




Java games rock!


« Reply #1 - Posted 2004-05-04 06:12:07 »

That's a swing only question:

You cannot add a JFrame to a JComponent. That is impossible. The other way around works if you use
1  
yourJFrame.getContentPane.add(yourJComponent);


In your case you can only use any subclass of JComponent  to add to your DesktopPane.

If you need a frame like structure take JInternalFrame which is a subclass of JComponent and is a lightweight version to support features like JFrame.
Offline aNt

Senior Member




AFK


« Reply #2 - Posted 2004-05-05 07:51:07 »

thought it maybe. thanks for the reply dude. but i get nothing at all showing when i do it this way:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
    JDesktopPane desktop = new JDesktopPane();
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

    JInternalFrame jif = new JInternalFrame("hello there");
    jif.setBounds(0, 0, 200, 200);
    jif.setVisible(true);
    jif.show();
   
    desktop.add(jif);
    setRoot(desktop);


see anthing im doing wrong? i been messing with this for awhile and think im just being a muppet..
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline StefanD2

Senior Newbie




Java games rock!


« Reply #3 - Posted 2004-05-05 21:19:28 »

When I tried my first steps with swing & xith  for the first time it was not working but after that I set any bounds of any object - that is all parent objects of your internal frame should have them set also.

If that does not help you may try a simpler example without internal frames and desktop pane.  A simple jpanel should work (maybe add a label also).

PS: I remember not having success when trying to move internal frames on the UIOverlay. Event handling is not as expected (the canvas always want to be the receiver/originator of events - had a hard time when making a workaround for textfields WITH real working eventlisteners - thread Prob with Xith, Swing, textfield + listeners http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1079039524). The other way around seems easier (Xith within swing gui: see thread "Xith and Swing ")

BTW: as far as I know show and setVisible are equal (though show is deprecated).
Offline aNt

Senior Member




AFK


« Reply #4 - Posted 2004-05-06 09:28:35 »

cool it was a setBounds thing.. i should have spotted that. cheers.. and more importently thanks for the pointer to Events. sounds like alot of hassle awaiting me there next Smiley.. me internalFrames are there now.. but with no events being passed for draging them. and them events as u say are just being passed directly to xith..

thanks again
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

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

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

E.R. Fleming (8 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 (26 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

Zero Volt (51 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23
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!