Coder Social home page Coder Social logo

material-ui-swing / jtextfieldplaceholder Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 5.37 MB

Simple Swing component with placeholder called JTextFieldPlaceholder

License: BSD 3-Clause "New" or "Revised" License

Kotlin 10.08% Java 89.92%
swing-components swing-component swing-gui java java-library material-ui

jtextfieldplaceholder's Introduction

JTextFieldPlaceholder

Maven Central

Simple Swing component with placeholder called JTextFieldPlaceholder

TODO

This component has bad design, in the future should introduce the following effect

  • Used a personal UI component as BasicTextFieldPlaceholderUI
  • Introduce a toggle button with an icon
  • Introduce rules to check the errors inside the text field and paint the line with an error color

Code Style

We live in a world where robots can drive a car, so we shouldn't just write code, we should write elegant code.

This repository use google-java-format to maintains the code of the repository elegant, so before submit the code check the Java format with the following command on the root of the directory

./gradlew verifyGoogleJavaFormat

It any error are reported please run the following command to try to fix it

./gradlew googleJavaFormat

p.s: The gradle plugin work with all the JDK version >= 9 (or better with java byte code version compatible with the version 55.0)

For more details about the JDK support see the this issue and to know more about the Google Java code Style see the this reference

Actual Style

Example with code

JTextFieldPlaceholder passwordFieldForm = new JTextFieldPlaceholder(new JPasswordField());
passwordFieldForm.setPlaceholderText("Password")
                .setIcon(
                        MaterialImageFactory.getInstance().getImage(
                                GoogleMaterialDesignIcons.VISIBILITY_OFF
                        ))
                .setSelectedIcon(
                        MaterialImageFactory.getInstance().getImage(
                                GoogleMaterialDesignIcons.VISIBILITY,
                                MaterialColors.LIGHT_BLUE_400
                        )
                )
                .setDimension(150, 35)
                .addAction(new AbstractAction() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        JPasswordField passwordField = (JPasswordField) passwordFieldForm.getTextFiled();
                        if (!passwordFieldForm.isSelected()) {
                            passwordField.setEchoChar((char) UIManager.get("PasswordField.echoChar"));
                        } else {
                            passwordField.setEchoChar((char) 0);
                        }
                    }
                });

In this example is use material-ui-swing library, you can set all type icon you want, by default there are two icons, as:

List of projects that used this component

Author

This component is developer by @vincenzopalazzo

In addition, this component is developed in collaborations with Arizona State University.

jtextfieldplaceholder's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

jtextfieldplaceholder's Issues

Bug with the material version 1.1.2-rc2

Describe the bug
The behavior it is not correct

To Reproduce
Steps to reproduce the behavior:
1 Run the demo login

Expected behavior
Correct foreground color in the password component

Screenshots
Selection_033

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.