So I have run into a issue in my jLabel. setSize for some reason is changing the location. I have no idea what's going on. I want to make my image bigger:
public void tuesdayOperator() {
ErrorOperator errorOperator = new ErrorOperator();
tuesdayButton.addActionListener(e -> {
try {
setPage2ButtonsInvisible();
jButtonRemoveEvent();
//tuesdayBackground.setBounds(-500, -300, 1920, 1080);
tuesdayBackground.setSize(1920, 2080);
tuesdayBackground.setLocation(-500, -600);
jPanel.add(tuesdayBackground);
tuesdayBackground.setLayout(null);
jPanel.setBackground(Color.white);
System.out.println("Tuesday Exercise" + Message.success);
}catch (Exception exception) {
errorOperator.emergencyEvent();
}
});
}
I have tried using setPreferredSize
but it has not worked. in reference, here's is the code with setPreferredSize . here is the code:
public void tuesdayOperator() {
ErrorOperator errorOperator = new ErrorOperator();
tuesdayButton.addActionListener(e -> {
try {
setPage2ButtonsInvisible();
jButtonRemoveEvent();
tuesdayBackground.setPrefferredSize(new Dimension(1920, 1080));
jPanel.add(tuesdayBackground);
tuesdayBackground.setLayout(null);
jPanel.setBackground(Color.white);
System.out.println("Tuesday Exercise" + Message.success);
}catch (Exception exception) {
errorOperator.emergencyEvent();
}
});
}