S
sognix
Gast
Hallo!
Ich hab das Forum schon durchforstet und nicht wirklich was hilfreiches gefunden, daher mach ich ein neues Thema auf:
Ich habe ein Applet geschrieben, dass über ein HTTP-Request ein XML zurückbekommt dieses auswertet und dann Elemente zeichnet.
Mein Problem ist jetzt: Wenn ich den Browser starte und die Seite des Applets aufrufe, funktionierts einwandfrei, wenn ich jetzt die Seite neu Lade ohne den Browser neu zu starten, dann funktionierts nicht mehr richtig.
Ich hab den Verdacht, dass ich was mit der init(), start(), stop() oder destroy() machen muss bzw dass das ganze mit dem Cache vom Browser zusammenhängt.
Witzigerweise funktioniert das unter RuntimeEnvironment jre1.6.0_07 einwandfrei, nur neuere Environments spinnen herum.
Folgend der Code von meiner Appletklasse:
Danke schonmal!
Ich hab das Forum schon durchforstet und nicht wirklich was hilfreiches gefunden, daher mach ich ein neues Thema auf:
Ich habe ein Applet geschrieben, dass über ein HTTP-Request ein XML zurückbekommt dieses auswertet und dann Elemente zeichnet.
Mein Problem ist jetzt: Wenn ich den Browser starte und die Seite des Applets aufrufe, funktionierts einwandfrei, wenn ich jetzt die Seite neu Lade ohne den Browser neu zu starten, dann funktionierts nicht mehr richtig.
Ich hab den Verdacht, dass ich was mit der init(), start(), stop() oder destroy() machen muss bzw dass das ganze mit dem Cache vom Browser zusammenhängt.
Witzigerweise funktioniert das unter RuntimeEnvironment jre1.6.0_07 einwandfrei, nur neuere Environments spinnen herum.
Folgend der Code von meiner Appletklasse:
Java:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package main;
//own Packages
import GUI.*;
import GUI.LISTENER.*;
import GUI.PAINT.*;
//java Packages
import java.awt.Color;
import java.awt.Cursor;
import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
/**
*
* @author Mario Santner
*/
public class applet extends JApplet
{
private Functions functions;
private Cache cache;
private SaveDialog save;
/* SWING ELEMENTS */
//Swing Elements for Search
private JLabel l_search;
private JTextField tf_search;
//Swing Elements for Zoom
private JLabel l_zoomLeft;
private JLabel l_zoomRight;
private JTextField tf_zoomLeft;
private JTextField tf_zoomRight;
//Swing Elements for Age
private JLabel l_from;
private JLabel l_to;
private JTextField tf_from;
private JTextField tf_to;
//Swing Elements for System
public JRadioButton rb_production;
public JRadioButton rb_acceptance;
public ButtonGroup gr_system;
//Swing Elements for applet
private MainTable t_Main;
private JScrollPane s_tMain;
private JLabel l_picBox;
private PictureBox p_picBox;
private JScrollPane s_ppicBox;
private int object;
//0 nothing is set
//1 table is set (also the startTable)
//2 picBox is set
//Swing Elements for Information
private JLabel l_Info;
private MainTable t_Info;
private JScrollPane s_tInfo;
//Swing Elements for Path
private JLabel l_path;
private JTextField tf_path;
//Buttons
private JButton b_search;
private JButton b_edit;
private JButton b_back;
private JButton b_next;
private JButton b_center;
private JButton b_copyClipBoard;
private JButton b_save;
private JButton b_link;
//ActionListener
private ButtonListener listen_button;
private keyListener listen_key;
//Other
private String link;
public applet()
{
//JOptionPane.showMessageDialog(this, System.getProperty("java.version"));
}
/* GETTER */
/**
* Method to get Buttons <br />
* Parameter search, edit, back, next, center, clipboard, save
* @param String _type
* @return JButton
*/
public JButton getButton(String _type)
{
if(_type.equals("search"))
return this.b_search;
else if(_type.equals("edit"))
return this.b_edit;
else if(_type.equals("back"))
return this.b_back;
else if(_type.equals("next"))
return this.b_next;
else if(_type.equals("center"))
return this.b_center;
else if(_type.equals("clipboard"))
return this.b_copyClipBoard;
else if(_type.equals("save"))
return this.b_save;
return null;
}
/**
* Method to get TextFields <br />
* Parameter: search, zoomLeft, zoomRight, from, to, path
* @param String _type
* @return JTextField
*/
public JTextField getTextField(String _type)
{
if(_type.equals("search"))
return this.tf_search;
else if(_type.equals("zoomLeft"))
return this.tf_zoomLeft;
else if(_type.equals("zoomRight"))
return this.tf_zoomRight;
else if(_type.equals("to"))
return this.tf_to;
else if(_type.equals("from"))
return this.tf_from;
else if(_type.equals("path"))
return this.tf_path;
return null;
}
/**
* Method to get Tables <br />
* Parameter: main, Info
* @param String _type
* @return JTable
*/
public JTable getTable(String _type)
{
if(_type.equals("main"))
return this.t_Main;
else if(_type.equals("info"))
return this.t_Info;
return null;
}
/**
* Method to get ScrollPanes <br />
* Parameter: main, info, picBox
* @param String _type
* @return JTable
*/
public JScrollPane getScrollbar(String _type)
{
if(_type.equals("main"))
return this.s_tMain;
else if(_type.equals("info"))
return this.s_tInfo;
else if(_type.equals("picBox"))
return this.s_ppicBox;
return null;
}
/**
* Method to get Labels <br />
* Parameter: picBox
* @param String _type
* @return JLabel
*/
public JLabel getLabel(String _type)
{
if(_type.equals("picBox"))
return this.l_picBox;
return null;
}
public PictureBox getPicBox()
{ return this.p_picBox; }
public int getObject()
{ return this.object; }
/**
* Method to get RadioButtons <br />
* Parameter: production, acceptance
* @param String _type
* @return JRadioButton
*/
public JRadioButton getRadioButton(String _type)
{
if(_type.equals("production"))
return this.rb_production;
else if(_type.equals("acceptance"))
return this.rb_acceptance;
return null;
}
public ButtonGroup getButtonGroup()
{ return this.gr_system; }
public String getLink()
{ return this.link; }
/* SETTER */
/**
* Method to set Tables <br />
* Parameter: main, Info
* @param String _type, JTable _table
* @return void
*/
public void setTable(String _type, MainTable _table)
{
if(_type.equals("main"))
this.t_Main = _table;
else if(_type.equals("info"))
this.t_Info = _table;
}
/**
* Method to set ScrollPanes <br />
* Parameter: main, info, picBox
* @param String _type, JScrollPane _scroll
* @return void
*/
public void setScrollPane(String _type, JScrollPane _scroll)
{
if(_type.equals("main"))
this.s_tMain = _scroll;
else if(_type.equals("info"))
this.s_tInfo = _scroll;
else if(_type.equals("picBox"))
this.s_ppicBox = _scroll;
}
public void setPicBox(PictureBox _picBox)
{ this.p_picBox = _picBox; }
public void setObject(int _obj)
{ this.object = _obj; }
/**
* Method to set RadioButtons <br />
* Parameter: production, reduction
* @param String _type, JRadioButton _button
* @return void
*/
public void setRadioButton(String _type, JRadioButton _button)
{
if(_type.equals("production"))
this.rb_production = _button;
else if(_type.equals("reduction"))
this.rb_acceptance = _button;
}
/* JavaScript METHODS */
public void setLink(String _link)
{
this.link = _link;
if(this.link.indexOf("?") != -1)
{
System.out.println("NICHT LEER");
try
{ this.tf_search.setText(this.link.substring(this.link.indexOf("&ok")+4, this.link.indexOf("&zl"))); }
catch (NullPointerException ex)
{ this.tf_search.setText(this.link.substring(this.link.indexOf("&sk")+4, this.link.indexOf("&zl"))); }
this.tf_zoomLeft.setText(this.link.substring(this.link.indexOf("&zl")+4, this.link.indexOf("&zr")));
this.tf_zoomRight.setText(this.link.substring(this.link.indexOf("&zr")+4, this.link.indexOf("&to")));
this.tf_from.setText(this.link.substring(this.link.indexOf("&fo")+4, this.link.length()));
this.tf_to.setText(this.link.substring(this.link.indexOf("&to")+4, this.link.indexOf("&fo")));
}
}
public void init()
{
super.init();
}
public void start()
{
super.start();
}
public void stop()
{
super.stop();
}
public void destroy()
{
super.destroy();
}
}
Danke schonmal!