All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pepsoft.worldpainter.tools.BiomesViewerMain Maven / Gradle / Ivy

There is a newer version: 2.23.2
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.pepsoft.worldpainter.tools;

import org.pepsoft.worldpainter.ColourScheme;
import org.pepsoft.worldpainter.Configuration;
import org.pepsoft.worldpainter.Constants;

import javax.swing.*;
import java.io.IOException;
import java.util.Random;

/**
 *
 * @author pepijn
 */
public class BiomesViewerMain {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
//        Logger rootLogger = Logger.getLogger("");
//        for (Handler handler: rootLogger.getHandlers()) {
//            handler.setLevel(Level.FINE);
//            handler.setFormatter(new Formatter() {
//                @Override
//                public String format(LogRecord record) {
//                    java.util.Formatter formatter = new java.util.Formatter();
//                    String loggerName = record.getLoggerName();
//                    if (loggerName.length() > 30) {
//                        loggerName = loggerName.substring(loggerName.length() - 30);
//                    }
//                    formatter.format("[%-6s] (%30s) [%d] %s%n", record.getLevel().getName(), loggerName, record.getThreadID(), record.getMessage());
//                    return formatter.toString();
//                }
//            });
//        }
//        Logger logger = Logger.getLogger("org.pepsoft");
//        logger.setLevel(Level.FINE);
        
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | UnsupportedLookAndFeelException | InstantiationException | IllegalAccessException e) {
            // Oh well
        }

        Configuration config = Configuration.load();
        if (config == null) {
            config = new Configuration();
        }
        Configuration.setInstance(config);
        
        BiomesViewerFrame frame = new BiomesViewerFrame(new Random().nextLong(), Constants.BIOME_ALGORITHM_1_7_DEFAULT, ColourScheme.DEFAULT, null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy