Hola. Para desplegar el número en otro formato, como un número en unidades, decenas, centenas..., etc., puedes utilizar la clase NumberFormat del paquete java.text, con NumberFormat bastará con especificar un tipo de formato que desees darle al número. Aqui te pongo un ejemplo sencillo. Espero que te sirva, saludos!
import java.awt.*;
import java.awt.event.*;
import java.text.NumberFormat;
import javax.swing.*;
public class ProgDouble {
public static void main( String agrs[] ){
new FormaGeneral().setVisible( true );
}
}
class FormaGeneral extends JFrame{
public FormaGeneral(){
super( "Aplicación de número Double" );
iniciarGUI();
setSize( 400, 300 );
setVisible( true );
setResizable( false );
setLocationRelativeTo( null );
setDefaultCloseOperation( EXIT_ON_CLOSE );
}
private void iniciarGUI(){
final JTextField cmpNum, cmpRes;
cmpNum = new JTextField();
getContentPane().setLayout( null );
getContentPane().add( cmpNum );
cmpNum.setBounds( 50, 50, 200, 28 );
cmpRes = new JTextField();
getContentPane().add( cmpRes );
cmpRes.setBounds( 50, 150, 200, 28 );
cmpNum.addActionListener(
new ActionListener(){
public void actionPerformed( ActionEvent evento ){
double numero = Double.parseDouble( evento.getActionCommand() );
NumberFormat formato = NumberFormat.getInstance( java.util.Locale.US );
cmpRes.setText( "" + formato.format( numero ) );
}
}
);
}
}