206Wasza ocena

Cheat Enigne 6.2 Podczas przełączania między grą a Cheat Engine używamy ALT-TAB. package przyciskowy; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class ButtonPanel extends JPanel implements ActionListener { public static final int HEIGHT = 200; public static final int WIDTH = 400; private JButton kwadratbutton; private JButton kolkobutton; public ButtonPanel() { kwadratbutton = new JButton("Kwadrat"); kolkobutton = new JButton("Koło"); kwadratbutton.addActionListener(this); kolkobutton.addActionListener(this); setLayout(new GridLayout()); setPreferredSize(new Dimension(WIDTH, HEIGHT)); add(kwadratbutton); add(kolkobutton); } @Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if(source == kwadratbutton){ new MyFrameProstokad(); new Prostokad(); } else if(source == kolkobutton){ new MyFrameKolo(); new Kolo(); } } public class Kolo extends JPanel { public Kolo() { setPreferredSize(new Dimension(400, 400)); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; // Koło g2d.setColor(Color.blue); g2d.fillOval(0, 349, 50, 50); } } public class MyFrameKolo extends JFrame { public MyFrameKolo() { super("Rysowanie"); JPanel panel = new Kolo(); add(panel); pack(); setVisible(true); } } public class MyFrameProstokad extends JFrame { public MyFrameProstokad() { super("Rysowanie"); JPanel panel = new Prostokad(); add(panel); pack(); setVisible(true); } } public class Prostokad extends JPanel { public Prostokad() { setPreferredSize(new Dimension(400, 400)); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; // prostokat g2d.setColor(Color.red); g2d.fillRect(180, 180, 30, 30); } } }