Giter Site home page Giter Site logo

jsettings's Introduction

JSettings

Java implementation of the Settings file format

Usage

Constructing a new Settings instance

import com.settingslib.*;
import com.settingslib.elements.*;

Settings newSettings = new Settings("Title");
Settings loadedSettings = Settings.get(new FileInputStream("settings.stgs"));

Adding a checkbox

Category root = settings.getRootCategory();
Checkbox checkbox = new Checkbox("Checkbox Title", /* id */ 1, /* locked */ false, /* checked */ false, /* defaultChecked */ false)
root.add(checkbox);

More element types

Slider slider = new Slider("Slider Title", /* id */ 2, /* locked */ false, /* min */ 1f, /* max */ 10f, /* step */ 0.5f, /* value */ 5f, /* defaultValue */ 5f);
DropdownBox dropdown = new Slider("Dropdown Title", /* id */ 3, /* locked */ false, /* selectedIndex */ 0, /* defaultSelectedIndex */ 0, /* options... */ "option 1", "option2", "option 3");
Button button = new Slider("Button Title", /* id */ 4, /* locked */ false);
Link link = new Slider("Link Title", /* id */ 5, /* locked */ false, /* destinationID */ 1);
Category category = new Category("Category Title", /* id */ 6, /* locked */ false);

Handling button events

Button.setHandler(id -> {
  System.out.println("Button with ID " + id " + clicked!");
});
button.click(); // Invoke the handler

Restoring defaults

Setting setting;
setting.restoreDefault();

jsettings's People

Contributors

dominicentek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.