Example usage for java.lang String equals

List of usage examples for java.lang String equals

Introduction

In this page you can find the example usage for java.lang String equals.

Prototype

public boolean equals(Object anObject) 

Source Link

Document

Compares this string to the specified object.

Usage

From source file:DurableChat.java

/** Main program entry point. */
public static void main(String argv[]) {
    // Is there anything to do?
    if (argv.length == 0) {
        printUsage();// w  w w . j  ava2 s.c om
        System.exit(1);
    }

    // Values to be read from parameters
    String broker = DEFAULT_BROKER_NAME;
    String username = null;
    String password = DEFAULT_PASSWORD;

    // Check parameters
    for (int i = 0; i < argv.length; i++) {
        String arg = argv[i];

        if (arg.equals("-b")) {
            if (i == argv.length - 1 || argv[i + 1].startsWith("-")) {
                System.err.println("error: missing broker name:port");
                System.exit(1);
            }
            broker = argv[++i];
            continue;
        }

        if (arg.equals("-u")) {
            if (i == argv.length - 1 || argv[i + 1].startsWith("-")) {
                System.err.println("error: missing user name");
                System.exit(1);
            }
            username = argv[++i];
            continue;
        }

        if (arg.equals("-p")) {
            if (i == argv.length - 1 || argv[i + 1].startsWith("-")) {
                System.err.println("error: missing password");
                System.exit(1);
            }
            password = argv[++i];
            continue;
        }

        if (arg.equals("-h")) {
            printUsage();
            System.exit(1);
        }

        // Invalid argument
        System.err.println("error: unexpected argument: " + arg);
        printUsage();
        System.exit(1);
    }

    // Check values read in.
    if (username == null) {
        System.err.println("error: user name must be supplied");
        printUsage();
    }

    // Start the JMS client for the "chat".
    DurableChat durableChat = new DurableChat();
    durableChat.DurableChatter(broker, username, password);

}

From source file:org.hyperic.hq.hqapi1.tools.PasswordEncryptor.java

public static void main(String[] args) throws Exception {
    String password1 = String.valueOf(PasswordField.getPassword(System.in, "Enter password: "));
    String password2 = String.valueOf(PasswordField.getPassword(System.in, "Re-Enter password: "));
    String encryptionKey = "defaultkey";
    if (password1.equals(password2)) {
        System.out.print("Encryption Key: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        encryptionKey = in.readLine();/*  w w  w .  j a  v a  2 s . c  o m*/
        if (encryptionKey.length() < 8) {
            System.out.println("Encryption key too short. Please use at least 8 characters");
            System.exit(-1);
        }
    } else {
        System.out.println("Passwords don't match");
        System.exit(-1);
    }

    System.out.println("The encrypted password is " + encryptPassword(password1, encryptionKey));
}

From source file:it.serasoft.pdi.PDITools.java

public static void main(String[] args) throws Exception {

    Options opts = new Options();

    opts.addOption("report", false, "Generate a report documenting the procedures under analysis");

    opts.addOption("follow", true, "Values: directory, links, none");
    opts.addOption("outDir", true, "Path to output directory where we will write eventual output files");
    opts.addOption("srcDir", true, "Path to base directory containing the PDI processes source");

    CommandLineParser parser = new DefaultParser();
    CommandLine cmdLine = parser.parse(opts, args);

    String outDir = cmdLine.hasOption("outDir") ? cmdLine.getOptionValue("outDir") : null;
    String srcDir = cmdLine.hasOption("srcDir") ? cmdLine.getOptionValue("srcDir") : null;
    String follow = cmdLine.hasOption("follow") ? cmdLine.getOptionValue("follow") : FOLLOW_DIR;
    // Follow links between procedures only if required and recurseSubdir = false (DEFAULT)
    boolean recurseDir = follow.equals(FOLLOW_DIR);
    boolean followLinks = follow.equals(FOLLOW_PROCLINKS);

    startReadingDir(srcDir, recurseDir, followLinks);
}

From source file:se.berazy.api.examples.App.java

/**
 * Operation examples.// ww w  .j a  va2  s .  c o  m
 * @param args
 */
public static void main(String[] args) {
    Scanner scanner = null;
    try {
        client = new BookkeepingClient();
        System.out.println("Choose operation to invoke:\n");
        System.out.println("1. Create invoice");
        System.out.println("2. Credit invoice");
        scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            line = (line != null) ? line.trim().toLowerCase() : "";
            if (line.equals("1")) {
                outPutResponse(createInvoice());
            } else if (line.equals("2")) {
                outPutResponse(creditInvoice());
            } else if (line.equals("q") || line.equals("quit") || line.equals("exit")) {
                System.exit(0);
            } else {
                System.out.println("\nPlease choose an operation from 1-7.");
            }
        }
        scanner.close();
    } catch (Exception ex) {
        System.out.println(String.format(
                "\nAn exception occured, press CTRL+C to exit or enter 'q', 'quit' or 'exit'.\n\nException: %s %s",
                ex.getMessage(), ex.getStackTrace()));
    } finally {
        if (scanner != null) {
            scanner.close();
        }
    }
}

From source file:com.cloud.test.utils.SubmitCert.java

public static void main(String[] args) {
    // Parameters
    List<String> argsList = Arrays.asList(args);
    Iterator<String> iter = argsList.iterator();
    while (iter.hasNext()) {
        String arg = iter.next();

        if (arg.equals("-c")) {
            certFileName = iter.next();//from   w  ww .j ava 2s.  co  m
        }

        if (arg.equals("-s")) {
            secretKey = iter.next();
        }

        if (arg.equals("-a")) {
            apiKey = iter.next();
        }

        if (arg.equals("-action")) {
            url = "Action=" + iter.next();
        }
    }

    Properties prop = new Properties();
    try {
        prop.load(new FileInputStream("conf/tool.properties"));
    } catch (IOException ex) {
        s_logger.error("Error reading from conf/tool.properties", ex);
        System.exit(2);
    }

    host = prop.getProperty("host");
    port = prop.getProperty("port");

    if (url.equals("Action=SetCertificate") && certFileName == null) {
        s_logger.error("Please set path to certificate (including file name) with -c option");
        System.exit(1);
    }

    if (secretKey == null) {
        s_logger.error("Please set secretkey  with -s option");
        System.exit(1);
    }

    if (apiKey == null) {
        s_logger.error("Please set apikey with -a option");
        System.exit(1);
    }

    if (host == null) {
        s_logger.error("Please set host in tool.properties file");
        System.exit(1);
    }

    if (port == null) {
        s_logger.error("Please set port in tool.properties file");
        System.exit(1);
    }

    TreeMap<String, String> param = new TreeMap<String, String>();

    String req = "GET\n" + host + ":" + prop.getProperty("port") + "\n/" + prop.getProperty("accesspoint")
            + "\n";
    String temp = "";

    if (certFileName != null) {
        cert = readCert(certFileName);
        param.put("cert", cert);
    }

    param.put("AWSAccessKeyId", apiKey);
    param.put("Expires", prop.getProperty("expires"));
    param.put("SignatureMethod", prop.getProperty("signaturemethod"));
    param.put("SignatureVersion", "2");
    param.put("Version", prop.getProperty("version"));

    StringTokenizer str1 = new StringTokenizer(url, "&");
    while (str1.hasMoreTokens()) {
        String newEl = str1.nextToken();
        StringTokenizer str2 = new StringTokenizer(newEl, "=");
        String name = str2.nextToken();
        String value = str2.nextToken();
        param.put(name, value);
    }

    //sort url hash map by key
    Set c = param.entrySet();
    Iterator it = c.iterator();
    while (it.hasNext()) {
        Map.Entry me = (Map.Entry) it.next();
        String key = (String) me.getKey();
        String value = (String) me.getValue();
        try {
            temp = temp + key + "=" + URLEncoder.encode(value, "UTF-8") + "&";
        } catch (Exception ex) {
            s_logger.error("Unable to set parameter " + value + " for the command " + param.get("command"), ex);
        }

    }
    temp = temp.substring(0, temp.length() - 1);
    String requestToSign = req + temp;
    String signature = UtilsForTest.signRequest(requestToSign, secretKey);
    String encodedSignature = "";
    try {
        encodedSignature = URLEncoder.encode(signature, "UTF-8");
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    String url = "http://" + host + ":" + prop.getProperty("port") + "/" + prop.getProperty("accesspoint") + "?"
            + temp + "&Signature=" + encodedSignature;
    s_logger.info("Sending request with url:  " + url + "\n");
    sendRequest(url);
}

From source file:luisjosediez.Ejercicio2.java

/**
 * @param args the command line arguments
 *//*from w  ww .j  av  a 2s  .  co m*/
public static void main(String[] args) {
    // TODO code application logic here
    System.out.println("Introduce la direccin de un servidor ftp: ");
    FTPClient cliente = new FTPClient();
    String servFTP = cadena();
    String clave = "";
    System.out.println("Introduce usuario (vaco para conexin annima): ");
    String usuario = cadena();
    String opcion;
    if (usuario.equals("")) {
        clave = "";
    } else {
        System.out.println("Introduce contrasea: ");
        clave = cadena();
    }
    try {
        cliente.setPassiveNatWorkaround(false);
        cliente.connect(servFTP, 21);
        boolean login = cliente.login(usuario, clave);
        if (login) {
            System.out.println("Conexin ok");
        } else {
            System.out.println("Login incorrecto");
            cliente.disconnect();
            System.exit(1);
        }
        do {

            System.out.println("Orden [exit para salir]: ");
            opcion = cadena();
            if (opcion.equals("ls")) {
                FTPFile[] files = cliente.listFiles();
                String tipos[] = { "Fichero", "Directorio", "Enlace" };
                for (int i = 0; i < files.length; i++) {
                    System.out.println("\t" + files[i].getName() + "\t=> " + tipos[files[i].getType()]);
                }
            } else if (opcion.startsWith("cd ")) {
                try {
                    cliente.changeWorkingDirectory(opcion.substring(3));
                } catch (IOException e) {
                }
            } else if (opcion.equals("help")) {
                System.out.println(
                        "Puede ejecutar los comandos 'exit', 'ls', 'cd', 'get' y 'upload'. Para ms detalles utilice 'help <comando>'.");
            } else if (opcion.startsWith("help ")) {
                if (opcion.endsWith(" get")) {
                    System.out.println(
                            "Permite descargar un archivo concreto. Uso: 'get <rutaArchivoADescargar>'.");
                } else if (opcion.endsWith(" ls")) {
                    System.out.println("Lista los ficheros y directorios en la ubicacin actual. Uso: 'ls'.");
                } else if (opcion.endsWith(" cd")) {
                    System.out.println("Permite cambiar la ubicacin actual. Uso: 'cd <rutaDestino>'.");
                } else if (opcion.endsWith(" put")) {
                    System.out.println(
                            "Permite subir un archivo al directorio actual. Uso: 'put <rutaArchivoASubir>'.");
                }
            } else if (opcion.startsWith("get ")) {
                try {
                    System.out.println("Indique la carpeta de descarga: ");
                    try (FileOutputStream fos = new FileOutputStream(cadena() + opcion.substring(4))) {
                        cliente.retrieveFile(opcion.substring(4), fos);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } catch (Exception e) {
                }
            } else if (opcion.startsWith("put ")) {
                try {
                    try {

                        System.out.println(opcion.substring(4));

                        File local = new File(opcion.substring(4));

                        System.out.println(local.getName());

                        InputStream is = new FileInputStream(opcion.substring(4));

                        OutputStream os = cliente.storeFileStream(local.getName());

                        byte[] bytesIn = new byte[4096];

                        int read = 0;

                        while ((read = is.read(bytesIn)) != -1) {

                            os.write(bytesIn, 0, read);

                        }

                        is.close();
                        os.close();

                        boolean completed = cliente.completePendingCommand();

                        if (completed) {
                            System.out.println("The file is uploaded successfully.");
                        }

                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } catch (Exception e) {
                }
            }

        } while (!(opcion.equals("exit")));

        boolean logout = cliente.logout();
        if (logout)
            System.out.println("Logout...");
        else
            System.out.println("Logout incorrecto");

        cliente.disconnect();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:edu.uiowa.javatm.JavaTM.java

/**
 * @param args First one indicates which topic model to use
 *///from w  ww.  j  a v  a  2  s . com
public static void main(String[] args) {
    TMGibbsSampler tmGibbsSampler = null;

    Option modelType = Option.builder("model").longOpt("model-type").desc("Type of topic models to use")
            .hasArg().required().build();

    Option dataName = Option.builder("name").longOpt("data-name").desc("Data name: used for saving outputs")
            .hasArg().required().build();

    Option alpha = Option.builder("a").longOpt("alpha")
            .desc("Dirichlet prior for document (author) over topic multinomial").hasArg().required().build();

    Option beta = Option.builder("b").longOpt("beta").desc("Dirichlet prior for topic over word multinomial")
            .hasArg().required().build();

    Option pi = Option.builder("p").longOpt("pi").desc("Dirichlet prior for topic over time multinomial")
            .hasArg().build();

    Option K = Option.builder("K").longOpt("K").desc("The number of timestamp indices").hasArg().build();

    /*Option tau = Option.builder("tau").longOpt("tau")
    .desc("Smoothing constant for topic time")
    .hasArg().build();*/

    Option doc = Option.builder("doc").longOpt("document-file").desc("WD matrix to use").hasArg().required()
            .build();

    Option voc = Option.builder("voc").longOpt("vocabulary-file")
            .desc("Vocabulary file of the corpus of interest").hasArg().required().build();

    Option auth = Option.builder("auth").longOpt("auth-file").desc("Author indices for each token").hasArg()
            .build();

    Option authArray = Option.builder("authArray").longOpt("author-list-file").desc("Author list").hasArg()
            .build();

    Option dkArray = Option.builder("dk").longOpt("document-time-file").desc("Document timestamp file").hasArg()
            .build();

    Option citationMat = Option.builder("cm").longOpt("citation-matrix")
            .desc("Citation overtime for the corpus").hasArg().build();

    Option numTopics = Option.builder("topic").longOpt("num-topics").desc("The total number of topics").hasArg()
            .required().build();

    Option numIters = Option.builder("iter").longOpt("num-iters").desc("The total number of iterations")
            .hasArg().required().build();

    Option outputDir = Option.builder("odir").longOpt("output-dir").desc("Output directory").hasArg().required()
            .build();

    Options options = new Options();
    options.addOption(modelType).addOption(alpha).addOption(beta).addOption(numTopics).addOption(K)
            .addOption(pi).addOption(citationMat).addOption(numIters).addOption(doc).addOption(voc)
            .addOption(dkArray).addOption(outputDir).addOption(auth).addOption(authArray).addOption(dataName);

    CommandLineParser parser = new DefaultParser();
    try {
        // parse the command line arguments
        CommandLine line = parser.parse(options, args);
        String model = line.getOptionValue("model");
        String name = line.getOptionValue("name");
        String docFile = line.getOptionValue("doc");
        String vocFile = line.getOptionValue("voc");
        int topics = Integer.parseInt(line.getOptionValue("topic"));
        int iters = Integer.parseInt(line.getOptionValue("iter"));
        double a = Double.parseDouble(line.getOptionValue("a"));
        double b = Double.parseDouble(line.getOptionValue("b"));

        String modelLower = model.toLowerCase();
        if (modelLower.equals("lda")) {
            tmGibbsSampler = new LDAGibbsSampler(topics, iters, a, b, docFile, vocFile);
        } else if (modelLower.equals("at")) {
            String authFile = line.getOptionValue("auth");
            String authArrayFile = line.getOptionValue("authArray");
            //double tau_val = Double.parseDouble(line.getOptionValue("tau"));
            tmGibbsSampler = new ATGibbsSampler(topics, iters, a, b, docFile, vocFile, authFile, authArrayFile);
        } else if (modelLower.equals("tot")) {
            String dkFile = line.getOptionValue("dk");
            //double tau_val = Double.parseDouble(line.getOptionValue("tau"));
            tmGibbsSampler = new ToTGibbsSampler(topics, iters, a, b, docFile, vocFile, dkFile);
        } else if (modelLower.equals("tiot")) {
            String timeFile = line.getOptionValue("dk");
            String citationFile = line.getOptionValue("cm");
            double p = Double.parseDouble(line.getOptionValue("p"));
            //int k = Integer.parseInt(line.getOptionValue("K"));
            tmGibbsSampler = new TIOTGibbsSampler(topics, iters, a, b, p, docFile, vocFile, timeFile,
                    citationFile);
        } else {
            System.err.println("Invalid model type selection. Must be lda, at, tot or atot.");
            System.exit(ExitStatus.ILLEGAL_ARGUMENT);
        }

        long startTime = System.nanoTime();
        tmGibbsSampler.fit();
        TMOutcome outcome = tmGibbsSampler.get_outcome();
        long endTime = System.nanoTime();
        long duration = (endTime - startTime);
        System.out.println("Overall elapsed time: " + duration / 1000000000. + " seconds");

        tmGibbsSampler.showTopics(10);
        outcome.showTopicDistribution();

        String oDir = line.getOptionValue("odir");
        if (!oDir.endsWith("/")) {
            oDir = oDir + "/";
        }
        // append name to `oDir`
        oDir = oDir + name + "-";

        if (modelLower.contains("tot")) {
            // topic over time (tot and atot) has beta distribution parameters to write
            Utils.write2DArray(((ToTOutcome) outcome).getPsi(), oDir + "psi-" + modelLower + ".csv");
        }

        if (modelLower.contains("tiot")) {
            // topic over time (tot and atot) has beta distribution parameters to write
            Utils.write2DArray(((TIOTOutcome) outcome).getPsi(), oDir + "psi-" + modelLower + ".csv");
            double[][][] ga = ((TIOTOutcome) outcome).getGa();
            for (int t = 0; t < ga.length; t++) {
                Utils.write2DArray(ga[t], oDir + "gamma-" + t + "-" + modelLower + ".csv");
            }
        }

        Utils.write2DArray(outcome.getPhi(), oDir + "phi-" + modelLower + ".csv");
        Utils.write2DArray(outcome.getTheta(), oDir + "theta-" + modelLower + ".csv");

        System.out.println("Output files saved to " + oDir);
    } catch (ParseException exp) {
        // oops, something went wrong
        System.err.println("Parsing failed. Reason: " + exp.getMessage());
    }

}

From source file:utilities.HashPassword.java

public static void main(String[] args) throws IOException {
    Md5PasswordEncoder encoder;//from w  ww  .jav  a  2  s .c om
    ConsoleReader reader;
    String line, hash;

    try {
        System.out.printf("HashPassword 1.3%n");
        System.out.printf("----------------%n%n");

        encoder = new Md5PasswordEncoder();
        reader = new ConsoleReader();

        line = reader.readLine();
        while (!line.equals("quit")) {
            hash = encoder.encodePassword(line, null);
            System.out.println(hash);
            line = reader.readLine();
        }
    } catch (Throwable oops) {
        System.out.flush();
        System.err.printf("%n%s%n", oops.getLocalizedMessage());
        //oops.printStackTrace(System.out);         
    }
}

From source file:Text2ColumntStorageMR.java

@SuppressWarnings("deprecation")
public static void main(String[] args) throws Exception {

    if (args.length != 3) {
        System.out.println("Text2ColumnStorageMR <input> <output> <columnStorageMode>");
        System.exit(-1);/* w w  w  . j  a  v  a  2s. c o  m*/
    }

    JobConf conf = new JobConf(Text2ColumntStorageMR.class);

    conf.setJobName("Text2ColumnStorageMR");

    conf.setNumMapTasks(1);
    conf.setNumReduceTasks(4);

    conf.setOutputKeyClass(LongWritable.class);
    conf.setOutputValueClass(Unit.Record.class);

    conf.setMapperClass(TextFileMapper.class);
    conf.setReducerClass(ColumnStorageReducer.class);

    conf.setInputFormat(TextInputFormat.class);
    conf.setOutputFormat((Class<? extends OutputFormat>) ColumnStorageHiveOutputFormat.class);
    conf.set("mapred.output.compress", "flase");

    Head head = new Head();
    initHead(head);

    head.toJobConf(conf);

    int bt = Integer.valueOf(args[2]);

    FileInputFormat.setInputPaths(conf, args[0]);
    Path outputPath = new Path(args[1]);
    FileOutputFormat.setOutputPath(conf, outputPath);

    FileSystem fs = outputPath.getFileSystem(conf);
    fs.delete(outputPath, true);

    JobClient jc = new JobClient(conf);
    RunningJob rj = null;
    rj = jc.submitJob(conf);

    String lastReport = "";
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss,SSS");
    long reportTime = System.currentTimeMillis();
    long maxReportInterval = 3 * 1000;
    while (!rj.isComplete()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }

        int mapProgress = Math.round(rj.mapProgress() * 100);
        int reduceProgress = Math.round(rj.reduceProgress() * 100);

        String report = " map = " + mapProgress + "%,  reduce = " + reduceProgress + "%";

        if (!report.equals(lastReport) || System.currentTimeMillis() >= reportTime + maxReportInterval) {

            String output = dateFormat.format(Calendar.getInstance().getTime()) + report;
            System.out.println(output);
            lastReport = report;
            reportTime = System.currentTimeMillis();
        }
    }

    System.exit(0);

}

From source file:GroupActionRadio.java

public static void main(String args[]) {

    String title = (args.length == 0 ? "Grouping Example" : args[0]);
    JFrame frame = new JFrame(title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Slice Parts
    ActionListener sliceActionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton aButton = (AbstractButton) actionEvent.getSource();
            System.out.println("Selected: " + aButton.getText());
        }// w w w. j  a  v  a2s.co  m
    };
    Container sliceContainer = RadioButtonUtils.createRadioButtonGrouping(sliceOptions, "Slice Count",
            sliceActionListener);

    // Crust Parts
    ActionListener crustActionListener = new ActionListener() {
        String lastSelected;

        public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton aButton = (AbstractButton) actionEvent.getSource();
            String label = aButton.getText();
            String msgStart;
            if (label.equals(lastSelected)) {
                msgStart = "Reselected: ";
            } else {
                msgStart = "Selected: ";
            }
            lastSelected = label;
            System.out.println(msgStart + label);
        }
    };
    ItemListener itemListener = new ItemListener() {
        String lastSelected;

        public void itemStateChanged(ItemEvent itemEvent) {
            AbstractButton aButton = (AbstractButton) itemEvent.getSource();
            int state = itemEvent.getStateChange();
            String label = aButton.getText();
            String msgStart;
            if (state == ItemEvent.SELECTED) {
                if (label.equals(lastSelected)) {
                    msgStart = "Reselected -> ";
                } else {
                    msgStart = "Selected -> ";
                }
                lastSelected = label;
            } else {
                msgStart = "Deselected -> ";
            }
            System.out.println(msgStart + label);
        }
    };
    ChangeListener changeListener = new ChangeListener() {
        public void stateChanged(ChangeEvent changEvent) {
            AbstractButton aButton = (AbstractButton) changEvent.getSource();
            ButtonModel aModel = aButton.getModel();
            boolean armed = aModel.isArmed();
            boolean pressed = aModel.isPressed();
            boolean selected = aModel.isSelected();
            System.out.println("Changed: " + armed + "/" + pressed + "/" + selected);
        }
    };
    final Container crustContainer = RadioButtonUtils.createRadioButtonGrouping(crustOptions, "Crust Type",
            crustActionListener, itemListener, changeListener);

    // Button Parts
    ActionListener buttonActionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            Enumeration selected = RadioButtonUtils.getSelectedElements(crustContainer);
            while (selected.hasMoreElements()) {
                System.out.println("Selected -> " + selected.nextElement());
            }
        }
    };
    JButton button = new JButton("Order Pizza");
    button.addActionListener(buttonActionListener);

    Container contentPane = frame.getContentPane();
    contentPane.add(sliceContainer, BorderLayout.WEST);
    contentPane.add(crustContainer, BorderLayout.EAST);
    contentPane.add(button, BorderLayout.SOUTH);
    frame.setSize(300, 200);
    frame.setVisible(true);
}