Netbeans - How to do setsize() of a frame? - user-interface

I have made a GUI in Netbeans. Now I want that the frame size should remain constant, means the user cannot do maximize or restore the frame.
When I go the the frame properties dialog box, I didn't see any property that allow me to set the size of the frame.
I opened the frame properties dialog box by right clicking on the "FrameView" node in the "Inspector" window.
How can I do that?

Uncheck "resizable". That will prevent the user from changing the window size.
Next, set the preferredSize property (if you're using java.awt.Frame instead of JFrame set the minimumSize property instead).

Related

How to set Initial DeskBand Width?

I have a deskband based on the MS sample. It shows as an item via right click taskbar, toolbars. I find that when initially opened it's using the DBIM_MINSIZE instead of the DBIM_ACTUAL size. Why is that?
What is the appropriate way to set the initial width (bonus, when the deskband is closed (remove checkbox from toolbar) then opened again, how do you have it use the prior width)?
TIA!

Change window status from maximized to restore without moving/resizing the window?

I am trying to have finer grained control over my windows maximize/restore behaviour. When I restore I want to position and size the window myself overriding the default windows behaviour where it repositions to the original position.
I currently restore (which moves the window to its original location) and then move it again to the location I want but this results in a jumpy experience. Can I do change window maximize/restore status without moving the window?
Thanks
You could try GetWindowPlacement, modify rcNormalPosition, SetWindowPlacement and finally ShowWindow to restore...

"Always show selection" doesn't work on CListCtrl in list mode

I want a user to be able to select item(s) in my CListCtrl and then click on a button to act on those items. But when the focus is lost from the list, the selection is no longer shown, even if I set 'Always show selection' to true:
This happens both in the dialog test facility, and in my compiled application. I use list-mode, and have no icons, only text.
To reproduce:
Create a new dialog in the resource editor
Place a list-view control.
Set View = List in the properties
Set Always Show Selection = True in the properties
Add a button to the dialog
Press Ctrl-T to test the dialog
Select item(s) on the list, then press the button
..and the text is not visibly selected at all. Or is it... I can just
barely sort of see some very very faint selection in my screenshot - I
think. It's so faint I am not 100% certain it's there!
In addition to my comments: well, there you have it - they are selected, and in a different color, but it seems your screen settings are a bit off. Maybe your color settings, a high contrast mode, or the color setting for selected items in Windows.
The gray color in your screenshot is: #f7f3f7 - light gray, so you might have a problem seeing it, depending on the settings.
An interesting and very lightweight tool to check those things (zoom in, see the color values) is ZoomPlus. I use it every day, and there seems to be source code available too.

Does XUL support different modality scopes?

Is it possible to create a dialog using XUL (specifically in Firefox) that is:
Always-on-top but does not blocking user interaction with a page
and/or
Only tab modal, not window modal
?
You can surely have a non blocking Dialog, but it will go to the background when you click the window. For reference see this:
window.openDialog("chrome://membees/content/dialog.xul",
"","centerscreen=yes, all=no, titlebar=yes, chrome=yes, toolbar=yes,
dialog=no, resizable=no,modal=no","");
But if you want a bit more of control you can create a panel instead, and take advantage of the level property:
level
Specifies whether the panel appears on top of all windows, or just on
top of the window the panel is in. If this attribute is not set, the
popup window level depends on the platform. On Linux, the default
value is top, otherwise, the default value is parent. If a panel has
one or more text fields, this attribute should not be set, otherwise
IME or on-screen keyboard popups will appear incorrectly. For these
reasons, you should avoid setting the level if not needed.
top
The panel is shown in front of all other normal windows, including those of other applications.
parent
The panel is shown just above the window the panel is in, but behind
other windows above it. If anchored, the child window maintains its
relative position to its parent window.
floating
The panel floats above the window the panel is in. On Mac, the panel
is only visible when the application is active.
To create it you have to add it to the base element <popupset> in your overlay, and then you open it with:
openPopup(anchor,position,x,y,isContextMenu,attributesOverride,triggerEvent )

Window disappears when resizing in Carbon Simulator

I'm trying to build a resizable Carbon window as part of a tutorial. I am using Interface Builder 3.2.3 on Snow Leopard 10.6.4.
If I create an empty Carbon project and add a window object from the Library (with Close, Minimize, Resize and Zoom buttons in the Inspector all checked), run the Carbon Simulator and then attempt to resize the window by grabbing the resize control, the window vanishes.
However if I create a Carbon project that already has the window object included (i.e instead of an empty project where I add the window myself after first creating it) I have no problem resizing the window in that case.
I try to visually match the selections in the Inspector to see what is different between the settings of these two cases but I don't readily notice any differences in the two sets of parameters that are displayed. Thus I am curious as whether there are more settings that just aren't displayed on the Inspector.
Are there any common reasons for a Carbon window to vanish upon resizing?
Thanks
I notice that if the option to receive clicks is not checked, then the window goes away when you try to resize it. But I don't know how you could uncheck that accidentally.
JWWalker, thanks for the response. Receive Clicks was checked on both versions.
But I think I was able to (sort of) figure out the discrepancy examining the .nib file.
Both files have two keys defined: maxSize (under com.apple.ibtool.document.localizable-all) and gMaxSize (under com.apple.ibtool.document.objects). In the working file both of these have a string setting of {480, 270}. In the nonworking file they had a string setting of {0, 0}. Apparently the default configuration of the working file was setting the maximum size of the window equal to zero. In Inspector the Window Template Size tab had the "Maximum Size" box checked but a "0" for both Width and Height. I clicked the box once to clear the check. Ran the Carbon Simulator again and the window resized properly without disappearing. When I rechecked the box, Inspector automatically filled in the Width and Height parameters with valid values of 480 and 270. I ran the Carbon Simulator again and it resized properly in accordance with the new maximum size constraint.
I don't fully understand the XML code in the .nib file but apparently the default setting for the maximum size of the window was being set to zero. The incorrect code appeared in the .nib file as follows (with non relevant lines deleted):
com.apple.ibtool.document.localizable-all
<dict>
<key>1</key>
<dict>
<key>maxSize</key>
<string>{0, 0}</string>
com.apple.ibtool.document.objects
<dict>
<key>1</key>
<dict>
<key>gMaxSize</key>
<string>{0, 0}</string>
You must uncheck the minimum size and maximum size in window template size or set the correct value.

Resources