FileOpenDialog added
-FileOpenDialog -minor text fixes
This commit is contained in:
		
							
								
								
									
										16
									
								
								bin/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								bin/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| /GUI$1.class | ||||
| /GUI$2.class | ||||
| /GUI$3.class | ||||
| /GUI$4.class | ||||
| /GUI$5.class | ||||
| /GUI$6.class | ||||
| /GUI$7.class | ||||
| /GUI$8.class | ||||
| /GUI$SoundJLayer.class | ||||
| /GUI.class | ||||
| /Main.class | ||||
| /SoundJLayer.class | ||||
| /jaggob$1.class | ||||
| /jaggob$2.class | ||||
| /jaggob.class | ||||
| /GUI$9.class | ||||
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$1.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$1.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$2.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$2.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$3.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$3.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$4.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$4.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$5.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$5.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$6.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$6.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$7.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$7.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI$8.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI$8.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								bin/GUI.class
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/GUI.class
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										74
									
								
								src/GUI.java
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								src/GUI.java
									
									
									
									
									
								
							| @ -39,6 +39,7 @@ import java.util.ArrayList; | ||||
| import java.util.Properties; | ||||
|  | ||||
| import javax.swing.JButton; | ||||
| import javax.swing.JFileChooser; | ||||
| import javax.swing.JFrame; | ||||
| import javax.swing.JLabel; | ||||
| import javax.swing.JOptionPane; | ||||
| @ -46,6 +47,8 @@ import javax.swing.JPanel; | ||||
| import javax.swing.JTextField; | ||||
| import javax.swing.SwingConstants; | ||||
| import javax.swing.border.EmptyBorder; | ||||
| import javax.swing.filechooser.FileFilter; | ||||
| import javax.swing.filechooser.FileNameExtensionFilter; | ||||
|  | ||||
| import javazoom.jl.player.advanced.AdvancedPlayer; | ||||
| import javazoom.jl.player.advanced.PlaybackEvent; | ||||
| @ -60,6 +63,14 @@ public class GUI extends JFrame { | ||||
| 	private int anzahlBtn = 0; | ||||
| 	private int zY = 0;		// z<>hler f<>r posX | ||||
| 	 | ||||
| 	//stuff Calvin//////////////////////////////////////////////// | ||||
| 	 | ||||
| 	//Init  | ||||
| 	private JButton btn_browse; | ||||
| 	 | ||||
| 	 | ||||
| 	////////////////////////////////////////////////////////////// | ||||
| 	 | ||||
| 	ArrayList<JButton> 	myButton = new ArrayList<JButton>(); | ||||
| 	ArrayList<String>	eventPath = new ArrayList<String>(); | ||||
| 	 | ||||
| @ -153,11 +164,42 @@ public class GUI extends JFrame { | ||||
| 		btnNewButton.setBounds(851, 76, 249, 23); | ||||
| 		contentPane.add(btnNewButton); | ||||
| 		 | ||||
| 		//breite verkleinert | ||||
| 		textField = new JTextField(); | ||||
| 		textField.setBounds(851, 14, 249, 20); | ||||
| 		textField.setBounds(851, 14, 210, 20); | ||||
| 		contentPane.add(textField); | ||||
| 		textField.setColumns(10); | ||||
| 		 | ||||
| 		//browse Button hinzuf<75>gen | ||||
| 		 | ||||
| 		btn_browse = new JButton("..."); | ||||
| 		btn_browse.setBounds(1065, 14, 20, 20); | ||||
| 		btn_browse.addActionListener(new ActionListener() { | ||||
| 			 | ||||
| 			@Override | ||||
| 			public void actionPerformed(ActionEvent arg0) { | ||||
| 				//erstelle <20>ffnen-Dialog | ||||
| 				JFileChooser fileChooser = new JFileChooser(); | ||||
| 				 | ||||
| 				//erstelle Filter f<>r "Mp3" und "WAV" | ||||
| 				fileChooser.setFileFilter(new FileNameExtensionFilter("mp3", "mp3")); | ||||
| 				fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("wav", "wav")); | ||||
| 				 | ||||
| 				//Nur einzelne Dateien sollen ausw<73>hlbar sein | ||||
| 				fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); | ||||
| 				 | ||||
| 			 | ||||
| 				//<2F>ffnen Dialog anzeigen | ||||
| 				fileChooser.showOpenDialog(null); | ||||
| 				 | ||||
| 				//Pfad der ausgew<65>hlten Datei in Textfeld kopieren | ||||
| 				String path = fileChooser.getSelectedFile().getAbsolutePath(); | ||||
| 				textField.setText(path); | ||||
| 			} | ||||
| 		}); | ||||
| 		 | ||||
| 		contentPane.add(btn_browse); | ||||
| 		 | ||||
| 		JLabel lblNewLabel = new JLabel("Dateiname"); | ||||
| 		lblNewLabel.setForeground(Color.WHITE); | ||||
| 		lblNewLabel.setFont(new Font("Arial", Font.PLAIN, 14)); | ||||
| @ -206,7 +248,7 @@ public class GUI extends JFrame { | ||||
| 			JButton button = new JButton(); | ||||
| 			myButton.add(button); | ||||
| 			button.setText(setName());							//setzte den Button Text auf Wert von setName() | ||||
| 			contentPane.add(button);							//f<>gt Butoon zur cPane hinzu | ||||
| 			contentPane.add(button);							//f<>gt Button zur cPane hinzu | ||||
| 			button.setFont(new Font("Arial", Font.PLAIN, 18)); 	//Schriftart und Gr<47><72>e | ||||
|             button.setBounds(getPosX(), getPosY(), 200, 50); 				//position (x, y(j+160), width, height)			 | ||||
|             button.setVisible(true);						 | ||||
| @ -338,10 +380,34 @@ public class GUI extends JFrame { | ||||
| 	    public SoundJLayer(String filePath) | ||||
| 	    { | ||||
| 	        this.filePath = filePath; | ||||
| 	    } | ||||
| 	        } | ||||
|  | ||||
| 	    public void play() | ||||
| 	    { | ||||
| 	    	//versuche von Pfad zu laden (unsauber, funktioniert aber) | ||||
| 	    	try{ | ||||
| 	    		 | ||||
| 	    		String urlAsString = null; | ||||
| 	    		File temp = new File(filePath); | ||||
| 	    		urlAsString = "file:///"+temp.getAbsolutePath(); | ||||
| 	    		//urlAsString.replaceAll(" ", "%20"); | ||||
| 	    		System.out.println(urlAsString); | ||||
| 	    		 | ||||
| 	    		this.player = new AdvancedPlayer( | ||||
| 	    				new java.net.URL(urlAsString).openStream(), | ||||
| 		                javazoom.jl.player.FactoryRegistry.systemRegistry().createAudioDevice() | ||||
| 		            ); | ||||
| 	    		 | ||||
| 	            this.player.setPlayBackListener(this); | ||||
| 	            this.playerThread = new Thread(this, "AudioPlayerThread"); | ||||
| 	            this.playerThread.start(); | ||||
| 	    		 | ||||
| 	    	}catch(Exception e){ | ||||
| 	    		 | ||||
| 	    		//Debug Nachricht, falls lesen aus Pfad nicht funktioniert | ||||
| 	    		System.out.println("Failed to load from path: checking home directory."); | ||||
| 	    		 | ||||
| 	    	 | ||||
| 	        try | ||||
| 	        { | ||||
| 	            String urlAsString =  | ||||
| @ -365,6 +431,8 @@ public class GUI extends JFrame { | ||||
| 	        { | ||||
| 	            ex.printStackTrace(); | ||||
| 	        } | ||||
| 	         | ||||
| 	    } | ||||
| 	    } | ||||
|  | ||||
| 	    // PlaybackListener members | ||||
|  | ||||
		Reference in New Issue
	
	Block a user