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.
package frontend;
import javax.swing.UIManager;
import java.awt.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Application1 {
boolean packFrame = false;
//Construct the application
public Application1() {
Frame2 frame = new Frame2();
Point p = new Point();
//Validate frames that have preset sizes
//Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame) {
frame.pack();
}
else {
frame.validate();
}
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
//Main method
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e) {
e.printStackTrace();
}
new Application1();
}
}
package frontend;
import java.sql.*;
import java.awt.*;
import java.io.*;
import java.sql.SQLException;
/* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Db {
Frame1 frameneu;
Frame2 Frame2;
public void db(String lese, Frame1 frameneu) {
Connection con = null;
Statement sta = null;
ResultSet rs = null;
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
con = DriverManager.getConnection(
"jdbc:mysql://server/db",
"user", "psw");
sta = con.createStatement();
rs = sta.executeQuery(lese);
String Name = rs.getString(1);
String Hersteller = rs.getString(2);
frameneu.ausgabe.setText(frameneu.ausgabe.getText() + "\n" +
" Name: " + " Hersteller: " +
Hersteller);
}
catch (Exception e) {
System.err.println("Fehler: " + e.getMessage());
}
finally {
try {
if (rs != null) {
rs.close();
}
if (sta != null) {
sta.close();
}
if (con != null) {
con.close();
}
}
catch (SQLException e) {}
}
}
private void jbInit() throws Exception {
}
}
package frontend;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.JdbComboBox;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Frame1
extends JFrame {
JPanel contentPane;
JTextField eingabe = new JTextField();
JButton suchen = new JButton();
JComboBox jComboBox1 = new JComboBox();
JLabel Tabelle = new JLabel();
Db dbneu = new Db();
//Frame2 frameedit = new Frame2();
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea ausgabe = new JTextArea();
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel)this.getContentPane();
eingabe.setSelectionStart(11);
eingabe.setBounds(new Rectangle(115, 44, 226, 21));
eingabe.addActionListener(new Frame1_eingabe_actionAdapter(this));
contentPane.setLayout(null);
this.setSize(new Dimension(537, 369));
this.setTitle("Frontend");
contentPane.setDebugGraphicsOptions(0);
suchen.setBounds(new Rectangle(292, 73, 122, 27));
suchen.setFont(new java.awt.Font("Dialog", 1, 11));
suchen.setText("Suchen");
suchen.addActionListener(new Frame1_suchen_actionAdapter(this));
jComboBox1.addActionListener(new Frame1_jComboBox1_actionAdapter(this));
Tabelle.setFont(new java.awt.Font("Dialog", 3, 11));
Tabelle.setText("Tabelle:");
Tabelle.setBounds(new Rectangle(320, 21, 48, 18));
jComboBox1.setBounds(new Rectangle(381, 22, 130, 19));
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.
VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane1.setBounds(new Rectangle(20, 112, 501, 224));
eingabefeld.setFont(new java.awt.Font("Dialog", 3, 11));
eingabefeld.setText("Eingabe:");
eingabefeld.setBounds(new Rectangle(43, 42, 67, 22));
jdbComboBox1.setBounds(new Rectangle(167, 22, 88, 19));
jdbComboBox1.addActionListener(new Frame1_jdbComboBox1_actionAdapter(this));
jLabel1.setFont(new java.awt.Font("Dialog", Font.BOLD | Font.ITALIC, 11));
jLabel1.setText("Spalten:");
jLabel1.setBounds(new Rectangle(118, 22, 50, 15));
jButton1.setBounds(new Rectangle(46, 76, 206, 23));
jButton1.setText("SQL Befehl");
contentPane.add(jScrollPane1);
contentPane.add(eingabefeld, null);
contentPane.add(eingabe, null);
jScrollPane1.getViewport().add(ausgabe);
contentPane.add(jLabel1);
contentPane.add(jComboBox1, null);
contentPane.add(jdbComboBox1);
contentPane.add(Tabelle, null);
contentPane.add(suchen, null);
contentPane.add(jButton1);
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
void eingabe_actionPerformed(ActionEvent e) {
}
void suchen_actionPerformed(ActionEvent e) {
ausgabe.setText("");
String lese = "select " + eingabe.getText() + " from " +
jComboBox1.getItemAt(jComboBox1.getSelectedIndex());
dbneu.db(lese, this);
}
void aendern_actionPerformed(ActionEvent e) {
//frameedit.ausgabe_edit.setText("");
//String edit = "update" + jComboBox1.getItemAt(jComboBox1.getSelectedIndex()) +
//"set"+ dbneu.rs.getString(2);
}
void loeschen_actionPerformed(ActionEvent e) {
}
int z = 0;
JLabel eingabefeld = new JLabel();
JdbComboBox jdbComboBox1 = new JdbComboBox();
JLabel jLabel1 = new JLabel();
JButton jButton1 = new JButton();
void jComboBox1_actionPerformed(ActionEvent e) {
String lang[] = {
"artikel", "mitarbeiter", "lieferer"
};
if (z == 0) {
for (int i = 0; i < lang.length; i++) {
jComboBox1.addItem(lang[i]);
z = 1;
}
}
}
public void jdbComboBox1_actionPerformed(ActionEvent e) {
}
class Frame1_eingabe_actionAdapter
implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_eingabe_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.eingabe_actionPerformed(e);
}
}
class Frame1_suchen_actionAdapter
implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_suchen_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.suchen_actionPerformed(e);
}
}
class Frame1_aendern_actionAdapter
implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_aendern_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.aendern_actionPerformed(e);
}
}
class Frame1_loeschen_actionAdapter
implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_loeschen_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.loeschen_actionPerformed(e);
}
}
class Frame1_jComboBox1_actionAdapter
implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jComboBox1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jComboBox1_actionPerformed(e);
}
}
}
class Frame1_jdbComboBox1_actionAdapter
implements ActionListener {
private Frame1 adaptee;
Frame1_jdbComboBox1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jdbComboBox1_actionPerformed(e);
}
}
package frontend;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class Frame2
extends JFrame {
JTextField mysql_server = new JTextField();
JLabel jLabel1 = new JLabel();
JTextField mysql_user = new JTextField();
JLabel jLabel2 = new JLabel();
JTextField mysql_psw = new JTextField();
JTextField mysql_db = new JTextField();
JLabel jLabel3 = new JLabel();
JPanel jPanel1 = new JPanel();
GridLayout gridLayout1 = new GridLayout();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JButton jButton1 = new JButton();
public Frame2() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
void jbInit() throws Exception {
gridLayout1.setColumns(3);
jLabel4.setToolTipText("");
jLabel4.setRequestFocusEnabled(true);
jLabel4.setText("MySQL Passwort:");
jLabel5.setFont(new java.awt.Font("Dialog", 1, 15));
jLabel5.setText("MySQL Zugangsdaten");
jLabel5.setBounds(new Rectangle(160, 55, 238, 40));
jPanel1.setBorder(null);
jButton1.setBounds(new Rectangle(152, 262, 233, 47));
jButton1.setText("Weiter -->");
jButton1.addActionListener(new Frame2_jButton1_actionAdapter(this));
jPanel1.add(jLabel1, null);
jPanel1.add(mysql_server, null);
jPanel1.add(jLabel2, null);
jPanel1.add(mysql_db, null);
jPanel1.add(jLabel3, null);
jPanel1.add(mysql_user, null);
jPanel1.add(jLabel4, null);
jPanel1.add(mysql_psw, null);
this.getContentPane().add(jLabel5, null);
this.getContentPane().add(jButton1, null);
this.getContentPane().add(jPanel1, null);
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
this.setLocale(java.util.Locale.getDefault());
this.setResizable(true);
this.getContentPane().setLayout(null);
jLabel1.setText("MySQL Server:");
jLabel2.setRequestFocusEnabled(true);
jLabel2.setText("MySQL Datenbank::");
jLabel3.setText("MySQL Benutzer:");
jLabel3.setRequestFocusEnabled(true);
jLabel3.setToolTipText("");
jPanel1.setFont(new java.awt.Font("MS Sans Serif", 0, 11));
jPanel1.setForeground(Color.black);
jPanel1.setAlignmentY( (float) 0.5);
jPanel1.setDebugGraphicsOptions(0);
jPanel1.setDoubleBuffered(true);
jPanel1.setBounds(new Rectangle(55, 102, 399, 96));
jPanel1.setLayout(gridLayout1);
gridLayout1.setHgap(0);
gridLayout1.setRows(4);
gridLayout1.setVgap(0);
}
public static void main(String[] args) {
Frame2 frame2 = new Frame2();
}
void jButton1_actionPerformed(ActionEvent e) {
new Frame1().setVisible(true);
this.setVisible(false);
}
}
class Frame2_jButton1_actionAdapter
implements java.awt.event.ActionListener {
Frame2 adaptee;
Frame2_jButton1_actionAdapter(Frame2 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at frontend.Db.db(Db.java:28)
at frontend.Frame1.suchen_actionPerformed(Frame1.java:104)
at frontend.Frame1$Frame1_suchen_actionAdapter.actionPerformed(Frame1.java:159)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)