We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Do a password inputText using MyGUI
Page Index Toggle Pages: 1
Do a password inputText using MyGUI (Read 974 times)
Do a password inputText using MyGUI
Sep 2nd, 2006, 2:59am
 
Hi,

I try to do a password text with processing. I make one with  awt and the method "setEchoChar()". Also It's possible do with swing->JPasswordField.

Code:

import java.awt.*;
import java.awt.event.*;

void setup(){
size(600, 600);
Label l1 = new Label("Introduce tu Nombre"),

l2 = new Label("Introduce tu Password");

TextField t1 = new TextField("tu nombre",45),
t2 = new TextField(20);

t2.setEchoChar('*');
add(l1);
add(t1);
add(l2);
add(t2);
}


But I would like use MyGUI library(http://www.mkv25.net/MyGUI/) to do the textfield. I see in source code of the library that it uses the methods "text" for processing core.

I see in source code to dev.processing(PApplet.java) and the text method create the text using the Graphics2D library.
Code:

public void text(String str, float x, float y) {
if (recorder != null) recorder.text(str, x, y);
g.text(str, x, y);
}


I don't know what is the way to implement a text for password in text do it in Graphics2D.

Thanks,

Mar Canet
CC: Email
Reply #1 - Sep 22nd, 2006, 5:08pm
 
Hi Mar,

It should be possible to extend the MyGUI text class to create a password simulated text field. The method which captures the key strokes could be rewritten to store the actual keystrokes in a string and display a set of **** characters in the visible text field.

Hopefully next wek I'll have time to draw something up along these lines for you, unless you can figure it out before then ;)

(http://mkv25.net/applets/MyGUIExtended/)

Kind regards,
- John Beech
Page Index Toggle Pages: 1