Input/Output Ordner erstelen?

MrTroble

Bekanntes Mitglied
ich hab ein paar probleme mit dem erstellen von einem Ordner
ich kenn die API aber es funkt nicht
Java:
File f = new File(System.getProperty("user.dir") + "/MeinOrdner/");
if(!f.exists()){
f.mkdirs();
}
 
... aber es funkt nicht.

Poste uns mal den ganzen Code + die Fehlermeldung, falls eine vorhanden ist. Ansonsten gibt es zu diesem Thema, ich traue es mich zu sagen, unendlich viele Seiten die dir behilflich sind.

EDIT: Dein Code funktioniert einwandfrei.
 
Zuletzt bearbeitet:
java.io.FileNotFoundException: D:\workbench\Blackout2.0\Blackout\Update.txt (Das System kann den angegebenen Pfad nicht finden)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
at com.weebly.mrtrobleadvminemod.Blackout2.DownUpManager.download(DownUpManager.java:16)
at com.weebly.mrtrobleadvminemod.Blackout2.Blackout2.main(Blackout2.java:539)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
java.nio.file.NoSuchFileException: D:\workbench\Blackout2.0\Blackout\Update.txt
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.util.Scanner.<init>(Scanner.java:668)
at com.weebly.mrtrobleadvminemod.Blackout2.Blackout2.main(Blackout2.java:541)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.weebly.mrtrobleadvminemod.Blackout2.Blackout2.main(Blackout2.java:545)
... 11 more
Exception running application com.weebly.mrtrobleadvminemod.Blackout2.Blackout2

ANMERKUNG ich find den Ordner immer noch nicht
 
Zuletzt bearbeitet:
ANMERKUNG ich find den Ordner immer noch nicht

Dann suchst du vermutlich am falschen Ort.

Lass dir mal den Pfad ausgeben und guck dann nochmal nach.

Bei mir wird der Ordner mit folgendem Code erstellt und dementsprechend ist er auch im Explorer zu finden:

Java:
import java.io.File;


public class CreateDirectory {

	public static void main(String[] args){
		File f = new File(System.getProperty("user.dir") + "/MeinOrdner/");
		System.out.println(System.getProperty("user.dir"));
		if(!f.exists()){
		f.mkdirs();
		}
		
	}
}

Pfad: C:\Users\PeterMustermann\workspace\Projekt
 
Zuletzt bearbeitet:
ne es sind die preferencen muss mich nach her drum kümmern asber danke das du's dir angeguckt hast
ich hab noch ne metohde die so halb wegs die preferencen abfragt und irgend wie muss ich die erst zurücksetzten
 
das kann doch nich sein diser komplete schwachsinn
ich schik mal code es sind nich die Preferencen
Java:
package com.weebly.mrtrobleadvminemod.Blackout2;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.font.TextAttribute;
import java.nio.file.Files;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.AclEntry.Builder;
import java.nio.file.attribute.FileAttribute;
import java.util.Date;
import java.util.Dictionary;
import java.util.Scanner;
import java.util.prefs.Preferences;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

import sun.dc.pr.PathStroker;
import sun.font.CreatedFontTracker;

import com.sun.javafx.geom.Dimension2D;
import com.sun.xml.internal.ws.api.pipe.NextAction;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.BackgroundPosition;
import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
 


public class Blackout2 extends Application {
	static int b = 1;
	private static Clip clip = null;	

	private Button einstellungen;	
    private Button closeback;
    private Button Lang;
    private Button de;
    private Button start;
    private Button Vollbild;
    private Button Close;
    private Button HomeOp;
    private Button BackOp;
    private Button Graphic;
    private Button Chang;
    
    static Preferences Full = Preferences.userRoot().node("/Blackout/Fullscreen");
    static Preferences u = Preferences.userRoot().node("/Blackout/lang");
    static Preferences s = Preferences.userRoot().node("/Blackout/Fullscreenb");
    static Preferences up = Preferences.userRoot().node("/Blackout/version");
    
