Galera como faço para alterar o tamanho da imagem dentro no Jframe sem precisar de botão, por que quando clico nas bordas para diminuir diminuo apenas o jText e a imagem e cortada.
achoq tenhoq usar o
private void formWindowOpened(java.awt.event.WindowEvent evt) {
imAnimada.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/login/espiral.gif")));
}
public class TelaLogin extends javax.swing.JFrame {
public TelaLogin() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
imAnimada = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
TXT_Jogador = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Quis_2020");
setMaximumSize(new java.awt.Dimension(0, 0));
setPreferredSize(new java.awt.Dimension(805, 628));
setResizable(false);
setSize(new java.awt.Dimension(0, 0));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
getContentPane().setLayout(null);
imAnimada.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/login/espiral.gif"))); // NOI18N
getContentPane().add(imAnimada);
imAnimada.setBounds(50, 260, 400, 180);
jButton1.setFont(new java.awt.Font("Segoe UI Semibold", 1, 18)); // NOI18N
jButton1.setText("CONFIRMAR");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(70, 160, 180, 50);
TXT_Jogador.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
TXT_Jogador.setHorizontalAlignment(javax.swing.JTextField.CENTER);
getContentPane().add(TXT_Jogador);
TXT_Jogador.setBounds(30, 60, 280, 80);
jLabel1.setFont(new java.awt.Font("Swis721 Hv BT", 1, 18)); // NOI18N
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/login/Login.jpg"))); // NOI18N
jLabel1.setToolTipText("");
jLabel1.setMaximumSize(new java.awt.Dimension(800, 600));
jLabel1.setMinimumSize(new java.awt.Dimension(800, 600));
jLabel1.setPreferredSize(new java.awt.Dimension(805, 628));
getContentPane().add(jLabel1);
jLabel1.setBounds(0, 0, 805, 600);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Codigo c1 = new Codigo();
c1.setJogador(TXT_Jogador.getText());
System.out.println("Jogador: "+c1.getJogador());
new Tela_Game().setVisible(true);
this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
imAnimada.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/login/espiral.gif")));
}
/*
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TelaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TelaLogin().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextField TXT_Jogador;
private javax.swing.JLabel imAnimada;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
// End of variables declaration
}