Problems with absolute layout - java

I'm a beginner and I used absolute layout in my GUI application using Eclipse WindowBuilder. It works just fine most of the time, but when I minimize or maximize the GUI the content either moves to one side of the page or some part of it vanishes. Can you give a solution for this layout problem? Should it auto adjust itself?

Related

How to get Matisse GUI to show up my custom added components? [duplicate]

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.

Viewpart Eclipse RCP resize

I'm writing an Eclipse RCP 3 application. The application contains a menu on the left and the working view on the right. When the application starts the two viewparts are splitting the screen in two parts. Now I'm searching for a way to set the width of the menu so that it not use the full half part of the screen.
I have already done some tests with ISizeProvider but without any luck. What is the easiest way to set a default width on a viewpart?
I can't find anything in the Eclipse source that actually uses the ISizeProvider so it looks like it may have been dropped for Eclipse 4.
If you want to set the relative sizes of views you put then in a Perspective and use the perspective layout factory to set the proportions of the window use by each view.
I started all over again with the mailexample in Eclipse. Now I hava it and without any need to code something.

live Java GUI Builder like FireBug extension for HTML and CSS

I have been a Web Developer for more than 5 years and is now diving into Java as well. I have used NetBeans and its Drag & Drop feature. But due to habbit I like to code everything manually not by NetBean's Drag and Drop.
Everything is perfect but when it comes to put different components on different locations on a JPanel, it becomes really pain to know what co-ordinates for x and y to put components at.
When it's website developing in HTML and CSS, we have many tools like FireFox's FireBug extension etc which help us in adjusting CSS live.
Is there anything for Java as well so we can adjust our component live and then when we know x and y, we can make actual code in Java.
For example, I create a button and put in a jframe, when I run it, I can adjust it's location and then change my actual code.
I don't know it's either possible or not. But as there are Gurus so asking if they would be knowing of some tool.
Don't try to manually set x / y / size of components. Use layout managers and call pack() on your JFrame to size and place your components. Due to differences in screen size and resolution it is very difficult to have your GUI look nice on all systems using manual sizing and placement. Have a try with layout managers and come back with a specific question if you can't get the specific visual look you want.

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