    public static GridPane grid;
    
    public static Label time;
    public static Label lab;
    
    public static Mixer mix;
    
    public static String version;
    
    public static String dir = System.getProperty("user.dir") + "/Blackout/";
    
    static int i = 1;
    
    private Scanner sc;
    private Scanner sv;
    private static Scanner su;
    private static Scanner sca;
   
    @Override
    public void start(final Stage primaryStage) throws IOException{
    	
    	File f = new File(System.getProperty("user.dir") + "/Blackout/");
    	System.out.println(System.getProperty("user.dir"));
    	if(!f.exists()){
    		System.out.print("hollo");
    	f.mkdirs();
    	}
	
     DownUpManager.download("http://www.weebly.com/uploads/4/4/9/3/44939395/langde.blackout", "langDE.BLACKOUT");
     DownUpManager.download("http://www.weebly.com/uploads/4/4/9/3/44939395/langen.blackout", "langEN.BLACKOUT");
          
        final Button en = new Button("English");
    	en.setVisible(false);
    	en.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				u.putInt("lang", 0);
	    		try {
					start(primaryStage);
				} catch (IOException e) {
					e.printStackTrace();
			}}
		});
	
    		
    	
    	
    	de = new Button("Deutsch");
    	de.setVisible(false);
    	de.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				u.putInt("lang", 1);
	    		try {
					start(primaryStage);
				} catch (IOException e) {
					e.printStackTrace();
				}
				
			}
		});
    	
        
    	if(u.getInt("lang", 0) == 0){
    	sc = new Scanner(Paths.get(dir + "langEN.BLACKOUT"));
    	}
    	if(u.getInt("lang", 0) == 1){
        sc = new Scanner(Paths.get(dir +"langDE.BLACKOUT"));	
    	}
        
    	final Text Black = new Text("BlackoutLauncher " + version);
    	Black.setVisible(true);
    	Black.setOnMouseClicked(new EventHandler<Event>() {

			@Override
			public void handle(Event arg0) {
                playSoundAPI("click2", false);

				try{
					Desktop.getDesktop().browse(new URI("http://blackoutupdate.weebly.com"));
				}
				catch(IOException e){
					e.printStackTrace();
				}
				catch(URISyntaxException e){
					e.printStackTrace();
				}
			}
		});
    	Black.setId("Blackout");
    	
    	final Button Login = new Button("Login");
    	Login.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

			}
		});
    	
    	final Text clo = new Text(sc.nextLine());
    	clo.setVisible(false);
    	clo.setId("CloseText");
    	
    	final Button conclose = new Button(sc.nextLine());
    	conclose.setVisible(false);
    	conclose.setMinSize(120, 60);
    	conclose.setId("Conclose");
    	conclose.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				System.exit(0);
			}
			
		});
    	final Text Cred = new Text(sc.nextLine());
    	Cred.setVisible(false);
    	Cred.setId("Text-cr");
    	Cred.setDisable(true);
    	
    	final Button Credits = new Button(sc.nextLine());
    	Credits.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				Cred.setVisible(true);
				HomeOp.setVisible(true);
				System.out.print("Open Credits"); 
				Login.setVisible(false);
				Credits.setVisible(false);
				Black.setVisible(false);
				start.setVisible(false);
				Vollbild.setVisible(false);
				einstellungen.setVisible(false);
				Close.setVisible(false);
		    	Cred.setDisable(false);
			}
		});
    	
    	
    	start = new Button(sc.nextLine());
		start.setMinSize(250, 140);
        start.setOnAction(new EventHandler<ActionEvent>() {
 
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Start Game");
                playSoundAPI("click2", false);
            }
        });
        start.setId("Start");
        
       
        if(Full.getBoolean("FullScreen", true) == true){
        	if(u.getInt("lang", 0) == 0){
            	s.put("v", "Fullscreen On/Off");
    			}else{
    		    s.put("v", "Vollbild Aus");	
    			}
		}else{
			if(u.getInt("lang", 0) == 0){
            	s.put("v", "Fullscreen On/Off");
    			}else{
    		    s.put("v", "Vollbild An/Aus");	
    			}}
    	
		Vollbild = new Button();
		Vollbild.setText(s.get("v", ""));
		Vollbild.setOnAction(new EventHandler<ActionEvent>() {

			
			@Override
			public void handle(ActionEvent arg0) {
				
                playSoundAPI("click2", false);

				
				if(Full.getBoolean("FullScreen", true)){
		        	Vollbild.setText(s.get("v", ""));
					Full.putBoolean("FullScreen", false);
					try {
						start(primaryStage);
					} catch (IOException e) {
						e.printStackTrace();
					}
					 if(Full.getBoolean("FullScreen", true) == true){
				        	if(u.getInt("lang", 0) == 0){
				            	s.put("v", "Fullscreen On/Off");
				    			}else{
				    		    s.put("v", "Vollbild Aus");	
				    			}
						}else{
							if(u.getInt("lang", 0) == 0){
				            	s.put("v", "Fullscreen On/Off");
				    			}else{
				    		    s.put("v", "Vollbild An/Aus");	
				    			}
						}
				}else{
					 if(Full.getBoolean("FullScreen", true) == true){
				        	if(u.getInt("lang", 0) == 0){
				            	s.put("v", "Fullscreen On/Off");
				    			}else{
				    		    s.put("v", "Vollbild Aus");	
				    			}
						}else{
							if(u.getInt("lang", 0) == 0){
				            	s.put("v", "Fullscreen On/Off");
				    			}else{
				    		    s.put("v", "Vollbild An/Aus");	
				    			}
						}
				primaryStage.setFullScreen(true);
				Vollbild.setText(s.get("v", ""));
			    Full.putBoolean("FullScreen", true);
			}
			}	
		});
		Vollbild.setId("FullScreen");
		
		final Button Audio = new Button(sc.next());
		Audio.setVisible(false);
		Audio.setMinSize(160, 60);
		Audio.setId("Audio");
		Audio.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				BackOp.setVisible(true);
				Lang.setVisible(false);
				Graphic.setVisible(false);
				Audio.setVisible(false);
				
				
			}
		});
		
		Graphic = new Button(sc.next());
		Graphic.setVisible(false);
		Graphic.setMinSize(190, 80);
		Graphic.setId("Graph");
		
		Close = new Button(sc.next());
		Close.setVisible(true);
		Close.setId("Close");
		Close.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				Login.setVisible(false);
				Credits.setVisible(false);
				Black.setVisible(false);
				start.setVisible(false);
				Vollbild.setVisible(false);
				einstellungen.setVisible(false);
				Close.setVisible(false);
				clo.setVisible(true);
				closeback.setVisible(true);
				conclose.setVisible(true);
			}
		});
		BackOp = new Button("Back");
		BackOp.setVisible(false);
		BackOp.setId("OPC");
		
		final Text chan = new Text();
		while(sca.hasNextLine()){
			chan.setText(sca.next());
		}
		
		HomeOp = new Button(sc.next());
		HomeOp.setVisible(false);
		HomeOp.setId("Home");
		HomeOp.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				System.out.println("Go to Main meneu");
				Chang.setVisible(false);
				BackOp.setVisible(false);
				Login.setVisible(true);
				Cred.setVisible(false);
				en.setVisible(false);
				de.setVisible(false);
				Lang.setVisible(false);
				Credits.setVisible(true);
				Black.setVisible(true);
				Graphic.setVisible(false);
				start.setVisible(true);
				Vollbild.setVisible(true);
				Audio.setVisible(false);
				HomeOp.setVisible(false);
				einstellungen.setVisible(true);
				Close.setVisible(true);
			}
		});
        
		
        einstellungen = new Button(sc.next()); 
		einstellungen.setId("Options");
		einstellungen.setOnAction(new EventHandler<ActionEvent>() {
			 
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Open the Options");
                playSoundAPI("click2", false);

				
                    Login.setVisible(false);
                    Lang.setVisible(true);
                    Credits.setVisible(false);
                    Black.setVisible(false);
					start.setVisible(false);
					Vollbild.setVisible(false);
					einstellungen.setVisible(false);
					Close.setVisible(false);
					Audio.setVisible(true);
					HomeOp.setVisible(true);
					Graphic.setVisible(true);
				
            }
        });
		closeback = new Button(sc.next());
    	closeback.setVisible(false);
    	closeback.setId("Backclose");
    	closeback.setMinSize(160, 80);
    	closeback.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				Login.setVisible(true);
				Credits.setVisible(true);
				Black.setVisible(true);
				closeback.setVisible(false);
				conclose.setVisible(false);
				clo.setVisible(false);
				start.setVisible(true);
				Vollbild.setVisible(true);
				einstellungen.setVisible(true);
				Close.setVisible(true);
			}
		});
        
    	Lang = new Button(sc.nextLine());
    	Lang.setVisible(false);
    	Lang.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

				BackOp.setVisible(true);
				en.setVisible(true);
				de.setVisible(true);
				Lang.setVisible(false);
				Graphic.setVisible(false);
				Audio.setVisible(false);
			}
		});
    	Lang.setId("Lang");
    	
        Chang = new Button(sc.next());
    	Chang.setOnAction(new EventHandler<ActionEvent>() {
    		@Override
    		public void handle(ActionEvent arg0) {
                playSoundAPI("click2", false);

    			HomeOp.setVisible(true);
    			System.out.print("Open Credits"); 
    			Login.setVisible(false);
    			Credits.setVisible(false);
    			Black.setVisible(false);
    			start.setVisible(false);
    			Vollbild.setVisible(false);
    			einstellungen.setVisible(false);
    			Close.setVisible(false);
    	    	Cred.setDisable(false);
    	    	}
		});
    	
           	
    	grid = new GridPane();
		grid.setAlignment(Pos.CENTER);
		grid.setHgap(50);
		grid.setVgap(50);
		grid.setPadding(new Insets(15, 15, 15, 25));

		grid.add(HomeOp, 0, 0);
		grid.add(Audio, 1, 1);
		grid.add(einstellungen, 0,0);
		grid.add(start, 2, 2);
		grid.add(Vollbild, 3, 0);
		grid.add(Graphic, 0, 3);
		grid.add(Close, 0, 3);
		grid.add(closeback, 0, 2);
		grid.add(conclose, 2, 2);
		grid.add(clo, 1, 0);
		grid.add(Black, 1, 1);
		grid.add(Credits, 3, 3);
		grid.add(Lang, 2, 3);
		grid.add(en, 1, 3);
		grid.add(de, 2, 1);
		grid.add(Login, 1, 2);
		grid.add(Cred, 1, 0);
		grid.add(BackOp , 3 ,4 );
		
		Logger.Error("");

		if(i == 1){
		playSoundAPI("Electro-Light_-_Symbolism_[NCS_Release_", true);
		i = 0;
		}
		
		Login.setId("Login");
		Credits.setId("Credits");
		
		Scene scene = new Scene(grid, 1900, 975);
		
		scene.getStylesheets().add(Blackout2.class.getResource("Main.css").toExternalForm());

        primaryStage.setTitle("BlakoutLauncher " + version);
        primaryStage.setScene(scene);
        primaryStage.show();
        primaryStage.centerOnScreen();
        primaryStage.setFullScreen(Full.getBoolean("FullScreen", true));
        PNG(dir + "background.png",dir + "background.jpg",dir + "background.png",dir + "background.jpg");
        }
 public static void main(String[] args) {
	 
     DownUpManager.download("http://www.weebly.com/uploads/4/4/9/3/44939395/update.txt", "Update.txt");
			try {
				su = new Scanner(Paths.get(System.getProperty("user.dir") + "/Blackout/Update.txt"));
			} catch (IOException e) {
				e.printStackTrace();
			}
	        if(su.next() == version){
	        	 launch(args);
	        }else{
	        	int i = JOptionPane.showConfirmDialog(null, "Would you like to update");
	        	if(i == JOptionPane.CANCEL_OPTION){
	        		launch(args);
	        	}else if (i == JOptionPane.YES_OPTION) {
	        		String s = "http://www.weebly.com/uploads/4/4/9/3/44939395/update.zip";
	        	     DownUpManager.download(s, "Update.zip");
	        	     JFrame f = new JFrame();
	        	     f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	        	     f.setBounds(400, 400, 200, 50);
	        	     f.setVisible(true);
	        	     
	        	     JProgressBar bar = new JProgressBar(0 , s.length());
	        	     bar.setStringPainted(true);
	        	     f.add(bar);

				}else{
					launch(args);
				}
	        	
	        }
       
 }
 public static void PNG(final String INPUTNAME,final String INPUTNAME2,final String INPUTNAME3,final String INPUTNAME4){
	 new Thread(new Runnable() {
		
		@Override
		public void run() {
			try {
				grid.setBackground(new Background(new BackgroundImage(new Image(new FileInputStream(INPUTNAME)), BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT)));
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}	
			try {Thread.sleep(1920);} catch (InterruptedException e) {e.printStackTrace();}
			try {
				grid.setBackground(new Background(new BackgroundImage(new Image(new FileInputStream(INPUTNAME2)), BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT)));
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}	
			try {Thread.sleep(1920);} catch (InterruptedException e) {e.printStackTrace();}	
			try {
				grid.setBackground(new Background(new BackgroundImage(new Image(new FileInputStream(INPUTNAME3)), BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT)));
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}	
			try {Thread.sleep(1920);} catch (InterruptedException e) {e.printStackTrace();}
			try {
				grid.setBackground(new Background(new BackgroundImage(new Image(new FileInputStream(INPUTNAME4)), BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT)));
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}	
			try {Thread.sleep(1920);} catch (InterruptedException e) {e.printStackTrace();}
			run();
		}
	}).start();
 }

