Mit java Programme/Dateien starten!

ja cool danke zerix , aber es gibt eine Fehlermeldung in deinem Quelltext : "cannot resolve symbol - class FensterLauscher"

whats the problem?

Ich habe diesen "FensterLauscher" nun auskommentiert und nun erkennt er dieses one nicht: "cannot resolve symbol -variable one"
 
Zuletzt bearbeitet:
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class Fenster extends Frame implements ActionListener
{



public Fenster ()
{

super (" Lernpaket ");
Button one = new Button (" Test");
Button two = new Button (" Video");
Button three = new Button (" Test");
FlowLayout Buttons = new FlowLayout (FlowLayout.CENTER);
Panel pane = new Panel (Buttons);
pane.setLayout(Buttons);
Label L = new Label ("PROJEKT FA ST EM ");
add(pane);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
      dispose();
      System.exit(0);
}
});
one.addActionListener(this);
two.addActionListener(this);
three.addActionListener(this);

pane.add(L);
pane.add(one);
pane.add(two);
pane.add(three);
one.setBackground(Color.pink);
two.setBackground(Color.pink);
three.setBackground(Color.pink);
L.setFont (new Font ("Monospaced", Font.BOLD,30));
setSize (500, 200);
setBackground(Color.white);
setVisible (true);

}

public static void main(String arg[])
{
     new Fenster();
}

public void actionPerformed(ActionEvent e)
{
  if(e.getSource()==one)
 {
     try {
Runtime.getRuntime().exec("C:\\Programme\\QickTime\\QuickTimePlayer.exe Sample.mov");
} catch( IOException ex) {
// ...
} 
 }

}


hab es jetzt nicht getestet, aber das müsste funktionieren
 
Klar, ich bin auch blöd
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class Fenster extends Frame implements ActionListener
{

Button one = new Button (" Test");
Button two = new Button (" Video");
Button three = new Button (" Test");

public Fenster ()
{

super (" Lernpaket ");

FlowLayout Buttons = new FlowLayout (FlowLayout.CENTER);
Panel pane = new Panel (Buttons);
pane.setLayout(Buttons);
Label L = new Label ("PROJEKT FA ST EM ");
add(pane);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
      dispose();
      System.exit(0);
}
});
one.addActionListener(this);
two.addActionListener(this);
three.addActionListener(this);

pane.add(L);
pane.add(one);
pane.add(two);
pane.add(three);
one.setBackground(Color.pink);
two.setBackground(Color.pink);
three.setBackground(Color.pink);
L.setFont (new Font ("Monospaced", Font.BOLD,30));
setSize (500, 200);
setBackground(Color.white);
setVisible (true);

}

public static void main(String arg[])
{
     new Fenster();
}

public void actionPerformed(ActionEvent e)
{
  if(e.getSource()==one)
 {
     try {
Runtime.getRuntime().exec("C:\\Programme\\QickTime\\QuickTimePlayer.exe Sample.mov");
} catch( IOException ex) {
// ...
} 
 }

}


Die andere Klasse brauchste jetzt nicht mehr, nur noch diese eine
 
yeah! danke zerix es funktioniert! :)
also es funktionier den player zu öffnen , aber leider nicht das gewünschte video.
Wenn ich diese endung da mit " Sample.mov" lasse kommt eine fehlermeldung und es öffnet sich nichts.
Aber sobald ich dieses dort lösche und somit nur noch die quicktime.exe dort stehen lasse öffnet sich der player! weisst du woran das liegen mag?
also wie kann ich direkt einene Film öffnen?
 

Neue Beiträge

Zurück