Привет, я не такой профессионал в программировании, поэтому я пришел сюда, чтобы спросить, как я могу сделать это возможным.
Проблема: клиентская игра запускается после нажатия кнопки в полноэкранном режиме. Я хочу, чтобы она вызывала setUndecorated (), но не могу, пока кадр уже виден.
Я понял, что мне нужно создать новый фрейм, но я не уверен, как перенести все, я попробовал себя, и все, что я получил, это чистый белый экран нового фрейма.
Вот мой код:
public Jframe(String args[]) {
super();
try {
sign.signlink.startpriv(InetAddress.getByName(server));
initUI();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void initUI() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBackground(Color.BLACK);
gamePanel = new JPanel();
gamePanel.setLayout(new BorderLayout());
gamePanel.add(this);
JMenu fileMenu = new JMenu("Menu");
String[] mainButtons = new String[] { "-", "Donate", "-", "Vote", "-", "Hiscores", "-", "Forums", "-", "Exit"};
for (String name : mainButtons) {
JMenuItem menuItem = new JMenuItem(name);
if (name.equalsIgnoreCase("-")) {
fileMenu.addSeparator();
} else {
menuItem.addActionListener(this);
fileMenu.add(menuItem);
}
}
JMenuBar menuBar = new JMenuBar();
JMenuBar jmenubar = new JMenuBar();
Jframe.frame.setMinimumSize(new Dimension(773, 556));
frame.add(jmenubar);
menuBar.add(fileMenu);
frame.getContentPane().add(menuBar, BorderLayout.NORTH);
frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
frame.setResizable(true);
init();
} catch (Exception e) {
e.printStackTrace();
}
Я надеюсь, что любой из вас может помочь, я действительно ценю спасибо!