Commit 3ab238e8 authored by 9831111's avatar 9831111 🙂

Add initButtons method.

parent af97b325
...@@ -33,10 +33,39 @@ public class MainFrame extends JFrame { ...@@ -33,10 +33,39 @@ public class MainFrame extends JFrame {
items.setBackground(Color.WHITE); items.setBackground(Color.WHITE);
items.setLayout(new FlowLayout()); items.setLayout(new FlowLayout());
//initButtons(); initButtons();
add(items, BorderLayout.CENTER); add(items, BorderLayout.CENTER);
add(mainPhoto, BorderLayout.NORTH); add(mainPhoto, BorderLayout.NORTH);
setVisible(true); setVisible(true);
} }
public void initButtons() {
offlineModeIcon = new ImageIcon("pictures/offline.png");
offlineModeButton = new JButton(offlineModeIcon);
offlineModeButton.setToolTipText("Offline Game Mode.");
offlineModeButton.addMouseListener(new MouseAction());
offlineModeButton.addActionListener(new OfflineModeAction());
onlineModeIcon = new ImageIcon("pictures/online.png");
onlineModeButton = new JButton(onlineModeIcon);
onlineModeButton.setToolTipText("Online Game Mode.");
onlineModeButton.addActionListener(new OnlineModeAction());
onlineModeButton.addMouseListener(new MouseAction());
settingIcon = new ImageIcon("pictures/setting.png");
settingButton = new JButton(settingIcon);
settingButton.addActionListener(new SettingButtonAction());
settingButton.addMouseListener(new MouseAction());
settingButton.setToolTipText("Setting And User Details.");
exitIcon = new ImageIcon("pictures/exit.png");
exitButton = new JButton(exitIcon);
exitButton.setToolTipText("Exit Form Current User Account.");
exitButton.addActionListener(new ExitButtonAction());
exitButton.addMouseListener(new MouseAction());
items.add(offlineModeButton);
items.add(onlineModeButton);
items.add(settingButton);
items.add(exitButton);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment