Joonas Järvinen

Greenhorn
+ Follow
since Mar 30, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joonas Järvinen

About releasing Swing objects. How do I do it? I remember reading this some where. But I tought that in Java one does not need to worry about over usage of memory in this section. Because Java does it automatically. Unlike ie. C++.
14 years ago
I'am not sure about the second part. Yet. But about the sql inqueries. This error comes when I'am only starting the application. So I'am not yet doing any sql commands. I'am not even connected to the database at this point.
But I try to look in to the second part of your post.
14 years ago
I just got java.lang.OutOfMemoryError: Java heap space erro when trying to run my program. I tried to put my max memory up to 500MB. But still getting the same error.
Tho I don't actually belevie that my program should even be using that much memory. It propably has 1000 lines of code. And even that is very optimistic guess. And all it does is make some SQL queries.
So how should I start to determine what is the problem. Maybe some kind of memory leak or someting. This is really the first time I'a, meeting this troblem.
Here's the error message:
[code]
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:3209)
at java.lang.String.<init>(String.java:216)
at java.lang.StringBuilder.toString(StringBuilder.java:430)
at javax.swing.JRootPane.createLayeredPane(JRootPane.java:490)
at javax.swing.JRootPane.<init>(JRootPane.java:348)
at javax.swing.JFrame.createRootPane(JFrame.java:260)
at javax.swing.JFrame.frameInit(JFrame.java:241)
at javax.swing.JFrame.<init>(JFrame.java:164)
at tietaexpress.Searchpanel.<init>(Searchpanel.java:25)
at tietaexpress.PersonTable.<init>(PersonTable.java:12)
at tietaexpress.Searchpanel.<init>(Searchpanel.java:22)
at tietaexpress.PersonTable.<init>(PersonTable.java:12)
at tietaexpress.Searchpanel.<init>(Searchpanel.java:22)
at tietaexpress.PersonTable.<init>(PersonTable.java:12)
at tietaexpress.Searchpanel.<init>(Searchpanel.java:22)
...
[code]

Yes. I know it must be frustrating to solve other peoples stupid errors. But try to bear with me :>
Thanks.
14 years ago
Uhhuh. Back again. This time I'am using CardLayout. But because my problem is so similar. I didn't bother making new thread about it.
So. I have exactly the same problem. But with CardLayout. I have stack of cards(classes). And I'an unable to call them from the Main class.
Also. I'am not sure how I should modify this SwingUtilities.getAncestorOfClass to be constructor compatible. It would be much more handy if it were in the constrctor.
Eitherway. It doesn't work with the cardLayout as it works with JDesktopPane. I don't quite understand why. Because as I see it. The idea is same.
Here's how it looks at the moment:


And the error message:
14 years ago
Iäam building an application that has forms with JTextFields and etc(duh). And at the moment I'am trying to lock their sizes. So they don't grow fat if window is resized. To this I'am using

in the X-axis components and BASELINE in the Y-axis ParallelGroups. But because one of my form looks like this:

label
I==I
label label
I==I I==I
label label
I==I I==I
[btn]

I==I is a text field.

So. How I'am supposed to lock that top group's text field when its compiled in Y-axis as SequentialGroup and because of that BASELINE cannot be applied to it.
14 years ago
If I want to set my panels size so it wont change no matter what. Do I have to set min, pref and max size or is there any more 'handy' way of doing it?
14 years ago
I'am trying to build a program that uses CardLayout and multiple JPanels. The problem I'am having is with JPanel sizes. How do I specify these component sizes? As far I'am aware of. SetSize() cannot be used when specifying component sizes. So what should I use to size them as I want?
I propably will have more problems coming with this. But lets go one at the time.
14 years ago
Well... I do have F-Secure internet security. But I have opened port 3306 and allowed all needed programs in it. I have also tried connecting to the db when all security programs are shut down. With no results what so ever.
But this still don't answer to my main problem. Why can't succesfully call WindowA (the window with label) from BtnWindow?
14 years ago
If you mean if that port is beign listened. Then I would guess yes. This is from 'netstat -a'
TCP 0.0.0.0:3306 My-PC:0 LISTENING
And MySQL query browser also connect to the db using that port. Also the abcuser has every access possible to give in my db server.
Oh. Sorry about that. Bad example. Other similar methods tho do have those and nothing is coming out. Anyway. I made a simple three class program that has one JDesktopPane and two windows in it. One calls another. And ofcourse this call doens't work.
Here is the whole code of the program:
JDesktopPane. Which is also holds the main method.

Button windows which is supposed to call label window when button is pressed:

And finaly the label window:


I'am only getting errors when I try to call automically openBtnWindow() at the start of the calss. Why it doesn't work like that but work fine when calling it manually?
Here is StackOverflowError:

It pretty much just repeats the last three lines couple hundred times so I didn't copy all of it.
So. What I'am doing wrong here? Thanks in advance is you are considerate enought to review this code.
14 years ago
I'am not that familiar with command line when connecting to the DB. I typed '-uabcuser -pabc' and clicked enter as the quide I was following said. But it just whiched line and made '->' mark. Then I tried ';' to mark as end of the sentence, but it didn't work either. So what am I doing wrong here?
DB sure works fine with MySQL Query browser.
Also, if I want to add port to the url. Is it like this?

If so, it didn't work either.
No exceptions. I have printStackTraced everything but nothing is coming out.
14 years ago
Quick review to my program. It has many smaller windows that are called to the JDesktopPane and one of these windows is menu, which calls other windows to appear. These smaller windows are in another class than JDesktopPane and this menu window(duh).
The problem is. When I'am trying to call these windows from menu. Windows don't appear. No error messages are given. But when I'am doing it from the same class as the JDesktopPane. It calls these windows without problems.
Here's the code:
This is from the JDesktopPane:

And from the menu window:

It works fine when I'am calling openServer() from the same class as this method. But not when calling it from the outside. Any ideas what is causing this?
14 years ago
Firewall can block connection even tho db is running from the localhost? Well. What ever it is. It's not fw.