public static synchronized void playSoundAPI(final String URL , final boolean Replay){
	 new Thread(new Runnable() {

		public void run() {
     Mixer.Info[] m = AudioSystem.getMixerInfo();
     
     mix = AudioSystem.getMixer(m[0]);

     DataLine.Info det = new DataLine.Info(Clip.class, null);
     try{clip = (Clip)mix.getLine(det);}catch(LineUnavailableException ex){ ex.printStackTrace(); }
     try{
    		 AudioInputStream inputStream = AudioSystem.getAudioInputStream(Blackout2.class.getResourceAsStream(URL + ".wav"));
    	        clip.open(inputStream);
    	        System.out.println(URL);
    	        System.out.printf(mix.getMixerInfo().getDescription() + "%n");
    	        System.out.println(clip.getMicrosecondLength() + "micSek");
     }catch(LineUnavailableException e){e.printStackTrace();}
      catch(IOException e){e.printStackTrace();}
      catch(UnsupportedAudioFileException e){e.printStackTrace();}
     
     clip.start();
     
     if(clip.getFrameLength() == clip.getMicrosecondPosition()){
      	if(Replay){run();}}
      	}}).start();}
}
dieser misst kakt sofort schon vor er überhaupt zur sysout komt ab das kann doch nich sein

sry sind 633 zeilen

Ich denke man sieht es aber es ist Fx
 
Zuletzt bearbeitet:
sry ich weis auch nich abe irgendwie ruft er main vor start auf obwohl start for main staht is ja eigentlich auch irgendwie logisch aber gut :lol::idea: :applaus:


:applaus:
 

Neue Themen


Zurück
Oben