Results 1 to 15 of 15
  1. #1
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default What's possible to display in a JInternalFrame?

    So im developing a game client with neat tools next to it.

    Im using a JFrame, and inside that an InternalJFrame.

    What i want is to load a .jar file into that JInternalFrame, but i dont know how to. i dont even know if its possible o.o
    I read the API. didn't find anything useful.

    So is it possible to load a .jar file into a JinternalFrame and display it? it's a .jar game.

    If that's impossible, is it possible to load another .jar file (game) into a JFrame and display it?

    i didn't try anything yet.

    Thanks in advance
    Never give up.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: What's possible to display in a JInternalFrame?

    Jars have nothing to do with Swing. Jars contain classes and resources and those classes and resouces can be loaded/unloaded by Java classloaders if they are on the classpath - that's it. They are not going to magically be adding components to a Swing GUI, you need to write code to dynamically build a GUI.

    A note: any tool I built for a game, I kept separate from the game itself (so as a separate application with its own code base). Then you have total freedom on how you implement the stuff. You could for example check out the Netbeans platform which has advanced GUI features including dynamic loading and building. But that's a very tough subject matter.
    Last edited by gimbal2; 09-05-2013 at 05:28 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default Re: What's possible to display in a JInternalFrame?

    To expand on what gimbal2 said, you're thinking about it the wrong way: you can't just load a jar into a component. However, you can add that jar to the classpath and add, for example, the JPanel containing the game screen to another component of yours.

    This assumes that the code is yours and not somebody else's game, in which case you're going to have to contact the creator of the game.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by KevinWorkman View Post
    To expand on what gimbal2 said, you're thinking about it the wrong way: you can't just load a jar into a component. However, you can add that jar to the classpath and add, for example, the JPanel containing the game screen to another component of yours.

    This assumes that the code is yours and not somebody else's game, in which case you're going to have to contact the creator of the game.

    This pretty much answered my questions.

    So it's possible to add the jar to the classpath and display it in a JPanel?
    Even when i don't have the .java files etc.?

    How would i go about displaying a game screen in a JPanel?
    ^That's all i have to know!
    Never give up.

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default Re: What's possible to display in a JInternalFrame?

    What jar are you talking about? Is this your game? If you're trying to write, say, a shell around an existing game that somebody else wrote, you're going to have to contact the author of the game. Not just for legal and ethical reasons, but because the components are probably private so you can't do exactly this.

    However, if the code is public (such as an API), then once the jar is on your classpath you can use the classes it contains just like any other class.

    Before we proceed, what game are you talking about?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by KevinWorkman View Post
    What jar are you talking about? Is this your game? If you're trying to write, say, a shell around an existing game that somebody else wrote, you're going to have to contact the author of the game. Not just for legal and ethical reasons, but because the components are probably private so you can't do exactly this.

    However, if the code is public (such as an API), then once the jar is on your classpath you can use the classes it contains just like any other class.

    Before we proceed, what game are you talking about?

    Im talking about Soulsplit RSPS. Its a runescape private server

    I dont have any other files, only the .jar file downloaded.
    Im probably authorized to use it because a team there hired me to program some useful stuff for them
    This not my game, but im indeed trying to write a shell around it
    So i want to make whole new frame and then display the .jar in my program so i can display and program some tools around it.
    Never give up.

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default Re: What's possible to display in a JInternalFrame?

    That's going to be much harder or maybe even impossible. You need permission (and documentation) from the runescape team, not another team who wants something build around runescape. I don't know how runescape works, so maybe they do indeed give access to their stuff.

    But either way, this isn't going to be as simple as just displaying a game inside a JPanel.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,541
    Blog Entries
    7
    Rep Power
    20

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by MR bruto View Post
    This pretty much answered my questions.

    So it's possible to add the jar to the classpath and display it in a JPanel?
    Even when i don't have the .java files etc.?

    How would i go about displaying a game screen in a JPanel?
    ^That's all i have to know!
    You have to add that .jar file to the classpath otherwise the code (the .class files in that .jar file) can't be found; and only if that game allows to be configured to display itself in some JComponent, it can be done. Most games however, take over the entire screen and don't bother with other components on that screen.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by JosAH View Post
    You have to add that .jar file to the classpath otherwise the code (the .class files in that .jar file) can't be found; and only if that game allows to be configured to display itself in some JComponent, it can be done. Most games however, take over the entire screen and don't bother with other components on that screen.

    kind regards,

    Jos
    This game will, i believe its 680 by 450 or something.
    So how will i go about actually displaying it after adding the .jar to the classpath?
    I searched the internet but im still totally clueless because i haven't got any results :/
    Never give up.

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,541
    Blog Entries
    7
    Rep Power
    20

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by MR bruto View Post
    This game will, i believe its 680 by 450 or something.
    So how will i go about actually displaying it after adding the .jar to the classpath?
    I searched the internet but im still totally clueless because i haven't got any results :/
    That game has to know in what JComponent to display itself; you have to be able to tell it that. If the game doesn't offer that capability, the show is over, i.e. the game displays itself whereever and however it wants. Most games are like that.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default Re: What's possible to display in a JInternalFrame?

    Like I said, you can't just add an existing game to whatever component you want. You need permission and documentation from the team who built the original game.

    Based on the questions you're asking, you're biting off way more than you can chew. I recommend starting with something simpler (a Pong clone for example) before getting into more complicated stuff.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  12. #12
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by JosAH View Post
    That game has to know in what JComponent to display itself; you have to be able to tell it that. If the game doesn't offer that capability, the show is over, i.e. the game displays itself whereever and however it wants. Most games are like that.

    kind regards,

    Jos

    So my aim is displaying it in a JPanel now.
    How will i go about that? How will i tell the game?
    Do i need to instantiate the .jar file or anything?
    Never give up.

  13. #13
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,965
    Rep Power
    8

    Default Re: What's possible to display in a JInternalFrame?

    We can't help you if you simply ignore our advice.

    Without access to the game's code and documentation, this isn't possible.

    Based on the questions you're asking, you need to start smaller.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  14. #14
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,541
    Blog Entries
    7
    Rep Power
    20

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by MR bruto View Post
    So my aim is displaying it in a JPanel now.
    How will i go about that? How will i tell the game?
    Do i need to instantiate the .jar file or anything?
    Ask the authors of the game.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  15. #15
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: What's possible to display in a JInternalFrame?

    Quote Originally Posted by JosAH View Post
    Ask the authors of the game.

    kind regards,

    Jos
    Alright, the information is greatly appreciated.
    Thank you :)
    Never give up.

Similar Threads

  1. Replies: 1
    Last Post: 09-27-2011, 04:19 PM
  2. Replies: 4
    Last Post: 09-27-2011, 09:20 AM
  3. Replies: 0
    Last Post: 08-09-2011, 06:07 PM
  4. jInternalFrame
    By kiranjava in forum Advanced Java
    Replies: 1
    Last Post: 05-20-2010, 12:04 PM
  5. JInternalFrame Help
    By collin389 in forum New To Java
    Replies: 2
    Last Post: 03-16-2010, 12:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •