atarw / material-ui-swing

A modern, Material Design UI for Java Swing
MIT License
653 stars 86 forks source link

JTextField not work backspace #81

Closed trungkiendang closed 5 years ago

trungkiendang commented 5 years ago

When user enter backspace in keyboard, it doesn't work, While it work on JPassword. Problem on: if (getComponent().getSelectedText() != null) line 146

vincenzopalazzo commented 5 years ago

Hi @NhocKun,

A is raised a NullPointerException?

We have made a considerable refactoring to the JTextField and JPassword code in this repo, if you don't mind you can do a test with the jar you find in the libs folder? so to see if this bug has been solved already?

In this week I will align the versions

trungkiendang commented 5 years ago

Hi @NhocKun,

A is raised a NullPointerException?

We have made a considerable refactoring to the JTextField and JPassword code in this repo, if you don't mind you can do a test with the jar you find in the libs folder? so to see if this bug has been solved already?

In this week I will align the versions

Hi @vincenzopalazzo , I'm clone repo and build from it, version of jar is material-ui-swing-0.9.9-jar-with-dependencies.jar It still is bug. And with JToggle, i have found bug when using UI from netbeans, when user change icon of toggle (toggle on) icon not show expect

vincenzopalazzo commented 5 years ago

Hi @NhocKun,

Today I have fixed this problem, is this your problem?

Can you give me an example with code?

It still is bug. And with JToggle, i have found bug when using UI from netbeans, when user change icon of toggle (toggle on) icon not show expect

trungkiendang commented 5 years ago

Hi @vincenzopalazzo , I'll check this, thank for support

Can you give me an example with code?

It still is bug. And with JToggle, i have found bug when using UI from netbeans, when user change icon of toggle (toggle on) icon not show expect I using drag, drop function of netbean for design Jtoggle,

Here is code to change icon with state of Jtoggle tgExpand.addActionListener((ActionEvent e) -> { JToggleButton tBtn = (JToggleButton) e.getSource(); if (tBtn.isSelected()) { tgExpand.setIcon(new ImageIcon(getClass().getResource("/resource/Toggle On_18px.png"))); } else { tgExpand.setIcon(new ImageIcon(getClass().getResource("/resource/Toggle Off_18px.png"))); } });

vincenzopalazzo commented 5 years ago

Hi @NhocKun, Thy this code for adding the icon. Swing already has many events, and when changing icons it is best to use its methods

toggleButton.setIcon (new ImageIcon(getClass().getResource("/resource/ToggleOff_18px.png"))));
toggleButton.setSelectedIcon (new ImageIcon(getClass().getResource("/resource/ToggleOn_18px.png")));

Attention to the space between toggle and On / off in the path of the image, I hope you were of help

vincenzopalazzo commented 5 years ago

Now I Creating a pull request, the pull request resolves this problem, @atarw can you close this issue, please?