1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| package r1bellu2b.norecoil;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
public class Fenetre extends JFrame {
public Fenetre(){
this.setTitle("NoRecoil By R1beLlu");
this.setSize(600, 300);
this.setLocationRelativeTo(null);
this.getContentPane().setBackground(Color.yellow); //FOND DE COULEUR
this.setVisible(true);
this.setAlwaysOnTop(true);
this.setResizable(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Action action = new Action();
this.getContentPane().add(action);
MouseListener.executorService.execute(() -> {
while (!MouseListener.executorService.isShutdown()) {
action.repaint();
try {
Thread.sleep(50);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public class Action extends JComponent {
Font myFont = new Font("Serif", Font.BOLD, 30);
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (g instanceof Graphics2D) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setFont(myFont);
g2.setColor(Color.MAGENTA);
g2.drawString("Active:", 50, 60);
g2.setColor(Main.enabled ? Color.GREEN : Color.RED);
g2.drawString(Main.enabled + "", 150, 60);
g2.setColor(Color.MAGENTA);
g2.drawString("X4:", 50, 120);
g2.setColor(Main.zoom ? Color.GREEN : Color.RED);
g2.drawString(Main.zoom + "", 150, 120);
g2.setColor(Color.MAGENTA);
g2.drawString("Config:", 50, 185);
g2.setColor(Color.BLUE);
g2.drawString(ConfigManager.getInstance().getCurrentConfig().name, 150, 185);
}
}
}
} |
Partager