472,782 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

How to open any window application with specified size(window) using Java?

4
I am using Java to open a window application. i need to open it in a specified size. Please let me know how to do this...Thanks in advance...

- Vatz
Mar 12 '09 #1
8 4187
r035198x
13,262 8TB
Which class did you use for the Window? A JFrame? The API specs will contain the methods.
Mar 12 '09 #2
vatz
4
Thanks for your reply.
I am not using JFrame. And i am not developing the application. As part of my work, i just need to open any window application, for eg: windows media player with a predefined size, which i need to specify while opening. Hope you are able to get me.

- vatz
Mar 12 '09 #3
r035198x
13,262 8TB
How are you opening the application from Java? Runtime.exec? I suppose it would depend on the application being opened. Whether it allows you to pass window size arguments when launching or whether it allows window resizing at all.
Mar 12 '09 #4
vatz
4
Yes. I am using Runtime.exec. Assuming that my application allows to accept window size arguments, could you please tell me how to do that?
Thanks.
Mar 12 '09 #5
JosAH
11,448 Expert 8TB
@vatz
If you can start that other application in the same JVM, i.e. call the main() method of the other's application main class you can get the frame from the Frame class (read the API documentation) and set its size.

kind regards,

Jos
Mar 12 '09 #6
r035198x
13,262 8TB
The exact syntax for the arguments would be documented in the application's manual itself. You do know how to call Runtime.exec with a command and arguments right?
Mar 12 '09 #7
vatz
4
Thanks to both of you.
i do know how to call with a command, but i do not know how to use the arguments. please help.

- Vatz
Mar 12 '09 #8
JosAH
11,448 Expert 8TB
@vatz
If you take the approach I outlined in my previous reply, you simply do this:

Expand|Select|Wrap|Line Numbers
  1. public class YourClass {
  2.    public static void main(String[] myArgs) {
  3.       final String[] theirArgs= myArgs;
  4.       try {
  5.          SwingUtilities.invokeAndWait(new Runnable() {
  6.             public void run() { OtherApplication.main(theirArgs);
  7.          });
  8.          thread.sleep(SOME_TIME); 
  9.       } catch { e.printStackTrace(); }
  10.       Frame[] frames= Frame.getFrames();
  11.       // play with the frames array ...
  12.    }
  13. }
  14.  
kind regards,

Jos
Mar 12 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ben | last post by:
Hi there, in a form, here's what I want to do : <input type=button onclick= (???) is it possible to open a pop-up window with a specified url without using javascript ? Thanks
1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
1
by: timw07 | last post by:
I am looking for some code that will create a list of all open window's titles... for example if you have Outlook, IE and IRC open the list or array of strings will contain Outlook, IE, IRC... I...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
3
by: MLH | last post by:
I seem to remember a post in the distant past discussing how to switch to another open application window. IE, if WordPad is running, some API function that'll allow me to switch the focus to that...
0
by: lauren quantrell | last post by:
I have an Access 2000 application and I am using ShowWindow to hide the MS Access application window. Works fine as long as there is a popup form open all the time. The problem is when I want to...
1
by: Doug | last post by:
When opening a DOC file via a hyperlink, is it possible to force Microsoft Word to open in a specified-size window? For example, a 600x300 window? I realize that MS Word will 'remember' the...
1
by: peerraghu | last post by:
hi i am creating travels project using .net and c# and iam new to java scripts i want to open new window with in the same page after clicking the image i have wreiten code just look at this ...
1
mageswar005
by: mageswar005 | last post by:
Hello, In My Application i have open the PDF file from javascript open.window function.In This scenario i want to control / Hide the PDF Toolbar from open.window function. My Current code is...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.