tdf#162563 Convert OfficeBean example from Applet to AWT

As Java applets were removed in Java 26, this patch recovers the
example in a new form, AWT instead of applet.

Change-Id: Ie0595b3a2cad426a956762af797310e9b891a449
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197015
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
Chiggy Wiggy
2026-08-16 19:07:26 +02:00
committed by Hossein
parent 7f7942b3da
commit b6d07bbe01
3 changed files with 12 additions and 11 deletions
+2
View File
@@ -132,3 +132,5 @@ b53fa6344d033f8b8f03b9274dbdd811251c2c1a
e02a7a55c23d23dd7afa2627a7e10c70e1cba001 e02a7a55c23d23dd7afa2627a7e10c70e1cba001
1c235c1343ed7b88a3e6b923b9b0d6e567054f1c 1c235c1343ed7b88a3e6b923b9b0d6e567054f1c
5159de5febd02cd5a509e97c93df8ea26af0c65d 5159de5febd02cd5a509e97c93df8ea26af0c65d
05ba63c6fce1954e52399e01ffbde2ff4f55f19e
ddb95685dda6b0935322c36fc648e3f4f46a62fe
@@ -79,7 +79,9 @@ OOoBeanViewer: $(CLASSFILES)
@echo -------------------------------------------------------------------------------- @echo --------------------------------------------------------------------------------
%.run: $(CLASSFILES) %.run: $(CLASSFILES)
$(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@) export SAL_USE_VCLPLUGIN=gen && \
export LD_LIBRARY_PATH="$(OO_SDK_JAVA_HOME)/lib" && \
$(SDK_JAVA) --enable-native-access=ALL-UNNAMED -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
%.dbg: $(JAR1_JAR) %.dbg: $(JAR1_JAR)
jdb -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@) jdb -classpath "$(SDK_CLASSPATH)" $(subst /,.,$(PACKAGE)).$(basename $@)
@@ -43,15 +43,15 @@ import java.io.*;
/* A simple Applet that contains the SimpleBean. /* A simple Applet that contains the SimpleBean.
* *
* This applet is a sample implementation of the * This applet is a sample implementation of the
* OpenOffice.org bean. * LibreOffice OfficeBean.
* When initially loaded the applet has two buttons * When initially loaded the application has two buttons
* one for opening an existent file and one to open * one for opening an existent file and one to open
* a blank document of a given type supported by * a blank document of a given type supported by
* OpenOffice.org eg. Writer, Calc, Impress, ... * LibreOffice eg. Writer, Calc, Impress, ...
* *
*/ */
public class OOoBeanViewer extends java.applet.Applet public class OOoBeanViewer extends java.awt.Panel
{ {
/** /**
@@ -81,7 +81,7 @@ public class OOoBeanViewer extends java.applet.Applet
private OOoBean aBean; private OOoBean aBean;
/** /**
* Initialize the Applet * Initialize the example UI
*/ */
public void init() public void init()
{ {
@@ -302,7 +302,7 @@ public class OOoBeanViewer extends java.applet.Applet
/** /**
* Create a blank document of type <code>desc</code> * Create a blank document of type <code>desc</code>
* *
* @param url The private internal URL of the OpenOffice.org * @param url The private internal URL of the LibreOffice
* document describing the document * document describing the document
* @param desc A description of the document to be created * @param desc A description of the document to be created
*/ */
@@ -341,7 +341,6 @@ public class OOoBeanViewer extends java.applet.Applet
{ {
setVisible(false); setVisible(false);
aBean.stopOOoConnection(); aBean.stopOOoConnection();
stop();
System.exit(0); System.exit(0);
} }
@@ -356,7 +355,6 @@ public class OOoBeanViewer extends java.applet.Applet
} }
catch ( com.sun.star.comp.beans.NoConnectionException aExc ) {} // ignore catch ( com.sun.star.comp.beans.NoConnectionException aExc ) {} // ignore
aBean.stopOOoConnection(); aBean.stopOOoConnection();
stop();
if ( xDesktop != null ) if ( xDesktop != null )
xDesktop.terminate(); xDesktop.terminate();
System.exit(0); System.exit(0);
@@ -390,7 +388,7 @@ public class OOoBeanViewer extends java.applet.Applet
public static void main(String args[]) public static void main(String args[])
{ {
java.awt.Frame frame = new java.awt.Frame("OpenOffice.org Demo"); java.awt.Frame frame = new java.awt.Frame("LibreOffice Demo");
OOoBeanViewer aViewer = new OOoBeanViewer(); OOoBeanViewer aViewer = new OOoBeanViewer();
frame.setLayout(new java.awt.BorderLayout()); frame.setLayout(new java.awt.BorderLayout());
@@ -398,7 +396,6 @@ public class OOoBeanViewer extends java.applet.Applet
frame.addWindowListener( aViewer.new ExitListener() ); frame.addWindowListener( aViewer.new ExitListener() );
aViewer.init(); aViewer.init();
aViewer.start();
frame.add(aViewer); frame.add(aViewer);
frame.setLocation( 200, 200 ); frame.setLocation( 200, 200 );