How to surround JTable with JScrollPane through windowbuilder? - java

In Eclipse Jigloo plugin you can right click on JTable and choose "surrond with JScrollPane".
But in windowbuilder pro plugin I can't find a way to make JTable with JScrollPane

Add a scroll pane to your UI. Then drag and drop the table onto the scroll pane. During the drag over scroll pane window builder will highlight its areas - make sure you drop onto the central one.

Alteratively the following also works nicely;
Add a JTable
Right click on the JTable in the tree view
Select: Surround With > JScrollPane

Another option would be to use NetBeans to do some of your Swing layout.
I've had limited experience with WindowBuilder, but I use NetBeans for designing prototypes and find it much easier for creating UIs. The resulting code generated from NetBeans will also be viewable using WindowBuilder.

I am using WindowBuilder 1.7.0 and Swing designer 1.7.0 in Eclipse in Mac. At first I was finding similar menu like Jigloo which I did not find. My Jigloo always crash in Mac and show license message, so I discarded it :)
Later with some playing, I found how to do it in WindowBuilder, specially if you have already designed the JTable/JTextArea/JTree and do not want to delete it. After that you need to put them scrollable.
You can use the tree view on the left. Normally you cannot drag a component into the scroll view. However add the scroll view in the frame. Set proper layout to the component where you want to put the scroll view. Usually its BorderLayout, may in a JPanel. Drag the JScrollView into target area. Use the tree view for all these actions. Then finally drag the JTree/JTable into the JScrollPane in the frame design view. To my experience this works better. Play with the Layouting of the parent components.

Related

Java Swing Panel collapse into drop down on resize

I am working on ribbons using Java Swing technology. I am not using the already made framework called Flamingo (it's not giving the style I want), rather I am implementing it via the netbeans swing drag and drop. I want to make the panels collapse into drop down when the window is resized.
Like if we resized the window to be very small, we will have 3 dropdowns: File, Preferences and Help. Each drop down gives the elements in each section.
Any ideas how to achieve this?

How to disable the on hover display of expand arrow in GUI treeviewer? I want them to always be visible

How can I disable the on hover display of expand arrow in my GUI's treeviewer? I want the expand arrows to always be visible, I'm not sure but I think this is a feature of Windows GUI. Is there a workaround for this to have the arrows always visible so the user knows the fields are expandable (clickable) and not just lines displayed. The expand arrows are only visible on hover of the mouse. See attached image the first image is the default view. The one below is what I get on hover of the mouse.
This is controlled by the native control that SWT uses to draw the tree. SWT does not have an option to change this.
The details of how the tree view look vary significantly on the different platforms supported by SWT. For example on Macs the expand 'twistie' is always shown.
This is now fixed in Eclipse 3.8. The expand arrows do not disappear anymore after upgrading my target platform from Eclipse 3.7 to Eclipse 3.8 which means that the arrows are visible without hovering on top of them. Hope it helps others.

No components visible in visual editor of Vaadin

Do you know why I can't see the components in the visual editor of Vaadin. The thing is that if I drag'n'drop from there, I can put the components into the layout. They are just not visible.
because its about jre,
solution
you should install 7u71 to see your components visible in visual editor of Vaadin

Adding a component to jpanel in netbeans

I have been trying for the past few hours to figure out how to add a label component to a window however with no prevail. I have created a new desktop application project in Netbeans and it comes with pre-generated code. I want to add a label to it but it just does not show?. I am unsure as to why because i am following the normal panel.add(component) convention.
Would really appreciate some help!. I pasted the full file sourecode here http://pastebin.com/qJk6bSWn .
Any ideas?
What layout is your JPanel using? If it's using the Netbeans GUI builder default of free design you won't be able to manually add components. You'll need to set it to some layout manager.
Parts of your gui can have the Free Design layout, but you'll need to change the layout of the components that you want to manually add to.

How do I make controls autosizing in Qt designer?

I'm using Qt Jambi 4.4 for a project I'm working on (and designing the windows in the Qt Designer eclipse plugin). One of the windows I'd like to use is a preview window which is basically just a window with a QWebView on it. How can I make it so that the QWebView resizes as the window does? I've set the sizePolicy to expanding for both Horizontal and Vertical position. What else do I need to do?
(also bear in mind that I'm a newbie to both Java and eclipse and need to be talked to in stupid people terms on both of those subjects)
UPDATE
Just to illustrate the point, here are a couple of screenshots (I've made the window background bright just to illustrate my point):
alt text http://img13.imageshack.us/img13/2103/screenshot2oi7.jpg
alt text http://img152.imageshack.us/img152/6250/screenshot1mz9.jpg
I don't know Jambi, but with Qt Designer just give the background the focus and then apply a layout from the toolbar. Then the main widget will get resized by that layout manager -- if you don't add that layout manager you'll get the widget resizing but the contents staying at their old positions.
I haven't used qt-jambi, but if it is anything like Qt in C++ or PyQt, the QWebView would resize automatically as the window size changes. As far as I know, setting size policies/ expansion factors, adding QSpacerItem objects etc. is only necessary if the sizing behavior is not working right. Just laying it out using an appropriate layout within the preview window should be sufficient. Do let me know if I have misunderstood the question.
You need to place the QWebView in a layout, that it will follow the change in its "container". For using layout with Qt Designer, refer to http://doc.trolltech.com/4.5/designer-layouts.html
From Qt Designer docs:
The form's top level layout can be set by clearing the selection
(click the left mouse button on the form itself) and applying a
layout. A top level layout is necessary to ensure that your widgets
will re-size correctly when its window is re-sized.

Categories