Java - AWT/Swing

SplashScreen (window without decorations)

A Splashscreen is mostly showed at the gun of a program. It is about a normal JFrame, whose decorations are just turned off.



package com.sowas.javawiki.splashscreen;
 
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Label;
 
import javax.swing.JFrame;
 
public class SplashScreenDemo extends JFrame {
 
   public SplashScreenDemo(){
      setLayout(new BorderLayout());
      setLocation(400, 300);
      setPreferredSize(new Dimension(200, 100));
      setUndecorated(true);  // Frames, front strips etc. are turned off here
      getContentPane().setBackground(Color.CYAN);
      getContentPane().add(new Label("Hallo", Label.CENTER), BorderLayout.CENTER);
      pack();
   }
 
   public static void main(String[] args){
      JFrame frame = new SplashScreenDemo();
      frame.setVisible(true);
   }
}

Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007