Visualizzazione dei risultati da 1 a 5 su 5

Visualizzazione discussione

  1. #3
    Utente di HTML.it
    Registrato dal
    Jan 2014
    Messaggi
    8
    Ok, grazie zipangulu !
    Funziona tutto, ho dovuto togliere "pf.pack ();" perchè mi visualizzava il frame schiacciato(era una fessura in pratica).

    L'immaigne è .gif e non si muove, so che non dovrebbe (in teoria) muoversi, ma, su internet ho trovato un jframe gia fatto e ci ho messo la mia immagine, e si muove, anche se molto piu veloce del normale.
    Perchè?

    Se volete leggere è questo:

    codice:
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Toolkit;
    import javax.imageio.ImageIO;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    
    
    public class JframeConImmagine extends JFrame{
        private ImageIcon immagine;
        private JLabel label;
        
    public JframeConImmagine()
        {
            setLayout(new FlowLayout());
            immagine = new ImageIcon(getClass().getClassLoader().getResource("images/120926.gif"));
        
            label = new JLabel(immagine);
            add(label);
        }
    public static void main(String[] args) {
        
        JframeConImmagine c = new JframeConImmagine();
        c.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Dimension dimensioniSchermo = Toolkit.getDefaultToolkit().getScreenSize();
        int larghezzaFrame, altezzaFrame;
        c.pack();
        larghezzaFrame = (int) (dimensioniSchermo.getWidth() / 4);
        altezzaFrame = (int) (dimensioniSchermo.getHeight() / 2);
        c.setSize(larghezzaFrame, altezzaFrame);
        c.setLocation(((int) dimensioniSchermo.getWidth() / 4),((int) dimensioniSchermo.getHeight() / 4));
        c.setVisible(true);
        
        }
        
    }
    Grazie mille, ciao!
    Ultima modifica di faza; 01-02-2014 a 18:51

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.