Results 1 to 2 of 2
- 11-27-2012, 12:15 PM #1
Member
- Join Date
- Nov 2012
- Posts
- 1
- Rep Power
- 0
Gui
Hello community, I am a complete Java newbie and just try me on a Java GUI to various audio formats such as. Flac to. Mp3 converts.
But I come with my GUI not just continue, I have "already accomplished a frame to create a menu bar" File> Open and Close "," Tools "and" Help> About
For the audio converter to get an MP3 player with volume control and Fortschritsanzeige into the window.
Could help me there, perhaps?
I would be very grateful for the help and ideas.
About as I had imagined.

Java Code:/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package sox; import java.awt.*; import java.awt.event.*; import java.io.File; import javax.swing.*; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.filechooser.FileFilter; class LAF extends JFrame implements ActionListener { private File file; //implementieren des ActionListener interfaces @Override public void actionPerformed(ActionEvent event) { // if (event.getActionCommand().equals("open")) { // JFileChooser fc = new JFileChooser(); // fc.setMultiSelectionEnabled(true); //Mehrere Dateien wählen fc.setDialogTitle("Datei Auswahl"); // fc.setFileFilter(new FileFilter() { // public boolean accept(File f) { // return f.getName().toLowerCase().endsWith(".mp3") || f.isDirectory(); } public String getDescription() { return "(*.mp3)"; } }); if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { //Öffnen Button @SuppressWarnings("LocalVariableHidesMemberVariable") //mit File Chooser File file = fc.getSelectedFile(); // System.out.println(file.getName()); // } } if (event.getActionCommand().equals("Beenden")) { //Fenster schließen this.setVisible(false); //durch Beenden this.dispose(); //Button } } //Konstruktor @SuppressWarnings("LeakingThisInConstructor") public LAF() { super("AUDIO CONVERTER"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(800, 600); Container container = this.getContentPane(); container.setLayout(new BorderLayout()); //Menüleiste erzeugen JMenuBar menueLeiste = new JMenuBar(); this.setJMenuBar(menueLeiste); // --------------------------------------------------------------------- // Dropdown Menü (Datei) JMenu dateiMenue = new JMenu("Datei"); menueLeiste.add(dateiMenue); // Datei Button JMenuItem oeffnenEintrag = new JMenuItem("Öffnen"); oeffnenEintrag.addActionListener(this); oeffnenEintrag.setActionCommand("open"); dateiMenue.add(oeffnenEintrag); // (Öffnen Button mit FileChooser) JMenuItem beendenEintrag = new JMenuItem("Beenden"); beendenEintrag.addActionListener(this); // Beendet das Programm beendenEintrag.setActionCommand("Beenden"); // Beendet das Programm dateiMenue.add(beendenEintrag); // (Beenden Button) // --------------------------------------------------------------------- // Dropdown Menü (Werkzeuge) JMenu werkzeuge = new JMenu("Werkzeuge"); menueLeiste.add(werkzeuge); // Dropdown Menü (Werkzeuge Button) JMenuItem audioConverter = new JMenuItem("Audio Converter"); audioConverter.addActionListener(this); werkzeuge.add(audioConverter); // Werkzeug Audio Converter JMenuItem mediaPlayer = new JMenuItem("Media Player"); mediaPlayer.addActionListener(this); werkzeuge.add(mediaPlayer); // Werkzeug Media Player // --------------------------------------------------------------------- // Dropdown Menü (Hilfe) JMenu hilfeMenue = new JMenu("Hilfe"); menueLeiste.add(hilfeMenue); // Hilfe Button JMenuItem infoEintrag = new JMenuItem("Info"); infoEintrag.addActionListener(this); hilfeMenue.add(infoEintrag); // Info (Button) setVisible(true); infoEintrag.addActionListener(this); // --------------------------------------------------------------------- } //Die Main Methode @SuppressWarnings("ResultOfObjectAllocationIgnored") public static void main(String args[]) { new LAF(); } }
- 11-27-2012, 02:41 PM #2
Re: Gui
Recommended reading: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks