Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigadelux authored Oct 24, 2022
0 parents commit 2e5d818
Show file tree
Hide file tree
Showing 11 changed files with 149 additions and 0 deletions.
57 changes: 57 additions & 0 deletions KBManipulation/KBmanipulation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package KBManipulation;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class KBmanipulation extends KeyAdapter{
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode()== KeyEvent.VK_Q)
System.out.println("Key Q pressed!");
}

public static void switcChar(int button){
Toolkit toolkit = Toolkit.getDefaultToolkit();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
switch (button){
case KeyEvent.VK_EXCLAMATION_MARK:
toolkit.setLockingKeyState(KeyEvent.VK_BACK_SPACE, Boolean.TRUE);;
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
toolkit.setLockingKeyState(KeyEvent.VK_BACK_SPACE, false);
toolkit.setLockingKeyState(KeyEvent.VK_1,true);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
toolkit.setLockingKeyState(KeyEvent.VK_1,false);
break;
}

}/*
public void keyTyped(KeyEvent ke) {
return ke.getKeyCode();
}*/


public static void capsLockRandomize(boolean on) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
if (on)
toolkit.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, Boolean.TRUE);
else
toolkit.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, Boolean.FALSE);
}
}
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 87 additions & 0 deletions gui.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import static KBManipulation.KBmanipulation.capsLockRandomize;


public class gui implements ActionListener {
private boolean trigger;
private JLabel label;
private JFrame frame;
private JPanel panel;
private String strButton="Start flaming";
private SwingWorker worker;
JButton button=new JButton(strButton);
public gui(){
frame=new JFrame();
button.addActionListener(this);
label=new JLabel();
panel=new JPanel();

//panel.setBorder(BorderFactory.createEmptyBorder(50,50,20,50));
//panel.setLayout(new GridLayout(5,1));
try {
BufferedImage myPicture = ImageIO.read(new File("assets/main.png"));
JLabel picLabel = new JLabel(new ImageIcon(myPicture));
//picLabel.setMinimumSize(new Dimension(500,500));
panel.add(picLabel);
}
catch (IOException exception){}
Color c = new Color(133, 23, 1);
JPanel secondPanel = new JPanel();
secondPanel.setBackground(c);
secondPanel.add(button);
panel.setBackground(c);
frame= new JFrame();
//frame.setLayout(new BorderLayout(50,50));
//panel.setMinimumSize(new Dimension(500,500));

frame.add(panel,BorderLayout.CENTER);
frame.add(secondPanel,BorderLayout.PAGE_END);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("flame keyboard");
frame.pack();
frame.setVisible(true);

}
//231527
public void jButtonActionPerformed(java.awt.event.ActionEvent evt) {
trigger=!trigger;
strButton=trigger?"Start flaming":"stop flaming";
if (getWorker().getState().equals(SwingWorker.StateValue.STARTED)) {
worker.cancel(true);
worker = null;
} else {
getWorker().execute();
}
}
public static void main(String[] args){
new gui();
}
private SwingWorker getWorker() {
worker = worker == null ? worker = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
while (true) {
capsLockRandomize(Math.random()<0.5);
//if (Math.random()<0.5)
//switcChar(keyTyped());
Thread.sleep(100);
}
}
} : worker;
return worker;
}

@Override
public void actionPerformed(ActionEvent e) {
jButtonActionPerformed(e);
}
}
5 changes: 5 additions & 0 deletions main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class main {
public static void main(String[] args){
new gui();
}
}
Binary file not shown.
Binary file added out/production/HaterTrigger/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added out/production/HaterTrigger/assets/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added out/production/HaterTrigger/gui$1.class
Binary file not shown.
Binary file added out/production/HaterTrigger/gui.class
Binary file not shown.
Binary file added out/production/HaterTrigger/main.class
Binary file not shown.

0 comments on commit 2e5d818

Please sign in to comment.