Google WindowBuilder for Java - java

I made a GUI in Eclipse using the Google WindowBuilder plugin. The problem is that when I right-click on the design representation of my code and click, "Test/Preview," my GUI works and looks perfectly (the picture on the right), but when I click the "run" button in Eclipse to actually run the code, the GUI looks all weird (the picture on the left).
Does anybody have a clue as to what the problem is?

Ok this could have multiple reasons, the most obvious one being, that you (accidentally?) set your JButtons' background Color to the same dark-gray as your Frame's background. Check This first! WindowBuilder's preview has a quirk of sometimes not showing recent design changes on some elements immediately.
If that Is not the case with you, it might be some weird formatting thing.
Have you manually changed your buttons' formatting within the code and not within the design tab? Then add (Say your button is called okButton) okButton.repaint(); after the changes you manually made.
If this still doesnt work,
Try adding okButton.setVisible(true); (Althought that is pretty far fetched, seeing that a button outline can be seen!)

Related

How to show all errors in one place? A navigation window for "x error found"?

On the right, we can see something going on, and after it is done, it shows "x error found".
What is this exactly? Java compiler? Lint tool? Build-in analysis?
The problem is, when file gets large, it is hard to find out where the error is.
I know we can use F2 to navigate, but it also navigates to warnings. It would be nice to have a window showing all the errors in one place. Where is the navigation window for "x error found"?
Thanks for Vucko's answer. I didn't know it is clickable. Really appreciate it. But, I have to click that, hover my mouse over the codes, then wait for the error details to pop up, which costs lots of time. Also, warning is clickable, which is annoying. I still prefer a window.
Just Figured it out by myself.
After we Build > Make Project, Messages window pops up. All the errors show up here. We can click on each error to navigate to the corresponding file and location, or copy it to search on Google.
It is most likely Java compiler. Somehow it compiles on the fly. But, sometimes it is not reliable just like Instant Run is not reliable. If it becomes inconsistent with Messages window, try to restart Android Studio.
Never mind how big the file is, you can simply find the error by clicking the horizontal red line below. Every error will have it's own line and by clicking on it, you will be taken to that line immediately.
See the image for better understanding of what I mean:
Note: This is quite a useful tool for some other stuff as well, for example warnings will be shown and colored in orange (every color is customizable of course), and if you're using version control, e.g. Git, your changes will be colored in blue/green for edits/additions respectively.
I know we can use F2 to navigate, but it also navigates to warnings.
You can right-click on the scrollbar and select this option.
Go to high priority problems only
Have you tried filtering Logcat to Error? Like this:
Try Analyze --> Inspect code this will give you all your error with line number. it will even show typo

Netbeans Removing JPanel does not remove from source

I made a JTabbedPane using Netbeans 7.4. After adding a few things, I decided I didn't want all of the tabs I have created anymore. I then simply compied the JPanel inside of the JTabbedPane onto the same JFrame, and deleted the now unused JTabbedPane. Thing is, all the variables used are still being initialised in source code, even though they do not show up in the Design Navigator or on the JFrame in design mode.
I know I can simply edit this out with a external editor, but I am afraid that the Form data will be corrupted. (This has happened to me before and I lost the ability to edit using Design Mode.)
I used the inspector and FindBugs, but I failed to remove it from there.
"Why am I using Netbeans!?" - A question I won't be asking myself again after I sort this out.
Your first real problem is you are using the Design Mode. Netbeans isn't the problem as is is more than capable of working by itself with code only (I will always only use code).
It is really easy to break a program with a incorrect move within design view.
There isn't really an easy way to go about fixing it, although IMHO sift through the code and find what you need to remove. Make a copy of the .java file first so you have a backup if it breaks!

Opening a JPanel form in NetBeans GUI Builder causes strange behavior

I recently tried to open a JPanel form that I created with NetBeans GUI Builder and NetBeans almost freezes up on me. The design form is an all-gray background, not the usual gray area where I can place components surrounded by a white background. If I click on the Source button and then switch back to Design view, all of the tabs in the editor pane disappear.
Fortunately I am using Git for version control. The last commit of this file was over a week ago. I might have to revert to an earlier version to see where this problem was introduced. In the mean time, does anyone have any idea what could cause this behavior? Is it possible that my .form file is corrupted? The application compiles and runs just fine.
It sounds like Netbeans can't load the form due to some internal error. This can sometimes be fixed by doing a clean & build to clear out any old cached data.
If that doesn't work, you can check out the "message.log" for the error...and yes, I wish it would display it on the screen
Off memory it use to be in "{user.profile}/.Netbeans/{version}/var/log" (I think). It got moved on Windows under 7.2 to "{user.profile}\AppData\Roaming\NetBeans\7.2\var\log"

Java 5 - Bring Modal Dialog to Front on any click

Setting: Java 5 - no upgrade possible.
I have a large application that has a number of modal dialog windows. I have heard that hidden modal dialogs can result in uninformed users going so far as to restart their computer. Even if a user knows how to ALT-TAB (in MS Windows, at least), it's a pain. From what I understand, this was in part fixed in later versions of Java, but that's not an option here, unfortunately.
So, is there any way to force a modal dialog to be shown if any part of the running application is clicked on? I was thinking it might have something to do with either MouseListeners, GlassPanes, or something else. However, I've got a bunch of other stuff I'm supposed to be working on, so I don't have a lot of time to devote to hashing this out right now. Can anybody point me in the right direction?
Thanks so much!
So, is there any way to force a modal dialog to be shown if any part of the running application is clicked on?
When you create the dialog you need to specify the parent frame as the owner of the dialog. Then whenever you click on the frame any dialog that is a child will also be shown.

Substance L&F seems to break when deployed as webstart in java

I think I am having a weird problem:
I 've written a small application in java implementing a JTable to display some results.
I am also using the Substance L&F as my "skin".
Everything seems to be working perfectly.
When I upload the app on my server as webstart, strange things start to happen:
At some point my app generates a little JTable. Every time I mouse over that table,
the app's JButtons or menus or any swing control in general will stop responding. My only option is to close the window and restart the application. Note that the interface seems not to be frozen but like it's lost its focus... if I try to click in any of the table's cells, the UI will still be responsive (not on the swing controls though).
If I get rid of Substance, the problem goes off and everything is working normally again.
If I use another "skin" like JTattoo everything works flawlessly as well.
This only happens when I use the webstart. Does anybody know why..?
or better has any hints on how to fix it?

Categories

Resources