Created
June 4, 2023 11:52
-
-
Save R3DHULK/5e8f0ec0afa52a32fbbca95af6836a47 to your computer and use it in GitHub Desktop.
Wifi Strength Analyzer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
public class WifiStrengthAnalyzer extends JFrame { | |
private JLabel signalStrengthLabel; | |
private JButton analyzeButton; | |
public WifiStrengthAnalyzer() { | |
setTitle("WiFi Strength Analyzer"); | |
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
setSize(300, 200); | |
setLayout(new FlowLayout()); | |
signalStrengthLabel = new JLabel("Signal Strength: N/A"); | |
add(signalStrengthLabel); | |
analyzeButton = new JButton("Analyze"); | |
analyzeButton.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
analyzeSignalStrength(); | |
} | |
}); | |
add(analyzeButton); | |
setVisible(true); | |
} | |
private void analyzeSignalStrength() { | |
// Simulate analyzing signal strength | |
int strength = (int) (Math.random() * 100); | |
signalStrengthLabel.setText("Signal Strength: " + strength + "%"); | |
} | |
public static void main(String[] args) { | |
SwingUtilities.invokeLater(new Runnable() { | |
public void run() { | |
new WifiStrengthAnalyzer(); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment