Example usage for java.lang System getProperties

List of usage examples for java.lang System getProperties

Introduction

In this page you can find the example usage for java.lang System getProperties.

Prototype

public static Properties getProperties() 

Source Link

Document

Determines the current system properties.

Usage

From source file:MailExample.java

public static void main(String args[]) throws Exception {
    if (args.length != 3) {
        System.err.println("Usage: java MailExample host from to");
        System.exit(-1);/*www. j av  a 2 s  . c o  m*/
    }

    String host = args[0];
    String from = args[1];
    String to = args[2];

    // Get system properties
    Properties props = System.getProperties();

    // Setup mail server
    props.put("mail.smtp.host", host);

    // Get session
    Session session = Session.getDefaultInstance(props, null);

    // Define message
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    message.setSubject("The Subject");
    message.setText("The Message");

    // Send message
    Transport.send(message);
}

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Properties props = System.getProperties();
    JTree tree = new JTree(props);

    JComboBox comboBox = new JComboBox(new String[] { "A", "B", "C" });
    TreeCellEditor editor = new DefaultCellEditor(comboBox);

    tree.setEditable(true);/* w  w  w.j a  v  a  2s  . c o  m*/
    tree.setCellEditor(editor);

    JScrollPane scrollPane = new JScrollPane(tree);
    frame.add(scrollPane, BorderLayout.CENTER);
    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:TreeArraySample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("JTreeSample");

    Vector oneVector = new NamedVector("One", args);
    Vector twoVector = new NamedVector("Two", new String[] { "Mercury", "Venus", "Mars" });
    Vector threeVector = new NamedVector("Three");
    threeVector.add(System.getProperties());
    threeVector.add(twoVector);/*  w w w  .ja  va2 s . c o m*/
    Object rootNodes[] = { oneVector, twoVector, threeVector };
    Vector rootVector = new NamedVector("Root", rootNodes);
    JTree tree = new JTree(rootVector);

    JScrollPane scrollPane = new JScrollPane(tree);
    frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    //    frame.getContentPane().add(tree, BorderLayout.CENTER);
    frame.setSize(300, 300);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] args) {
    Properties properties = System.getProperties();
    properties.list(System.out);
}

From source file:TreeTips.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Tree Tips");
    Properties props = System.getProperties();
    JTree tree = new JTree(props);
    ToolTipManager.sharedInstance().registerComponent(tree);
    TreeCellRenderer renderer = new ToolTipTreeCellRenderer(props);
    tree.setCellRenderer(renderer);/*from  www . j  a  v  a  2  s  .  co  m*/
    JScrollPane scrollPane = new JScrollPane(tree);
    frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("DynamicUtilTreeNode Hashtable");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");

    Hashtable<Object, Object> hashtable = new Hashtable<Object, Object>();
    hashtable.put("A", args);
    hashtable.put("B", new String[] { "a", "b", "c" });
    Hashtable<Object, Object> innerHashtable = new Hashtable<Object, Object>();
    Properties props = System.getProperties();
    innerHashtable.put(props, props);//w w w.ja  v  a  2  s .co  m
    hashtable.put("C", innerHashtable);

    JTree.DynamicUtilTreeNode.createChildren(root, hashtable);

    JTree tree = new JTree(root);

    JScrollPane scrollPane = new JScrollPane(tree);
    frame.add(scrollPane, BorderLayout.CENTER);
    frame.setSize(300, 150);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Custom Tip Demo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Properties props = System.getProperties();
    PropertiesList list = new PropertiesList(props);
    JScrollPane scrollPane = new JScrollPane(list);
    frame.getContentPane().add(scrollPane);
    frame.setSize(300, 300);/*ww w  . j a v a2s  .c om*/
    frame.setVisible(true);
}

From source file:TreeNodeVector.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("JTreeSample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Vector<String> v1 = new TreeNodeVector<String>("Two", new String[] { "Mercury", "Venus", "Mars" });
    Vector<Object> v2 = new TreeNodeVector<Object>("Three");
    v2.add(System.getProperties());
    v2.add(v1);/*from w w w.  j a  v  a  2  s  .com*/
    Object rootNodes[] = { v1, v2 };
    Vector<Object> rootVector = new TreeNodeVector<Object>("Root", rootNodes);
    JTree tree = new JTree(rootVector);
    frame.add(new JScrollPane(tree), BorderLayout.CENTER);
    frame.setSize(300, 300);
    frame.setVisible(true);
}

From source file:TreeNodeVector.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("JTreeSample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Vector<String> v1 = new TreeNodeVector<String>("Two", new String[] { "Mercury", "Venus", "Mars" });
    Vector<Object> v2 = new TreeNodeVector<Object>("Three");
    v2.add(System.getProperties());
    v2.add(v1);/*from   w  w  w  .j ava  2 s  .co  m*/
    Object rootNodes[] = { v1, v2 };
    Vector<Object> rootVector = new TreeNodeVector<Object>("Root", rootNodes);
    JTree tree = new JTree(rootVector);
    frame.add(new JScrollPane(tree), BorderLayout.CENTER);

    tree.expandRow(1);
    tree.scrollRowToVisible(2);

    tree.revalidate();

    frame.setSize(300, 300);
    frame.setVisible(true);

}

From source file:br.com.uol.runas.MainApplication.java

public static void main(String[] args) {
    System.getProperties().put("server.port", 8195);
    SpringApplication.run(MainApplication.class, args);
}