I am using Netbeans on design mode for to make a gui. I am looking for a property corresponding to the setVisible method of java and I can not find it.
I have looked in Properties and Binding, but have found nothing.
At last I have written this.component.setVisible(false); in Post-Init Code in the section of the pallet code.
Is there another way to do this?
PS: I use Netbeans 7.1
What I did was right click the label and go to Customize code and make the label visibility as false.
Nope!
If you're using netbeans the default is to open components as visible. As far as i'm aware this can't be changed unless you do not use a GUI builder such as netbeans.
As you said in your question you can just simply set the component's .setVisible() parameter to false or true depending on what you would like!
Related
I have this Afficheur java class in my project (its a DrawingPanel) which takes a MainWindow object in parameter. MainWindow is essentially a swing UI which Netbeans automatically generated code for as I designed it with their desing tool.
In order for it to work I have to edit this generated code by Netbeans and add 'this' in parameter to Afficheur when I create a new Afficheur (see line 85), which only is possible when I edit the code in notepad.
This method makes my code work but as soon as I try to modify the UI with the netbeans design tool the whole thing messes up. I know this is the issue because I tried removing 'this' and then modifying my UI and then adding 'this' back and everything worked fine. Its like netbeans can't generate code properly when I have modified its code. Any Idea on how I can resolve this issue?
Just go to the design tab and then right click on the item you want to change the code of and then click customize code (or something like that, i don't remember correctly) and edit the code.
I'm working on a Java project (for those curious, it's a Rcon and Query client for Minecraft servers) and I'm trying to create a GUI. I'm using Eclipse Windowbuilder, and I'm trying to make the program window dynamic (in other words, when the window is resized, everything else moves and scales to fit), but none of the layouts seem to do that (which defeats the purpose of the layout, doesn't it). It's worth mentioning that I'm putting four groups on the screen, which will contain other things and should take up all available space. I would put the code here, but there's nothing besides the default application framework generated by Eclipse. So, what layout do I use for dynamic resizing and such? Or am I missing something stupid?
(P.S. I've tried GridLayout, FormLayout, and many others. They didn't work.)
The following is for Eclipse Windowbuilder users.
For this to work (assuming GridLayout is used) you must set several properties for every single thing in the GridLayout:
grabExcessHorizontalSpace should be true (check the box)
grabExcessVerticalSpace should also be true (again, check the box)
horizontalAlignment should be set to FILL (selected from drop-down)
verticalAlignment should also be set to FILL (also selected from drop-down)
Thanks to greg-449 for giving me this link, which solved the problem.
Since Visual Editor is no longer supported in newer versions of eclipse, I am trying to make the switch to WindowBuilder.
It seems that I should just be able to open a panel created in Visual Editor in WindowBuilder and all components should display, but this does not seem to be the case. All components sizes seem to come in as 0px x 0px and even after changing this, the components still do not show up in the preview window.
All components are custom that extend the standard JComponent (such as JLabel).
I am not sure if the problem is some sort of incompatibility, the fact that I am using custom components and containers, or a problem with my WindowBuilder installation (or something else!). Does anyone have any insight? I would be much appreciated! :)
If I understand your question correctly, all you'd have to do is right click the class in the package explorer > Open with > WindowBuilder Editor
I have found that sometimes the code doesn't transfer over nicely when trying to directly re-open the file using the WindowBuilder editor. I found that creating a new WindowBuilder document of the same type as your existing code, then replacing the file contents works pretty well, if you don't mind the inconvenience.
After working on this problem for some time I have found out what was causing the errors. It seems that Visual Editor was a bit more forgiving when parsing the code to display the preview.
My issues with Window Builder generally stemmed from the following things:
lack of paramterless contructors in both the panel/dialog to be displayed and components within. WB relies on these constructors to parse the code
trouble getting dynamically generated resources which led to throwing null pointer exceptions. Visual Editor seemed to ignore these and display what it could. Window Builder would not display any part of the offending component. Adding null checks in certain places remedied this.
After fixing these problems, I did not have to recreate any of my GUI screens in Window Builder
The Window component that I use has Resizable flag set to false but the resize cursor on the edges still appear. Is there any way to change the cursor to normal ?
I am using Sencha GXT 3, with appearance pattern.
EDIT:
Both answers (SSR and Jonathan) are correct but a bit overkill. And what happens to other Windows which are resizable ?
I notified Sencha about the issue and they labeled it as a bug. Upgrading to GXT 3.0.3+ will solve the issue.
It might be not be possible without hacking into gxt code. The resize cursor code seems to be hardcoded into css styles in gwt code which is obfuscated. You can see in the below image a obfuscated style with cursor : e-resize;
Open up gxt jar. Copy the relevant Window code into your code base in same package structure as gxt and then make the changes in gwt template style related to Window. Ensure this class is in higher classpath hierarchy than gxt code when gwt compiler picks it up.
Log a bug with GXT team to get a official patch.
The Resizable class has ResizableAppearance. If we look in ResizableBaseAppearance, we can take a look at how the GXT team has implemented this stuff.
I'm guessing that what is going on is that when a Window is initially created, Window.setResizable(true) is called which injects the styles and sets up the handlers for resizing.
You could roll your own ResizeableAppearance and set up your deferred-binding rules to use yours instead of the default ResizableBaseAppearance (make sure those rules come after your inherit of GXT in your *.gwt.xml).
This will replace the appearance of the Resizer in ALL Windows. So, the trick would be to figure out how to determine if resizing is turned off or not.
Hope this helps.
I am using Google Web Toolkit's Swing Designer in Eclipse to create and edit components like custom JFrame's.
The problem is that the Design View is sometimes broken for my class (probably because the project is also being edited by another person in a different platform), and I want to know how to restore it. In other words, I am able to edit the code for a custom JFrame, but I cannot use the visual editor to modify the JFrame anymore. I notice that the icon for my JFrame's source code also changes to a normal java-source-code icon when the design view is broken.
In which file does Eclipse keep track of what JFrame's can be edited using the visual editor and which ones not?
Thanks in advance.
If you want to open a file in the designer, but that's not happening by default, then use right-click Open With>WindowBuilder Editor.
If you don't see the Design tab, that means that you are just using the standard Eclipse Java Editor rather than the WindowBuilder editor. Eclipse allows you to use different editors via the Open With command. This is very basic Eclipse behavior, so it is something you should learn about. This is also covered in the WB docs and FAQ.