Newsgroup: it.comp.java
Titolo: [help] fullscreen

Salve vorrei sapere se e come si fa tramite java a mandare i programmi in
fullscreen visualizzando l'interno dell'applicazione a schermo intero
please rispondetemi ad 
hype...@libero.it



... da migliorarsi, comunque se aggiungi qualcosa e la migliori posta
pure la tua versione, sarebbe tanto bello aggiungerci una SlashScreen
ed una barra di scorrimento durante il loading... :)
... ci stavo lavorando, ma ora come ora, non ho tempo :(
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
import java.net.MalformedURLException;
public class FullScreenApplet extends Applet {
 
  static boolean DEBUG = true;
  static boolean APPLET = true;
  private int SCREEN_WIDTH;
  private int SCREEN_HEIGHT;
  Button buttonClose = new Button("Close");
  Label labelTitle = new Label("FullScreenApplet.java - Java Code by Castagna");
  Image img;
  Window window;
  Frame frame;
  ExtPanel extPanel;
  class ExtPanel extends Panel{
  	public void paint(Graphics g){
  		super.paint(g);
	    g.drawImage (img, SCREEN_WIDTH - img.getWidth(this) - 10, SCREEN_HEIGHT - img.getHeight(this) - 10, this);
  	}	// paint
  }	// ExtPanel
  public FullScreenApplet() {
    if (DEBUG) System.out.println ("FullScreenApplet() called...");
    frame = new Frame("FullScreenApplet");
    frame.setBackground(Color.white);
    frame.hide();   
    Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
    SCREEN_WIDTH = dimension.width; 
    SCREEN_HEIGHT = dimension.height; 
    window = new Window(frame); 
    window.setBounds (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT+20);
    // window.setLayout (null);
  } // FullScreenApplet
 
  public class buttonCloseListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      if (DEBUG) System.out.println("Button Close pressed.");
      if (APPLET) {
        window.hide();
        stop();
        destroy();
      }
      else {
        System.exit(0);        
      }
    } // actionPerformed
  } // buttonCloseListener
 
  static class windowListener extends WindowAdapter {
    public void windowClosing(WindowEvent e) {
      if (DEBUG) System.out.println("Window closing...");
      System.exit(0);
    } // windowClosing
  } // windowListener
 
  public void init() {
    if (DEBUG) System.out.println("init() called...");
    //window.setLayout(null);
    buttonClose.addActionListener(new buttonCloseListener());
    extPanel = new ExtPanel();
    extPanel.add(labelTitle);
    extPanel.add(buttonClose);
    window.add(extPanel, BorderLayout.CENTER);
    if (APPLET) {
      img = getImage(getCodeBase(), "image.gif");
    } 
    else {
      img = Toolkit.getDefaultToolkit().getImage("image.gif");
    }    
 
    MediaTracker tracker;
    tracker = new MediaTracker(extPanel);
    tracker.addImage(img, 0);
    try {
      tracker.waitForAll();
    } 
    catch (InterruptedException e) {
      System.err.println ("Error loading " + "image.gif" + ".");
    }
    window.show(); 
    window.requestFocus();
  } // init
 
  public void start() {
    if (DEBUG) System.out.println("start() called...");
  } // start
 
  public void paint(Graphics g) {
    if (DEBUG) System.out.println ("paint() called...");
  } // paint
  public void update(Graphics g) {
    if (DEBUG) System.out.println ("update() called...");
  } // update
  public static void main(String[] args) {
    if (DEBUG) System.out.println("main() called...");
    APPLET = false;
    FullScreenApplet applet = new FullScreenApplet();
    applet.init();
    applet.start();
  } // main
 
} // FullScreenApplet