Salve ragazzi, ho due quesiti da porvi:
1) ho creato una mi applicazione in java, e vorrei che quando l'utente apre il jar venga mostrata una immagine di sfondo centrale nel JFrame. Con delle scritte in movimento
io l'immagine di sfondo l'ho inserita e sono pienamente soddisfatto del risultato grafico. Però non so come poter inserire delle scritte in moviemento.
Io vorrei avere il seguente effetto si apre la finestra e da sinistra verso destra compaiono le scritte nomeProgramma versione 1.0 e sotto sempre in movimento realizzato da: eccecc
è possibile???
2) ho inserito una immagine con una barra di avanzamento quando il programma viene avviato.
allego codice
l'immagine che io gli passo è una forma ovale in PNG. Se la visualizzo normalmente e come sfondo del Jframe viene visualizzato solo l'ovale poichè lo sfondo è trasparente mentre quando la visualizzo nello splash screen viene visualizzato come un rettangono in cui al centro c'è l'immagine e gli angoli sono di un grigiastro.codice:package SplashScreen; import javax.swing.*; import java.awt.*; public class SplashScreen extends JWindow { BorderLayout borderLayout1 = new BorderLayout(); JLabel imageLabel = new JLabel(); JPanel southPanel = new JPanel(); FlowLayout southPanelFlowLayout = new FlowLayout(); JProgressBar progressBar = new JProgressBar(); ImageIcon imageIcon; public SplashScreen(ImageIcon imageIcon) { this.imageIcon = imageIcon; try { jbInit(); } catch(Exception ex) { ex.printStackTrace(); } } // note - this class created with JBuilder void jbInit() throws Exception { imageLabel.setIcon(imageIcon); this.getContentPane().setLayout(borderLayout1); southPanel.setLayout(southPanelFlowLayout); southPanel.setBackground(Color.BLACK); this.getContentPane().add(imageLabel, BorderLayout.CENTER); this.getContentPane().add(southPanel, BorderLayout.SOUTH); southPanel.add(progressBar, null); this.pack(); } public void setProgressMax(int maxProgress) { progressBar.setMaximum(maxProgress); } public void setProgress(int progress) { final int theProgress = progress; SwingUtilities.invokeLater(new Runnable() { public void run() { progressBar.setValue(theProgress); } }); } public void setProgress(String message, int progress) { final int theProgress = progress; final String theMessage = message; setProgress(progress); SwingUtilities.invokeLater(new Runnable() { public void run() { progressBar.setValue(theProgress); setMessage(theMessage); } }); } public void setScreenVisible(boolean b) { final boolean boo = b; SwingUtilities.invokeLater(new Runnable() { public void run() { setVisible(boo); } }); } private void setMessage(String message) { if (message==null) { message = ""; progressBar.setStringPainted(false); } else { progressBar.setStringPainted(true); } progressBar.setString(message); } }
Come posso ovviare a questo problema???
grazie a tutti



Rispondi quotando
