1

I have the IntelliJ-Idea Ultimate Edition but I am sure it applies in the community edition as well. I cannot freely move any components (buttons, text fields) in the JPanel. They only move to fixed places and it annoys me. Is there a way to fix that?

The process I followed is:

  1. I created a new Java project.
  2. I created a new package.
  3. I right clicked on the new package and selected "Swing UI Designer" -> "GUI Form"
  4. By default a JPanel was created.

And then tried to edit it as I explained above.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 1
    *"They only move to fixed places and it annoys me. Is there a way to fix that?"* To fix that sense of annoyance, learn how to *work with* Java layout managers. Java GUIs have to work on different OS', screen size, screen resolution etc. using different PLAFs in different locales. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556). – Andrew Thompson Jun 07 '20 at 22:11
  • 1
    Oops! Forgot to add the link to [Laying Out Components Within a Container](https://docs.oracle.com/javase/tutorial/uiswing/layout/index.html). – Andrew Thompson Jun 07 '20 at 23:39
  • Already answered at https://stackoverflow.com/questions/6092727/intellij-idea-gui-forms-null-layout. – CrazyCoder Jul 17 '20 at 05:18

1 Answers1

-1

If you're asking how to manually drag and drop a component in the editor, you can do it by clicking the component name in the component tree and dragging it to a new position:

enter image description here

Code on the Rocks
  • 11,488
  • 3
  • 53
  • 61