Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Text password with asterisks

23 views
Skip to first unread message

Bader

unread,
Dec 29, 2009, 3:49:03 PM12/29/09
to
Hi guys,

I am trying to solve this problem but i did not reach to the solution.

The problem is that i have a GUI with an edit field, iwould like appear asterisks instead of the text typed by the user.

e.g. (******) instead of (matlab). Please help

Thanks in advance.

Andy

unread,
Dec 29, 2009, 4:08:03 PM12/29/09
to

Bader

unread,
Dec 29, 2009, 4:13:04 PM12/29/09
to
"Andy " <theori...@gmail.com> wrote in message <hhdr3j$32f$1...@fred.mathworks.com>...

The problem is that i can not link or deal with those file.

I am using guide while this GUI written directly in m-files.

Matthew Whitaker

unread,
Dec 29, 2009, 4:20:20 PM12/29/09
to
One way is to use a java JPasswordField so for example:

function passwordDemo

f = figure;
pwd = javax.swing.JPasswordField;
[hComp,hContainer]= javacomponent(pwd,[100,100,200,20],f);
set(hComp,'ActionPerformedCallback',@passwordEntered);

function passwordEntered(varargin)
disp(['The password entered was ', char(hComp.getText)])
end %passwordEntered
end %passwordDemo

Hope this helps

Matt W

"Bader " <hate...@hotmail.com> wrote in message <hhdpvv$m98$1...@fred.mathworks.com>...

Andy

unread,
Dec 29, 2009, 4:27:02 PM12/29/09
to
> I am using guide while this GUI written directly in m-files.

I'm not suggesting you link to that file or "deal" with it (I'm not sure what you mean by that). Read GUI_32, specifically the subfunction ed_kpfcn which is set as the key press function for the object S.ed. You would use the same technique if creating a GUI in GUIDE. In the Properties of the editable text box that you're using to hold a password, add a key press function. Then, in the m-file generated by GUIDE, find that key press function and mimic the ed_kpfcn from GUI_32.

Bader

unread,
Dec 29, 2009, 5:18:04 PM12/29/09
to
Andy sorry for confusing u. But as i said before

i can not dealing with such problems even when mimic an existing code. May u please post the code needed to be added to the key press function and if there is more details mention them. Sorry again and your help is appreciated.

ImageAnalyst

unread,
Dec 29, 2009, 7:41:38 PM12/29/09
to
On Dec 29, 5:18 pm, "Bader " <hatel-...@hotmail.com> wrote:
> Andy sorry for confusing u. But as i said before
>
> i can not dealing with such problems even when mimic an existing code. May u please post the code needed to be added to the key press function and if there is more details mention them. Sorry again and your help is appreciated.

--------------------------------------------------------
If Andy DID post such code for you then you'd be mimicking his
existing code, which goes against your requirements. It will be that
way for any code that you yourself don't write. You have precluded
using any example code. Thus you need to think up your own solution
and not look at any way that anybody else used to solve it. Good luck
with that.

Bader

unread,
Dec 31, 2009, 4:02:21 PM12/31/09
to
ImageAnalyst <imagea...@mailinator.com> wrote in message <eaf6c872-6db6-45f0...@d21g2000yqn.googlegroups.com>...

------------------------------------------------------
ImageAnalyst, thanks to advice but what i'm suffering that i am new in Matlab and i don't have enough experience within such those functions. What i have learned is to add gui components and some functions. Thank you again.

ImageAnalyst

unread,
Dec 31, 2009, 6:03:21 PM12/31/09
to
On Dec 31, 4:02 pm, "Bader " <hatel-...@hotmail.com> wrote:
> ImageAnalyst, thanks to advice but what i'm suffering that i am new in Matlab and i don't have enough experience within such those functions. What i have learned is to add gui components and some functions. Thank you again.
-----------------------------------------------------

OK good. You could learn even more by "mimicing" other people's
code. Look at the GUI tutorials and you'll have several good examples
to learn from:
http://www.mathworks.com/matlabcentral/fileexchange/?term=tag%3A%22gui+example%22

Bader

unread,
Jan 1, 2010, 9:11:02 AM1/1/10
to
ImageAnalyst <imagea...@mailinator.com> wrote in message <1a817420-182d-46f7...@d20g2000yqh.googlegroups.com>...


Thank you so much for your interesting,

it is a good source and very helpful.

0 new messages