Hi
hab ma ne Frage zu einer in NetBeans erstellten GUI deren Quelltext ich auch noch unten Poste…
Also was ihr unten seht ist eine GUI die über einen Browser aufgerufen werden soll. Sie wird über den Localhost aufgerufen.
Wenn ich den Localhost aufrufe und die dazugehörige HTML Seiten in denen die Applet aufgerufen werden, wird im Mozilla die Boundsangabe nicht richtig erkannt. Die Buttons und die Labels sind zu klein sodass die die Beschriftung nur noch „…“ ist.
Im InternetExplorer wird das jedoch richtig angezeigt.
Wenn ich die Dateien nicht über den Localhost im Mozilla aufrufe (also c://SchlagMichTot/index.html werden sie mir dort auch richtig angezeigt. Das verwirrt mich irgendwie…
Mozilla v. 2.0.0.3
IE v. 6.0.2900.2180
Der Apache wird durch Xampp simuliert
Hoffe ihr findet was was ich übersehen habe…
schonmal vielen Dank im voraus
Grüße
Hier der versprochene Quelltext:
Klasse 1:
import java.applet.AppletContext;
import java.net.MalformedURLException;
import java.net.*;
/**
*
* @author jb
*/
public class Start extends java.applet.Applet {
/** Initializes the applet Projects */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// //GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
setLayout(null);
setSize(800, 600);
jButton1.setText(„OK“);
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt) ; }
});
add(jButton1);
jButton1.setBounds(80, 210,60, 23);
jButton2.setText(„Bearbeiten“);
add(jButton2);
jButton2.setBounds(150, 210, 100, 23);
jButton3.setText(„Abbruch“);
add(jButton3);
jButton3.setBounds(260, 210, 90, 23);
jList1.setModel(new javax.swing.AbstractListModel() {
String[] strings = { „Projekt 1“, „Projekt 2“, „Projekt 3“ };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
jScrollPane1.setViewportView(jList1);
add(jScrollPane1);
jScrollPane1.setBounds(40, 10, 310, 150);
}// //GEN-END:initComponents
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
AppletContext Context = getAppletContext();
try
{
Context.showDocument(new URL(„http://localhost/ordner/Project.html“));
} catch (MalformedURLException ex) {
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JList jList1;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
klasse 2
import java.awt.Rectangle;
import java.applet.AppletContext;
import java.net.MalformedURLException;
import java.net.URL;
/**
*
* @author jb
*/
public class Project extends java.applet.Applet {
/** Initializes the applet Stundensatz */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// //GEN-BEGIN:initComponents
private void initComponents() {
jTextField1 = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
setLayout(null);
setSize(800, 600);
add(jTextField1);
jTextField1.setBounds(100, 20, 220, 19);
jLabel1.setBackground(new java.awt.Color(150, 150, 150));
jLabel1.setText(„Project“);
add(jLabel1);
jLabel1.setBounds(10, 20, 70, 20);
jLabel2.setBackground(new java.awt.Color(150, 150, 150));
jLabel2.setText(„Track“);
add(jLabel2);
jLabel2.setBounds(10, 70, 50, 20);
jButton1.setText(„New“);
add(jButton1);
jButton1.setBounds(90, 200, 60, 23);
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
AppletContext Context = getAppletContext();
try
{
Context.showDocument(new URL(„http://localhost/ordner/track.html“));
} catch (MalformedURLException ex) {
}
}
});
jButton2.setText(„Bearbeiten“);
jButton2.setActionCommand(„Bearbeiten“);
add(jButton2);
jButton2.setBounds(160, 200, 100, 23);
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
AppletContext Context = getAppletContext();
try
{
Context.showDocument(new URL(„http://localhost/ordner/track.html“));
} catch (MalformedURLException ex) {
}
}
});
jButton3.setText(„L\u00f6schen“);
add(jButton3);
jButton3.setBounds(270, 200, 100, 23);
add(jTextField2);
jTextField2.setBounds(100, 280, 100, 19);
add(jTextField3);
jTextField3.setBounds(100, 300, 100, 19);
add(jTextField4);
jTextField4.setBounds(100, 320, 100, 19);
jLabel3.setBackground(new java.awt.Color(150, 150, 150));
jLabel3.setText(„Meister“);
add(jLabel3);
jLabel3.setBounds(20, 280, 60, 20);
jLabel4.setBackground(new java.awt.Color(150, 150, 150));
jLabel4.setText(„Techniker“);
add(jLabel4);
jLabel4.setBounds(20, 300, 60, 20);
jLabel5.setBackground(new java.awt.Color(150, 150, 150));
jLabel5.setText(„Elektriker“);
add(jLabel5);
jLabel5.setBounds(20, 320, 60, 20);
jButton4.setText(„OK“);
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton4MouseClicked(evt);
}
});
add(jButton4);
jButton4.setBounds(100, 350, 73, 23);
jButton5.setText(„Cancel“);
jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton5MouseClicked(evt);
}
});
add(jButton5);
jButton5.setBounds(230, 350, 73, 23);
jLabel6.setBackground(new java.awt.Color(150, 150, 150));
jLabel6.setText(„Stundensatz“);
add(jLabel6);
jLabel6.setBounds(80, 240, 200, 30);
jScrollPane1.setViewportBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
add(jScrollPane1);
jScrollPane1.setBounds(90, 50, 240, 130);
}// //GEN-END:initComponents
private void jButton5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_jButton5MouseClicked
private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_jButton4MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
// End of variables declaration//GEN-END:variables
}