Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
...
} catch (IOException e) {
logger.warn("Could not open socket connection: ", e);
}
if (log.isDebugEnabled()) {
log.debug("Foo" + /*... ganz viele andere Strings */ + "Bar");
}
package kernfunktion;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
public class GUI extends JFrame implements ActionListener {
private static final long serialVersionUID = -7157848825008430852L;
private static final String konvertPath = "";
private JPanel srcPanel;
private JPanel srcPanel2;
public static JTextField konvertierungsdatei;
public static JTextField logdatei;
private JButton konvert;
public GUI(){
this.setTitle("Konvertierungsplattform");
this.init();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
this.setSize(600,200);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((dim.width - getWidth())/2, (dim.height - getHeight())/2);
this.setVisible(true);
}
public void init(){
this.getContentPane().setLayout(new BorderLayout());
//Menu
JMenuBar menuBar = new JMenuBar();
JMenu file = new JMenu( "Datei" );
menuBar.add( file );
this.setJMenuBar(menuBar);
Action exitAction = new AbstractAction( "Beenden" ) {
public void actionPerformed( ActionEvent e ) {
LogFileWrite.logger.debug("Anweisung: " + e.getActionCommand());
System.exit( 0 );
}
} ;
file.add( exitAction );
JPanel center = new JPanel(new GridLayout(2, 1));
this.srcPanel = new JPanel();
this.srcPanel.setBorder(new TitledBorder("Quell-Datei"));
this.konvertierungsdatei = new JTextField("", 30);
JButton srcBrowse = new JButton("Durchsuchen");
srcBrowse.setActionCommand("browseSrc");
srcBrowse.addActionListener(this);
this.srcPanel.add(this.konvertierungsdatei);
this.srcPanel.add(srcBrowse);
this.srcPanel2 = new JPanel();
this.srcPanel2.setBorder(new TitledBorder("Log-Datei"));
this.logdatei = new JTextField("", 30);
JButton destBrowse = new JButton("Durchsuchen");
destBrowse.setActionCommand("browseDest");
destBrowse.addActionListener(this);
this.srcPanel2.add(this.logdatei);
this.srcPanel2.add(destBrowse);
center.add(this.srcPanel);
center.add(this.srcPanel2);
this.getContentPane().add(center, BorderLayout.CENTER);
JPanel south = new JPanel(new FlowLayout());
this.konvert = new JButton("konvertieren");
this.konvert.setContentAreaFilled(false);
this.konvert.setFocusPainted(false);
this.konvert.setActionCommand("konvert");
this.konvert.addActionListener(this);
south.add(this.konvert);
this.getContentPane().add(south, BorderLayout.SOUTH);
}
public void actionPerformed(ActionEvent e){
LogFileWrite.logger.debug("Anweisung: " + e.getActionCommand());
if (e.getActionCommand().equals("browseSrc")){
JFileChooser fc = new JFileChooser(konvertPath);
MyFileFiltertxt myfilefilter = new MyFileFiltertxt();
fc.setFileFilter( myfilefilter);
int state = fc.showOpenDialog( null );
if ( state == JFileChooser.APPROVE_OPTION )
{
File file = fc.getSelectedFile();
konvertierungsdatei.setText( file.getName() );
}
}
else if (e.getActionCommand().equals("browseDest")){
JFileChooser fc = new JFileChooser(konvertPath);
MyFileFilterlog myfilefilter = new MyFileFilterlog();
fc.setFileFilter( myfilefilter);
int state = fc.showOpenDialog( null );
if ( state == JFileChooser.APPROVE_OPTION )
{
File file = fc.getSelectedFile();
logdatei.setText(file.getName());
}
}
else if (e.getActionCommand().equals("konvert")){
TxtToIni test = new TxtToIni();
try {
test.dateiInArray(konvertierungsdatei.getText());
} catch (FileNotFoundException e1) {
LogFileWrite.logger.error("Datei nicht gefunden");
JOptionPane.showMessageDialog( null, "Die Datei konnte nicht gefunden werden!" );
} catch (IOException e1) {
JOptionPane.showMessageDialog( null, e1.getMessage() );
}
}
}
}