I'm currently making an application in JavaSwing as a project for my class in an Uni. Would you mind helping me with the given problem? I can't find the needed solution and
frameUI.setIconImage(frame.getIcon());
is not really what I need..
In the frame class (only related to icon):
private Image icon;
private String iconPath = ICON_PATH;
// Constructor
public Frame() {
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
initIcon(kit);
}
// Set frame icon
private void initIcon(@NotNull Toolkit kit) {
icon = kit.getImage(iconPath);
}
public Image getIcon() {
return icon;
}
public void setIcon(Image icon) {
this.icon = icon;
}
public String getIconPath() {
return iconPath;
}
public void setIconPath(String iconPath) {
this.iconPath = iconPath;
}
In the FrameAction class:
public FrameAction() {
frame = new Frame();
frameUI = new FrameUI();
initView();
}
private void initView() {
// Setting the initial frame icon
frameUI.setIconImage(frame.getIcon());
}
FrameUI extends JFrame