Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- import java.io.IOException;
- import java.net.URI;
- import java.net.URISyntaxException;
- public class Test1
- {
- public static void main(String... ar)
- {
- SwingUtilities.invokeLater(new Runnable() {
- public void run()
- {
- new A();
- }
- });
- }//Closing the main method
- }//Closing the class A
- class A implements ActionListener
- {
- JButton button;
- JLabel label1;
- JTextField field1;
- JFrame jf;
- A()
- {
- jf = new JFrame("Camera Reboot");
- jf.setSize(400,150);
- label1= new JLabel("Enter Camera Name (uppercase no dashes)");
- field1 = new JTextField(5);
- button = new JButton("Reboot");
- jf.setLayout(new FlowLayout());
- jf.add(label1);
- jf.add(field1);
- jf.add(button);
- button.addActionListener(this);
- jf.setVisible(true);
- }
- public void actionPerformed(ActionEvent ae)
- {
- String input = field1.getText();
- if(ae.getActionCommand().equals("Reboot"))
- if (input == "9") {
- try {
- Desktop desktop = java.awt.Desktop.getDesktop();
- URI oURL = new URI("http://www.google.com");
- desktop.browse(oURL);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- else { System.out.println("Check camera name");}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement