import java.awt.*; import javax.swing.JFrame; import javax.swing.*; public class MultiMenuView { ImageIcon SoundIcon = new ImageIcon("Grafik/sound button.png"); private JFrame frame = new JFrame(); private JButton soundButton = new JButton(SoundIcon); Font robotoFont = new Font("Roboto", Font.BOLD, 45); public MultiMenuView() { buildFrame(); buildComponents(); } public void buildComponents(){ soundButton.setBounds(20,20,128,128); } public void buildFrame() { frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1500,1000); frame.setVisible(true); frame.getContentPane().setBackground( Color.decode("#98F5FF")); JLabel backgroundLabel = new JLabel(new ImageIcon("Grafik/mainmenubackground.png")); frame.setContentPane(backgroundLabel); frame.add(soundButton); frame.setLocationRelativeTo(null); } public void toggleMute(){ ImageIcon MuteIcon = new ImageIcon("Grafik/sound button muted.png"); if(soundButton.getIcon()==SoundIcon) { soundButton.setIcon(MuteIcon); }else{ soundButton.setIcon(SoundIcon); } } public void closeWindOw(){ frame.dispose(); } public JFrame getFrame() { return frame; } public JButton getSoundButton() { return soundButton; } }