começando agora

Pessoal, estou começando agora no mundo java, fiz inscrição no curso do senac e um exercício que o professor passou aula passada foi o seguinte
criar uma tela que tenha nome, sobrenome, data de nascimento e as opções de formatação itálico, sublinhado e negrito e um botão OK que ao clicar exibe tudo que foi digitado
gostaria da ajuda de vcs, se alguém puder fazer o código p mim eu agradeço, sou iniciante e preciso de um exemplo desses para treinar bastante e evoluir aos poucos
:slight_smile:

Boa noite galera,

Desculpe a sinceridade, mas o que significa isso: “se alguém puder fazer o código p mim eu agradeço” ???

Porque esta fazendo o curso ??

Se quiser um conselho la vai: inicie seu programa, poste as duvidas (por mais boba que possa achar que sejam) e garanto que vai receber toda a ajuda que precisa.
Agora pedir pra fazer o código para você… não vai a lugar nenhum.

[]s

não necessariamente fazer o código
o que ocorre é que não estou conseguindo
fazer a linha de comando (código) após criar a tela no JPanel
para simplificar
basta me ajudar com apenas um linha, um norte, as outras eu faço
tá ligado?

e a questão é q o curso é corrido e esse exercício meio que ficou sem solução pois até o professor se enrolou
mas de qqr maneira se ninguém puder ajudar eu agradeço e vou procurar ler o deitel de todo jeito, até de cabeça p baixo

quais seriam os códigos pra colocar aqui

@SuppressWarnings(“unchecked”)
//
private void initComponents() {

    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jRadioButton1 = new javax.swing.JRadioButton();
    jRadioButton2 = new javax.swing.JRadioButton();
    jRadioButton3 = new javax.swing.JRadioButton();
    jButton1 = new javax.swing.JButton();
    jTextField1 = new javax.swing.JTextField();
    jTextField2 = new javax.swing.JTextField();
    jTextField3 = new javax.swing.JTextField();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jLabel1.setText("NOME");

    jLabel2.setText("SOBRENOME");

    jLabel3.setText("DATA NASC.");

    jRadioButton1.setText("NEGRITO");
    jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButton1ActionPerformed(evt);
        }
    });

    jRadioButton2.setText("ITÁLICO");
    jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButton2ActionPerformed(evt);
        }
    });

    jRadioButton3.setText("SUBLINHADO");
    jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jRadioButton3ActionPerformed(evt);
        }
    });

    jButton1.setText("OK");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    jTextField1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField1ActionPerformed(evt);
        }
    });

    jTextField2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField2ActionPerformed(evt);
        }
    });

    jTextField3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jTextField3ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addGap(21, 21, 21)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)))
                    .addContainerGap())
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jRadioButton3)
                        .addComponent(jRadioButton2)
                        .addComponent(jRadioButton1))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 72, Short.MAX_VALUE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(40, 40, 40))))
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel1)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(jLabel2)
                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jRadioButton1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jRadioButton2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jRadioButton3))
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addContainerGap(17, Short.MAX_VALUE))
    );

    pack();
}// </editor-fold>

private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
}

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
}

private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
}

Boa noite galera,

Desculpe, mas o que coloca aqui onde ?

Você esta usando o NetBeans ?

Melhor postar o código completo e indicar onde esta sua dúvida.

Outra coisa, ao colar o seu código coloque antes [code] e depois feche com [ /code] (sem o espaço antes da barra), vai ficar mais legível.

[]s

bom renatus, como o Zeed01 ja disse, nao adianta nada a gente colocar o codigo pra voce.

em primeiro lugar monte sua telinha.
feito isso, nomei adequadamente cada componente, de preferencia seguindo um padrao que seja de facil entendimento. Eu por exemplo, uso TXT para campos de texto (Ex. TXTnome, TXTsobrenome), BTN para botoes (BTNok, BTNfechar) e assim vai. Isso vai te ajudar a se localizar quando seu programa crescer.

apos nomeado os componente, voce vai precisar fazer as acoes do botao OK (clica com botao direito em cima dele e voce vai ver (EVENTOS, ACTION)… ou duplo clique no botao mesmo. voce vai ser mandando para o codigo, onde voce devera especificar o que vai acontecer quando o botao for clicado.

agora voce vai ter que receber os valores digitados e efetuar as modificacoes estabelecidas.
boa sorte!!!

PS: dica…
procure sobre metodos GET e SET
para apresentar dados, JOptionPane.showMessageDialog.

apos nomeado os componente, voce vai precisar fazer as acoes do botao OK (clica com botao direito em cima dele e voce vai ver (EVENTOS, ACTION)… ou duplo clique no botao mesmo. voce vai ser mandando para o codigo, onde voce devera especificar o que vai acontecer quando o botao for clicado.

justamente isso que quero saber
que linhas de código devo usar nessa parte após fazer o Events, Action

cara, se a gente te der mais dicas vamos acabar fazendo o programa pra voce!

se voce ja chegou até o action do botao, agora soh pesquisar o get e set que te falei e descobrir como pegar o texto e formata -lo. Para exibir, ja dei a dica do JOptionpane.

Agora pesquisa um pouco que voce consegue!

de qqr maneira obrigado a todos pela “ajuda”

valeu

[code]import javax.swing.JOptionPane;

public class cliente {
private static String sobrenome;
public static void main(String[] args) {
String nome = null;
int resposta;
nome = JOptionPane.showInputDialog(“Qual é o seu nome?”);
resposta = JOptionPane.showConfirmDialog(null, "O seu nome é " + nome + “?”);

int resposta2;
sobrenome = JOptionPane.showInputDialog(“Qual é o seu sobrenome?”);
resposta = JOptionPane.showConfirmDialog(null, "O seu sobrenome é " + sobrenome + “?”);

resposta = JOptionPane.showConfirmDialog(null, "O seu nome completo é " + nome + sobrenome + “?”);

if (resposta == JOptionPane.YES_OPTION) {

// verifica se o usuário clicou no botão YES

JOptionPane.showMessageDialog(null, "Seu nome é " + nome);

} else {

JOptionPane.showMessageDialog(null, "Seu nome não é " + nome);

}
if (resposta == JOptionPane.YES_OPTION) {

// verifica se o usuário clicou no botão YES

JOptionPane.showMessageDialog(null, "Seu sobrenome é " + sobrenome);

} else {

JOptionPane.showMessageDialog(null, "Seu sobrenome não é " + sobrenome);

}

/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.
    */

/**
*

  • @author user
    */

}

}[/code]

fiz esse código agorinha e acho que com ele posso ajudar a esclarecer o que quero de fato
até agora tenho nome e sobrenome

1-falta-me ainda um campo que informe a data de nascimento e dê como retorno a idade
2-ter as opções de negrito, itálico e sublinhado

será que posso ter a ajuda de vcs em pelo menos uma dessas dúvidas
não achei em canto nenhuma nada à respeito