private JLabel basicRule;
public TutorialFrame() {
setTitle("Tutorial");
setSize(800, 800);
setVisible(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
JLabel basicRule = new JLabel("OneCard Basic Rule");
basicRule.setBounds(0, 0, 800, 50);
add(basicRule);
}
I clearly set the position of JLabel
called basicRule
to (0,0) through basicRule.setBounds (0,0,800,50);
. But when it's implemented, it's in the center like a picture. Why isn't the location set?
So, what other methods should we use to set the location as we want? I would appreciate it if you could let me know if you know, how.
Left aligned label in center of height
CodePudding user response:
You should check how to use a Layout Manager
: Oracle guide for layout manager