Resize/Move Problems in Designer [message #1781074] |
Thu, 01 February 2018 08:20 |
Nicole Spicer Messages: 6 Registered: February 2018 |
Junior Member |
|
|
Using WindowBuilder to try and make a simple Swing window with a button on it, I'm unable to move to resize said button in the designer.
The resize dots appear in the designer, and I can drag them which shows coordinates like it normally would, but when I release the mouse button, the buttons size remains unmodified.
Same thing happens when attempting to just move the button instead. I can place a new button anywhere I want in the designer, but I can't move it once I've placed it, though the UI otherwise responds appropriately.
I'm only attempting to use a button for a example. This seems to happen with all UI elements I've tried so far.
I'm using the Absolute layout. Code, gif showing example, and versions below;
Halp
package ero.test;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JToolBar;
import javax.swing.JToggleButton;
public class Main {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Main window = new Main();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Main() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JToggleButton tglbtnNewToggleButton = new JToggleButton("New toggle button");
tglbtnNewToggleButton.setBounds(140, 63, 167, 25);
frame.getContentPane().add(tglbtnNewToggleButton);
}
}
-
Attachment: Test.gif
(Size: 87.22KB, Downloaded 17972 times) -
Attachment: S2lcC4X.png
(Size: 92.30KB, Downloaded 17469 times)
|
|
|
|
Re: Resize/Move Problems in Designer [message #1781485 is a reply to message #1781402] |
Wed, 07 February 2018 18:46 |
Nicole Spicer Messages: 6 Registered: February 2018 |
Junior Member |
|
|
Avi Abrami wrote on Tue, 06 February 2018 19:08I'm only guessing, but it may be related to the layout. Have you tried using a different layout, i.e. not absolute layout? Another guess, it may be related to component orientation. Are you using right-to-left orientation, perhaps?
What happens if you change the bounds values in the property sheet?
Same thing happens with the other layouts I've tried so far. I can put objects down, but not move them.
As for the orientation, where is that? I'm not seeing it anywhere on the UI, unless I'm blind. So whatever the default is?
Changing the values manually seems to work, so I'll probably continue doing that if I can't find a way to use the mouse right.
|
|
|
|
Re: Resize/Move Problems in Designer [message #1781510 is a reply to message #1781492] |
Thu, 08 February 2018 03:08 |
Nicole Spicer Messages: 6 Registered: February 2018 |
Junior Member |
|
|
Avi Abrami wrote on Wed, 07 February 2018 20:17Quote:As for the orientation, where is that?
Press the Show Advanced Properties button.
Ah, okay. Thanks for your patience.
It was set to 'UNKNOWN' by default. I've attempted to change it to LEFT_TO_RIGHT, and RIGHT_TO_LEFT to no effect on the designer.
Below is the source again, in case anything changed, and a picture of the properties menu of the button. All values are set to default, besides coords/size and orientation, which I left at LEFT_TO_RIGHT.
Stuff
package ero.test;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JToolBar;
import java.awt.BorderLayout;
import javax.swing.JButton;
import java.awt.GridLayout;
import javax.swing.BoxLayout;
import java.awt.ComponentOrientation;
public class Main {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Main window = new Main();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Main() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JButton btnNewButton = new JButton("New button");
btnNewButton.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
btnNewButton.setBounds(100, 100, 200, 25);
frame.getContentPane().add(btnNewButton);
}
}
-
Attachment: btnprop.png
(Size: 98.95KB, Downloaded 17177 times)
|
|
|
Powered by
FUDForum. Page generated in 0.03287 seconds