Torna indietro   Hardware Upgrade Forum > Software > Programmazione

GIGABYTE GAMING A16, Raptor Lake e RTX 5060 Laptop insieme per giocare al giusto prezzo
GIGABYTE GAMING A16, Raptor Lake e RTX 5060 Laptop insieme per giocare al giusto prezzo
Il Gigabyte Gaming A16 offre un buon equilibrio tra prestazioni e prezzo: con Core i7-13620H e RTX 5060 Laptop garantisce gaming fluido in Full HD/1440p e supporto DLSS 4. Display 165 Hz reattivo, buona autonomia e raffreddamento efficace; peccano però le USB e la qualità cromatica del pannello. Prezzo: circa 1200€.
iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
C'è tanta sostanza nel nuovo smartphone della Mela dedicato ai creator digitali. Nuovo telaio in alluminio, sistema di raffreddamento vapor chamber e tre fotocamere da 48 megapixel: non è un semplice smartphone, ma uno studio di produzione digitale on-the-go
Intel Panther Lake: i processori per i notebook del 2026
Intel Panther Lake: i processori per i notebook del 2026
Panther Lake è il nome in codice della prossima generazione di processori Intel Core Ultra, che vedremo al debutto da inizio 2026 nei notebook e nei sistemi desktop più compatti. Nuovi core, nuove GPU e soprattutto una struttura a tile che vede per la prima volta l'utilizzo della tecnologia produttiva Intel 18A: tanta potenza in più, ma senza perdere in efficienza
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 06-06-2010, 10:28   #1
UnknownSoldier
Member
 
Iscritto dal: Aug 2008
Messaggi: 210
[Java] Problema visualizzazione JProgressBar in JDialog

Ciao a tutti! Ho questo problema: ho creato una classe che mi consente di far comparire un JDialog con dentro una semplice JProgressBar indeterminata... il problema è che il JDialog viene visualizzato, ma non la JProgressBar, che viene invece visualizzata anch'essa solo se richiamo il metodo in un'altra parte del programma, ad esempio nel costruttore... perchè?? o_O

ProgressBar:
Codice:
package immagineX;

import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JLabel;

public class ProgressBar
{
    public static JDialog showIndeterminateBar(JFrame parentFrame)
    {
        JDialog barDialog = new JDialog (parentFrame);
        barDialog.setSize (250, 80);
        barDialog.setLocationRelativeTo (null);
        barDialog.setResizable (false);
        barDialog.setDefaultCloseOperation (JDialog.DO_NOTHING_ON_CLOSE);

        JPanel panelDialog = new JPanel();

        JLabel lab = new JLabel ("Caricamento...");
        panelDialog.add (lab);

        JProgressBar bar =  new JProgressBar();
        bar.setIndeterminate(true);
        panelDialog.add (bar);

        barDialog.add (panelDialog);
        barDialog.setVisible(true);

        return barDialog;
    }
}
ImmagineX:
Codice:
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JLabel;
import javax.swing.JDialog;
import java.io.File;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import immagineX.*;

public class ImmagineX extends JFrame
{
    public ArrayList<ImageX> images;

    public JLabel infoLabel;
    public JPanel centerPanel;

    public ImmagineX()
    {
        super("ImmagineX");
        setSize(640, 400);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //addWindowListener(new WindowHandler());

        setJMenuBar(new XMenuBar(this));

        images = new ArrayList<ImageX>();

        infoLabel = new JLabel("Benvenuto in ImmagineX");
        centerPanel = new JPanel(TableLayout.newInstance());

        add(infoLabel, BorderLayout.NORTH);
        add(new JScrollPane(centerPanel), BorderLayout.CENTER);

        setVisible(true);
    }

    public void updateCenterPanel()
    {
        JDialog barDialog = ProgressBar.showIndeterminateBar(this);
        centerPanel.removeAll();
        for (ImageX image : images)
        {
            JPanel imagePanel = new JPanel();
            imagePanel.setPreferredSize(new Dimension(160, 200));
            imagePanel.add(new JLabel(image.getImagePreview()));
            imagePanel.add(new JLabel(image.getFile().getName()));
            centerPanel.add(imagePanel);
        }
        barDialog.dispose();
    }

    public static void main(String[] args)
    {
        new ImmagineX();
    }
}
updateCenterPanel() che richiama il metodo per creare il JDialog con la JProgressBar viene invocato in un actionPerformed(), che fa parte ovviamente di una classe che implementa ActionListener.

Qualcuno può aiutarmi?
UnknownSoldier è offline   Rispondi citando il messaggio o parte di esso
Old 06-06-2010, 11:27   #2
UnknownSoldier
Member
 
Iscritto dal: Aug 2008
Messaggi: 210
Risolto invocando il metodo in un nuovo thread :P
UnknownSoldier è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


GIGABYTE GAMING A16, Raptor Lake e RTX 5060 Laptop insieme per giocare al giusto prezzo GIGABYTE GAMING A16, Raptor Lake e RTX 5060 Lapt...
iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile iPhone 17 Pro: più di uno smartphone. &Eg...
Intel Panther Lake: i processori per i notebook del 2026 Intel Panther Lake: i processori per i notebook ...
Intel Xeon 6+: è tempo di Clearwater Forest Intel Xeon 6+: è tempo di Clearwater Fore...
4K a 160Hz o Full HD a 320Hz? Titan Army P2712V, a un prezzo molto basso 4K a 160Hz o Full HD a 320Hz? Titan Army P2712V,...
Memoria 2D: dimensioni atomiche che rivo...
ASML chiude il Q3 con 7,5 miliardi di ri...
Norvegia, obiettivo raggiunto: il 100% d...
Apple svela i nuovi iPad Pro con M5: un ...
Google Pixel 10 Pro e 10 Pro XL: due top...
Apple MacBook Pro 14'': ufficiale con ch...
HONOR 400 Smart debutta in Italia: batte...
Apple M5 è potentissimo: prestazi...
GrapheneOS non solo sui Pixel: confermat...
Microsoft subisce un duro colpo: land te...
Portatile tuttofare Lenovo a soli 399€ c...
Arriva anche su Radeon: lo scioglimento ...
SpaceX Starship: mostrati nuovi video de...
Disponibili da oggi Fire TV Stick 4K Sel...
Microsoft: qualcosa di grosso è i...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 15:53.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v