1

is there a way to open a program, that usually opens a new jframe, into an existing jframe?

here is the explanation, I have downloaded a java game one of those reflexes ones and it opens in a jframe with a bunch of sub panels inside of the frame, what i want to do is wrap the existing jframe in another frame or canvas or something so i can build internal scripts for it as apposed to building external scripts that require screenshots and getting pixel data. by internal scripts i mean scripts that run inside the new jframe

mKorbel
  • 109,525
  • 20
  • 134
  • 319
user1179522
  • 145
  • 1
  • 3
  • 8
  • 1
    Have you ever heard of `JInternalFrame`? – mre Feb 01 '12 at 19:21
  • guess not but the problem with that is i don't have access to the games script so i cant change the game meaning i cant make it a JInternalFrame. – user1179522 Feb 01 '12 at 19:27
  • Would [JFrame#getRootPane](http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html#getRootPane%28%29) and [JFrame#setRootPane](http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html#setRootPane%28javax.swing.JRootPane%29) suffice? – Anthony Accioly Feb 01 '12 at 19:33
  • 1
    There's no need to "wrap" a JFrame in anything here. You can simply launch it from another program and call anything you want on its classes. Placing the GUI in another window will give you no more control over it. – Hovercraft Full Of Eels Feb 01 '12 at 19:38
  • 1
    I don't think he's looking to "wrap" the window for the purpose of "additional control". He's looking for some sort of "docking" mechanism where he has a master application which in turn launches other applications, and wants to "dock" these other apps inside the master app. – eternaln00b Feb 01 '12 at 19:50
  • yea you got it Sid that's exactally what i want – user1179522 Feb 01 '12 at 20:28
  • See also [`Launcher`](http://stackoverflow.com/a/5696404/230513). – trashgod Feb 02 '12 at 01:22

1 Answers1

2

The usual way to achieve custom functionality would be to extend the class and override methods to add new/altered components and & new/altered methods.

OTOH I doubt that someone who refers to Java code as 'internal scripts' has the experience needed for this task. It would be better to start with simpler goals.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • yep i fully agree i don't have the experience, just started so i doubt the above question even made sense to someone like you however if you would be so kind as to explain all of that above stuff so someone with little experience can understand and do research i might be able to surprise you with how quickly i pick it up. – user1179522 Feb 02 '12 at 02:39
  • Start with the [Learning the Java Language](http://docs.oracle.com/javase/tutorial/java/) trail of the Java Tutorial. Ask more questions when you can come up with a (more specific) question. – Andrew Thompson Feb 02 '12 at 02:47
  • yep been doing that dose not really work for my learning style which sucks cus it seems really in depth and well throughout. nope the way i learn is by watching it get done then doing it myself. – user1179522 Feb 02 '12 at 03:03
  • *"watching it get done"* Hire a personal tutor or search YouTube. SO is not geared for the type/form of learning that you need (to the extent that your question becomes off-topic). – Andrew Thompson Feb 02 '12 at 04:06