Java Properties Load from File loadTestProperties(String filename)

Here you can find the source of loadTestProperties(String filename)

Description

load Test Properties

License

Open Source License

Declaration

private static Properties loadTestProperties(String filename) 

Method Source Code

//package com.java2s;

import java.io.FileInputStream;

import java.io.IOException;

import java.util.Properties;

public class Main {
    private static Properties loadTestProperties(String filename) {
        Properties p = new Properties();
        try {/*from w  w  w  . ja  va2  s  .  c o m*/
            p.load(new FileInputStream(filename));
        } catch (IOException e) {
            p.setProperty("Color.black", "#000000");
            p.setProperty("Color.white", "#FFFFFF");
            p.setProperty("Color.gray", "#808080");
            p.setProperty("Color.beanBackground", "#CCCCCC");
            p.setProperty("Color.buttonBackground", "#999933");
            p.setProperty("Color.buttonForeground", "#FFFFFF");
            p.setProperty("Color.dialogLabelBackground", "#00FFFF");
            p.setProperty("Color.dialogLabelForeground", "#000000");
            p.setProperty("Color.errorLabelBackground", "#FF0000");
            p.setProperty("Color.fieldBackground", "#FFFFFF");
            p.setProperty("Color.fieldForeground", "#000000");
            p.setProperty("Color.headerBackground", "#FFFFFF");
            p.setProperty("Color.headerLabelBackground", "#FFFFB4");
            p.setProperty("Color.headerLabelForeground", "#000000");
            p.setProperty("Color.labelForeground", "#000000");
            p.setProperty("Color.listBackground", "#FFFFFF");
            p.setProperty("Color.listForeground", "#000000");
            p.setProperty("Color.listSelection", "#808080");
            p.setProperty("Color.noLogoBackground", "#CCCCFF");
            p.setProperty("Color.requiredForeground", "#AF0000");
            p.setProperty("Color.responseBackground", "#C6C6FF");
            p.setProperty("Color.responseForeground", "#000080");
            p.setProperty("Color.statusOnlineHighlight", "#009B00");
            p.setProperty("Color.statusOfflineHighlight", "#FF0000");
            p.setProperty("Color.textHighlight", "#C2D2FF");
            p.setProperty("Color.textHighlightText", "#000000");

            p.setProperty("Dimension.selectionListDimension", "180,120");
            p.setProperty("Dimension.horizontalButtonDimension", "70,70");
            p.setProperty("Dimension.verticalButtonDimension", "150,25");

            p.setProperty("Font.dialogFont", "Helvetica,bold,14");
            p.setProperty("Font.displayTextFont", "Courier New,plain,12");
            p.setProperty("Font.requiredFont", "Helvetica,bold,20");
            p.setProperty("Font.responseFont", "Helvetica,bold,16");
            p.setProperty("Font.fieldFont", "Helvetica,plain,12");
            p.setProperty("Font.labelFont", "Helvetica,bold,12");
            p.setProperty("Font.buttonFont", "Helvetica,bold,12");
            p.setProperty("Insets.emptyInsets", "0,0,0,0");
            p.setProperty("Insets.dialogButtonInsets", "0,40,0,40");
            p.setProperty("Insets.dialogMessageMargin", "5,5,5,5");
            p.setProperty("Insets.defaultLabelTop", "15,15,5,15");
            p.setProperty("Insets.defaultLabelLeft", "0,15,5,15");
            p.setProperty("Insets.defaultLabelBottom", "0,15,15,15");
            p.setProperty("Insets.defaultFieldTop", "15,0,5,15");
            p.setProperty("Insets.defaultFieldRight", "0,0,5,15");
            p.setProperty("Insets.defaultFieldBottom", "0,0,15,15");
            p.setProperty("Weights.customerRendererWeights", "30,40,20");
            p.setProperty("Weights.employeeRendererWeights", "50,25,25");
            p.setProperty("Weights.financialTotalsRendererWeights", "60,20,20");
            p.setProperty("Weights.layawayItemRendererWeights", "30,28,14,14,14");
            p.setProperty("Weights.parameterRendererWeights", "40,50,10");
            p.setProperty("Weights.orderItemRendererWeights", "30,15,15,15,15,10");
            p.setProperty("Weights.reasonCodeRendererWeights", "65,35");
            p.setProperty("Weights.saleItemRendererWeights", "40,13,13,13,13,8");
            p.setProperty("Weights.suspendItemRendererWeights", "25,25,25,25");
            p.setProperty("Weights.transactionItemRendererWeights", "15,30,40,15");
            p.setProperty("Weights.tenderItemRendererWeights", "60,20,20");

            p.setProperty("ApplicationFrame.background", "beanBackground");
            p.setProperty("ApplicationFrame.opaque", "true");

            p.setProperty("List.border", "listBorder");
            p.setProperty("List.background", "listBackground");

            p.setProperty("List.header.background", "headerBackground");
            p.setProperty("List.header.opaque", "true");
            p.setProperty("List.header.label.border", "etchedBorder");
            p.setProperty("List.header.label.background", "headerLabelBackground");
            p.setProperty("List.header.label.foreground", "headerLabelForeground");
            p.setProperty("List.header.label.font", "labelFont");
            p.setProperty("List.header.label.opaque", "true");
            p.setProperty("List.header.label.alignment", "center");
            p.setProperty("List.renderer.focusBorder", "focusBorder");
            p.setProperty("List.renderer.noFocusBorder", "emptyBorder.1");
            p.setProperty("List.renderer.label.font", "fieldFont");
            p.setProperty("List.renderer.label.opaque", "false");

            p.setProperty("TextField.background", "fieldBackground");
            p.setProperty("TextField.foreground", "fieldForeground");
            p.setProperty("TextField.inactiveForeground", "fieldForeground");
            p.setProperty("TextField.font", "fieldFont");
            p.setProperty("TextField.opaque", "true");

            p.setProperty("Table.background", "white");
            p.setProperty("Table.opaque", "true");
            p.setProperty("Table.field.border", "fieldBorder");
            p.setProperty("Table.field.background", "fieldBackground");
            p.setProperty("Table.field.foreground", "fieldForeground");
            p.setProperty("Table.field.font", "fieldFont");
            p.setProperty("Table.field.alignment", "center");
            p.setProperty("Table.field.opaque", "true");
            p.setProperty("Table.label.border", "fieldBorder");
            p.setProperty("Table.label.background", "headerLabelBackground");
            p.setProperty("Table.label.foreground", "headerLabelForeground");
            p.setProperty("Table.label.font", "labelFont");
            p.setProperty("Table.label.opaque", "true");
            p.setProperty("Table.label.alignment", "center");

            p.setProperty("ScrollPane.background", "listBackground");
            p.setProperty("ScrollPane.border", "emptyBorder.0");
            p.setProperty("ScrollPane.opaque", "true");

            p.setProperty("Viewport.background", "listBackground");

            p.setProperty("DialogButton.background", "beanBackground");
            p.setProperty("DialogButton.foreground", "labelForeground");
            p.setProperty("DialogButton.border", "etchedBorder");
            p.setProperty("DialogButton.opaque", "true");

            p.setProperty("HorizontalButton.foreground", "buttonForeground");
            p.setProperty("HorizontalButton.background", "buttonBackground");
            p.setProperty("HorizontalButton.font", "buttonFont");
            p.setProperty("HorizontalButton.size", "horizontalButtonDimension");
            p.setProperty("HorizontalButton.opaque", "true");

            p.setProperty("VerticalButton.border", "roundedBorder");
            p.setProperty("VerticalButton.foreground", "buttonForeground");
            p.setProperty("VerticalButton.background", "buttonBackground");
            p.setProperty("VerticalButton.font", "buttonFont");
            p.setProperty("VerticalButton.size", "verticalButtonDimension");
            p.setProperty("VerticalButton.opaque", "true");

            p.setProperty("StatusScrollPane.border", "listBorder");
            p.setProperty("StatusScrollPane.opaque", "true");

            p.setProperty("ValidatingComboBox.border", "validatingBorder");
            p.setProperty("ValidatingComboBox.background", "fieldBackground");
            p.setProperty("ValidatingComboBox.foreground", "fieldForeground");
            p.setProperty("ValidatingComboBox.font", "fieldFont");
            p.setProperty("ValidatingComboBox.opaque", "true");

            p.setProperty("ValidatingField.border", "validatingBorder");
            p.setProperty("ValidatingField.background", "fieldBackground");
            p.setProperty("ValidatingField.foreground", "fieldForeground");
            p.setProperty("ValidatingField.font", "fieldFont");
            p.setProperty("ValidatingField.opaque", "true");

            p.setProperty("ButtonBar.border", "emptyBorder.1");
            p.setProperty("ButtonBar.foreground", "buttonForeground");
            p.setProperty("ButtonBar.background", "buttonBackground");
            p.setProperty("ButtonBar.insets", "emptyInsets");
            p.setProperty("ButtonBar.opaque", "false");

            p.setProperty("BrowserStatusPanel.background", "beanBackground");
            p.setProperty("BrowserStatusPanel.label.foreground", "browserForeground");
            p.setProperty("BrowserStatusPanel.label.font", "browserFont");

            p.setProperty("BaseBean.background", "beanBackground");
            p.setProperty("BaseBean.border", "emptyBorder.0");
            p.setProperty("BaseBean.opaque", "false");
            p.setProperty("BaseBean.label.foreground", "labelForeground");
            p.setProperty("BaseBean.label.font", "labelFont");
            p.setProperty("BaseBean.label.opaque", "false");
            p.setProperty("BaseBean.label.alignment", "left");

            p.setProperty("DialogBean.background", "beanBackground");
            p.setProperty("DialogBean.opaque", "true");
            p.setProperty("DialogBean.buttonPanel.background", "beanBackground");
            p.setProperty("DialogBean.buttonPanel.opaque", "true");
            p.setProperty("DialogBean.buttonPanel.border", "arcBottomBorder");
            p.setProperty("DialogBean.header.background", "dialogLabelBackground");
            p.setProperty("DialogBean.header.border", "loweredBevelBorder");
            p.setProperty("DialogBean.header.opaque", "true");
            p.setProperty("DialogBean.header.label.font", "dialogFont");
            p.setProperty("DialogBean.header.label.alignment", "center");
            p.setProperty("DialogBean.header.label.foreground", "dialogLabelForeground");
            p.setProperty("DialogBean.header.label.border", "emptyBorder.0");
            p.setProperty("DialogBean.header.label.opaque", "false");
            p.setProperty("DialogBean.message.foreground", "dialogLabelForeground");
            p.setProperty("DialogBean.message.font", "dialogFont");
            p.setProperty("DialogBean.message.opaque", "false");
            p.setProperty("DialogBean.message.margin", "dialogMessageMargin");
            p.setProperty("DialogBean.messageWrap.background", "beanBackground");
            p.setProperty("DialogBean.messageWrap.border", "etchedBorder");
            p.setProperty("DialogBean.messageWrap.opaque", "true");
        }

        return p;
    }

    /**
     *
     * @return
     */
    private static Properties loadTestProperties() {
        return loadTestProperties("tigerplaf.properties");
    }
}

Related

  1. loadRQGProperties()
  2. loadSetting(InputStream in, String key)
  3. loadSettings(String propertiesFileName)
  4. loadStrictly(File file)
  5. loadSystemProperty(String evn, String fileName)
  6. loadToStringFromFile(String fullFileName)
  7. loadTrimedProperties(String filename)
  8. loadUniversal(InputStream in)
  9. loadUserSettings()