Remove resize cursor from Window component in GXT - java

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.

Related

NetBeans look&feel same as resulting one

I am trying to find a java look&feel that can be used in NetBeans (I'm currently usign version 14) to have a "what you see is what you get" result
As I said here: netbeans design missing bold, I was using the Metal l&f, both in NetBeans (by launching it with the "--laf javax.swing.plaf.metal.MetalLookAndFeel" parameter) and in the code
But lately it doesn't work as it used to: in NetBeans the varoius graphical objects (labels etc...) have a "normal" font, but when i run the project, they have a bold font, which makes them larger and ruins their positioning. Thus I can't create a good graphical interface anymore, because I have lost the "what you see is what you get" effect
I have also tried different l&f, for example Nimbus. With it, I can solve my problem: NetBeans correctly shows the graphical objects as expected. But imho Nimbus has a big lack: non-editable obects (for example text fields) are showed identical as editable ones! (the Metal l&f instead makes a good work at this)
I'm searching for a l&f that can correctly be displayed by NetBeans, and that can differentiate between editable and non-editable objects. Can you point me out any?
Try com.sun.java.swing.plaf.windows.WindowsLookAndFeel.
You need not to put startup options in NetBeans, check look and feels Tools / Options / Apperance menu.
Another workaround would be making all non-editable widgets to be disabled - setEnabled(false).

Can I change the JComboBox thumb style?

I am getting a strange discrepancy between the preview and actual running of my jar file with a combo box, and it seems to be a default in both of my laptops which are entirely different design. I included a simple example image (below). The combobox does have 36 entries and should only allow one selection - which is why I prefer to use this element type. My issue is a strange look of the combo box thumb (image on right) in comparison with the typical and expected look shown in the image on the right from viewing the Preview Design in NetBeans. See image
Scouring the internet I cannot find much that shows this discrepancy. Thank you.
This looks like a matter of "Look and Feel":
https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
The Preview Design is using a different default L&F than the environment where you're running the application.

Java: Dynamic Layout using Eclipse Windowbuilder

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.

Is there a way to convert from Visual Editor created GUI to WindowBuilder GUI in Eclipse?

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

Where is setVisible in Netbeans palette?

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!

Categories