Can't scale and move components in IntelliJ - java

I can't scale and move components in IntelliJ with its GridLayout. The problem is when I move/scale components they don't move to the exact place.
Picture (But I think you'd better check the vid out)
I uploaded a video on youtube
Here it is https://www.youtube.com/watch?time_continue=9&v=X6CF7TJ7GJg (sorry for a non-english speech)

You should learn how Java Swing Layouts work. Most layout managers do not allow you to place the components where you want (there is so called Null-layout, but it's not supported by IntelliJ IDEA).
You normally use splits, spacers and constraints to define where the components will appear and how they will resize when the form is resized.

Related

Java Layoutmanagers & WindowBuilder Pro

I'm having the problem that I don't like the way all layout managers position elements for the whole window.
I'm using the WindowBuilder Pro plugin for Eclipse to design the gui.
Either I support resizing of the window and use a layout manager (crappy positioning) or I choose the absolute one which allows me to place everything wherever I want but it's non-resizable and hard to maintain.
What's the trick in getting what you want using layout managers? How can I keep more control of the placements? Using panels and nested layout managers?

Graphical Layout Editor not DROPPING

The layout editor itself is working fine, but it doesn't want DROP where I want it to drop.
It's only dropped in the very top left corner, and gravity doesn't change anything. If I drag it elsewhere, it just doesn't work.
It's the same anywhere, whether it's a different xml or just a new xml.
Is this an eclipse problem or a Java problem?
Thanks, and Happy New Year!
Do you come from an XCode or Visual Studio background? If so, yes, the "graphical layout editor" for Android is weird, as it depends chiefly on relative positioning of elements, unless you user AbsoluteLayout controls, which give you pixel-by-pixel positioning power.
This looks to be a good overview of the different kinds of layouts available in Android... the thing you have to remember about Eclipse and its ilk is that they assume you want to use certain layouts (Linear appears to be the default), to make it easier for you to create layouts that scale appropriately to size, irregardless of pixel density or resolution.
http://www.sitepoint.com/know-your-layouts-in-android/
Good luck!

set layout to resize the control in java designed using netbeans

I am designing the swing JFrame form using NetBeans . I am not sure about the layout setting in JFrame form .When we change the resolution of the windows the forms are not adjusted automatically
but i want the forms and control designed on forms should be re
sized automatically. How is it possible
You can change the LayoutManager in by right clicking your panel. Look at this Layout Manager guide to find which suits best for your program.
Or: For the default NetBeans Layout Manager, you need to "anchor" the components for auto-resizing. And setting them resizable, too (but it is the default).
For any component that you want to add layout below images will guide you:
You need to choose layout that fit to your requirements.
Also you can customize the layout, to do that:
Also you can do it manualy or you can change the properties from Customize code.
To do that like the above image right click on the component and go to customie code(Cannot do it for JFrame).

What type of Java / Swing Layout can do Docking and or Anchoring?

I'm new to Java coming from .Net . Java seems to have lots of Layout Managers to choose from. Which one can anchor like in .Net and which one can dock like in .Net?
Thanks!
I have not used .Net, but if I understand you correctly, the Docking layout manager is provided by the BorderLayout.
A BorderLayout has 4 borders (North, South, East, West) and a Center panel. A JToolBar that has been set to Floatable, can float, or can be docked to one of the 4 borders of the border layout.
From what I have just read about the anchor layout, and how it resizes as the screen resizes (i.e. the percentage of space allocated to the component), then the Swing equivalent is the GridBagLayout. It is extremely configurable and capable, but many people find it difficult to get to grips with.
JToolBar is one such component, as shown in How to Use Tool Bars.
You can find all the layout manager well described here A Visual Guide to Layout Managers and chose the one the better fits your needs (I don't know how anchor/dock work in .Net). I find pretty useful GroupLayout together with components preferred size and SpringLayout if you need to design a complex layout (but SpringLayout is usually verbose and a bit annoying to maintain).
The most similar environment to winforms in Java is the GroupLayout(aka Matisse). It works much like the winforms designer in visual studio. It is not meant to be hand coded, but is built to be used by tools. The most popular IDE that uses the GroupLayout is Netbeans, but other implementations exist for Eclipse and possibly IntelliJ.
FreeLayout, used by the Matisse GUI builder in the NetBeans IDE: that's what you're looking for.
(You don't want to code FreeLayout by hand: that is a layout meant for code-generating WYSIWYG visual designers like Matisse.)

Java UI designer + framework similar to visual studio (drag and drop, floating controls)

I'm looking for a Java UI designer allowing me to drag and drop controls directly to the design surface in a floating mode (without the hassle of north, south etc that comes with SWT). Is there any such tool?
Also, I'm only interested in tools offering a trial version.
EDIT: I'm only interested in solutions allowing me to drag/drop items regardless of panels margin, LayoutManager stuff etc. The position should preferably be just relative to the window margin.
Thanks in advance
You can use NetBeans to design your GUI. Instead of messing with Layout Managers, just use the "Absolute" layout. It will put the UI Components exactly where you drop them, pixel for pixel.
Eclipse has a free visual editor called VEP. See http://www.eclipse.org/vep/
Instantiations has a very nice set of tools with a trial version:
http://instantiations.com
Note that for any visual designer, you should know how layout managers work to use them properly (and make sure your UI expands/contracts/adapts to font/locale properly). If you just use absolute placement, things can get cropped, for example.
See http://developer.java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/ for my article on layout management to get a feel for how to use things like North, South. It only covers the original five Java layout managers, but describes why you need them and how you can nest them.
I recommend JFormDesigner, which has support for "Free Design". From
http://www.jformdesigner.com/doc/help/layouts/grouplayout.html:
The goal of the group layout manager
is to make it easy to create
professional cross platform layouts.
It is designed for GUI builders, such
as JFormDesigner, to use the "Free
Design" paradigm. You can lay out your
forms by simply placing components
where you want them. Visual guidelines
suggest optimal spacing, alignment and
resizing of components.
It has a trial version and is very easy to use.
Netbeans has a drag and drop module called Matisse: http://www.netbeans.org/kb/articles/matisse.html

Categories

Resources