Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Ashutosh M Kulkarni

Ranch Hand
+ Follow
since Jun 07, 2010
Ashutosh likes ...
Eclipse IDE Firefox Browser Java
Pune, India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
8
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ashutosh M Kulkarni

All you need to do is write an actionPerofrmed() method for your menu.
You will easily the find the syntax if you SearchFirst for it :-)
10 years ago
I apologize for the new thread, I waited for over a day and there was no reply, I thought maybe the new thread would gather responses sooner.
Anyway, the purpose of this thread is met (got a reply in my older thread after all), so I request you to please delete this thread, it has no fruitful outcome anyway.

Thanks,
Ashutosh
10 years ago
Hi Arun,
Thanks for the reply.

Although I was late to mention it, I found the solution to my problem. I know in what situation JFrame/JInternalFrame should or should not be used, and I think I am using both the types quite appropriately for my requirement.
Anyway, earlier when I tried

it didn't work...
(mainPanel is a JPanel object here)

But now somehow it is working so my problem's solved. :-)

But the problem is that InternalFrame is not selected when it is visible. I tried setSelected(true) and toFront() methods but to no use... :-(
Any ideas?
10 years ago
How can I successfully call a JInternalFrame from my main JFrame class. I know the syntax but it isn't working. Not sure if I need to set any specific attributes for the same.
The frames that I designed inside the main JFrame form are executed when called, but the one I tried to write in a separate java file isn't working when called from main class.
I am using the Visual Editor provided with NetBeans 6.9.1

Any help?

Thanks,
Ashutosh
10 years ago
Err, yes. I was having some problem with the Maximize button, when I tested it on different machines with different screen res.
But now when I did that again, it seems to work all fine. Sorry about the fuss

Thanks for replying,
Ashutosh
10 years ago
As the subject says, if a frame is executed on different screen resolutions (the most common 800x600 and 1024x768, in the regular, non-HD, non-widescreen display screen), is there a way to set it up that "maximize" button will maximize the frame to fit screen with whatever resolution set?

Also, how to open it in maximized form by default?

Thanks,
Ashutosh
10 years ago
So looks like I made the post for nothing... LOL

never mind.
10 years ago
This is what you could do.


Note that above code is not foolproof and in fact, is quite vulnerable. But I have just added one line to your code, to show what could be done. If you are to use this professionally for some project, you might wanna put some checks on what value is entered through jTextField1 because it may contain a lot of special characters, multiple decimal points, letters, etc.

In line 04 (refer code above), I have put a label on the frame which will be modified to whatever value user enters from the textfield.
Please refer to attachment to see an example.

Regards,
Ashutosh
10 years ago
I have another question in the same matter.

How can I successfully call a JInternalFrame from my main JFrame class. I mean, I KNOW the syntax but it isn't working. Not sure if I need to set any specific attributes for the same.
The frames that I designed inside the main JFrame form are executed when called, but the one I tried to write in a separate java file isn't working when called from main class.

Any help?

Thanks,
Ashutosh
10 years ago
First of all, welcome to the Ranch and the fascinating world of Java.

About your JFrame class, it pretty much looks like you have posted the code of a frame that you designed in NetBeans (or similar IDE). The whole code in initComponents() method declaration is auto-generated. Since you are providing the user with a Swing interface, it's only recommended to use the frame itself for coding rather than having a separate class.
With an IDE such as NetBeans, it's quite easy to do this. All you need to do is just use the GUI design mode and use the components context menus.

For example, consider you have a Frame named myFrame, in which you have few textfields and a Submit and a Cancel button. Your aim would to be close/kill the window on clicking "Cancel". For this, in design mode, you just right-click the "Cancel" button and go to
Events-> action -> actionPerformed.
When you click on actionPerformed, you will be taken to source code and a method will be readily created of the form

Now all you need to do here is, write this in your method.


Also, this could help you a lot in what you wish to do. This should give you a basic idea... Keep digging in.
http://java.sun.com/developer/technicalArticles/tools/nb_guibuilder/

Also, if possible, please post a screenshot of your frame here so it would help others to assist you better.

Cheers,
Ashutosh.
10 years ago
Of course there are workarounds for every possible sticky situation that our work could put us in.
But as Bear already said, it is all unnecessary or rather pointless when Ajax can handle it amazingly well.

I feel for you because it looks like you've been assigned a Functional background lead, technical person wouldn't have such an opinion. :-(
10 years ago
JSP
A prime reason for me to go for the visual editor is because I need it for a better-looking GUI.
I have previously worked on NetBeans visual editor for Swing and know how the stuff works. The reason I am facing problems is just because the code is frozen and I am unable to make changes only as needed.
Never mind, I will try your way as the last option

For now, I have to wait until I get home from work.
10 years ago
Err...
There is a big problem with NetBeans (I am not sure if everyone feels this way).
When I am designing a frame, it's great that the source code gets generated automatically, but in NetBeans, the code is frozen and I can't edit in any way. It freezes so that the code may not be used to manipulate and distort/disrupt the appearance of the frame.
However this kills the exact point Rob just made. I can't eliminate other (auto-generated) calls to these methods and that puts me in a spot.
Guess I could try a little more and see if I can find other ways.

Thanks for pointing it out, Rob
10 years ago
Hello everyone,

I am trying to design a JFrame with multiple JInternalFrame included therein.
I am using NetBeans IDE for the same, and for ease of designing and maintenance I have put them at different locations on the main JFrame.
However, I want all of them to pop up at the same location. I tried to use setLocation() method for that, but that doesn't help. The internal frames will pop up exactly where I have put them in Design mode. Also, I haven't tried what happens if I open up all the frames at the same time in execution - whether that will resize the main JFrame?

I am certain there is a better way of doing it, I am just unaware of it. Has anyone worked on this kind of a project?
Is there a better way to do it?

Any help is greatly appreciated.

Thanks,
Ashutosh.
10 years ago