Create a swing application with reflection

Hi folks, I'm seeing the possibility to create a application like eclipse wich loads the classes in a folder and builds the application , but I have a doubt, how organize the components in application , how I will add a component in a menu, how I will build the hierarchy , separating menus,panel and buttons , anyone have idea ?
Thanks .

1) Use JEditorPane
2) Need to Highlight syntax
3) Need to show lines
check out these links
coweb.cc.gatech.edu/mediaComp-plan/uploads/95/JESGutter.1.java
http://javaalmanac.com/egs/javax.swing.text/style_HiliteWords2.html
Now to popup
setLayout for the JEditorPane to null
You will have one JComboBox /or popup with all the properties and methods
of the class.
now add that JComboBox to JEditorPane
You can get the position of the dot by using
Point point = editorPane.getCaret().getMagicCaretPosition();
popupMenu.show( jEditorPane,
(int)point.getX(),
(int)point.getY());
Here you can show JComboBox too. (Absolute positioning).
Now as you need to use JEditorPane implement DocumentListener on it.
Using caret listener you can get the current word.
You can use getClass() for that. Add all the methods and properties in JComboBox or Popup.
As for other properties such as saving keywords, search, 'files opened' etc.
you can use xml.

Similar Messages

  • Swing application with JavaHelp crashes outside Netbeans IDE.

    Hi guys I have developed a small swing application in Netbeans IDE. I used the following code inside the IDE for JH.
    public void createHelp()
           try {
                   URL hsURL = new URL("jar:file:eDictionaryHelp.jar!/eDictionaryHelp/eDictionary.hs");
                   hs = new HelpSet(null, hsURL);
           catch (Exception ee)
            // Say what the exception really is
            System.out.println( "HelpSet " + ee.getMessage());
            System.out.println("HelpSet "+ helpHS +" not found");
            JOptionPane.showMessageDialog(new JFrame(), ee.getMessage(), "Error", ERROR_MESSAGE);
            hb = hs.createHelpBroker();
       }When I run the program inside the IDE and and click on the corresponding MenuItem.. JavaHelp comes up as it should! No problems with that.
    But when I build the project and tried to run it from the .jar file in the PROJECT_HOME/dist/ the swing got displayed till this function was called. and then it simply crashed.
    Investigating further and commenting out one line at a time and compiling I found out that whenever the hs = new HelpSet(null, hsURL); is encountered, the app crashes (it doesnt throw any error).
    But as I said this is not the case when i run and compile inside the IDE. I only get this problem when running the app from outside the IDE.
    I have tried all kinds of combinations of the URL .. for eg ( I am aware of Bug 4149782)
    ClassLoader cl = this.getClass().getClassLoader();
    try {
                   URL hsURL = HelpSet.findHelpSet(cl, helpHS);
    .What can be the problem guys? Any suggestions?
    Thanks!

    Anyone has an answer on this?
    I am facing the same problem.. I am using NetBeans 5.5
    arijit_datta, do u have a solution for this problem already?
    Thanks,
    SK

  • Creating master details application with views!

    Hi All,
    I have a requirement to create the master details with the views, but when I was trying to create the master details its asking me for Master Table name & detail table name. Here I am giving the master table name in place of detail table name I am using view but its not showing my view in query builder, my view is already there in the database
    any idea why its not showing my view?
    Thanks,
    Suma.

    Hi Claudia,
    I am so sorry, but I do not check the Oracle forums every day. I am under presser, because have to relocate from Bulgaria to the USA through the end of November.
    Shortly, any view could be updatable under many restrictions. I suppose, that is the reason for the errors. I don’t know what kind of connection you have between those two tables.
    Under all these circumstances, I’ll offer you to build first a form on the base of the first table which all columns are used. Then you can test, refine, and finish all details about it.
    Second, you can Create Page Computation retrieving the column (value, if any) from the second table.
    Third, you should Create Page Process on Submit of type “PL/SQL anonymous block”, which will INSERT the calculated (entered) value into second table.
    You gain:
    1. Full power of ApEx to build automatically forms and reports.
    2. Min. manual work.
    3. You can use the select statement from the view to build your SQL query.
    4. You are able to build and test that part of the application step by step.
    Konstantin
    [email protected]

  • Create an planning application with trimesters active.

    Hi All
    How to use a planning application with trimesters active in 11.1.2.1 with 12 months included. Is ther any way to create an application with trimesters active ?
    Many Thanks

    Create the application with a custom periods, then add the trimesters into the period dimension once the application has been created.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How can I create JScrollPane in my swing application with scroll bars movin

    Hi,
    How can we create scrollpanes moving with scrollbars.I tried many times with custom layout.but it does not work if i set custom layout.I hope that I will get my problem solved.
    Thanks and Regards,
    Rameh RK

    This means it is not possible to create a pure unicode file without the byte order mark?
    You wouldn't happen to know how a file with byte order mark should read on a Linux system?
    Or if this possible or not?
    Regards
    Christian

  • Creating a WebCenter Application with PageCutomizable and ADF Security

    I created a Webcenter App in Jdev 11.1.1.2.0 with webcenter extension.
    I have 2 JSPX files.
    One called mainTemplate.jspx
    - contains header, footer in ADF and a center facet.
    One called Welcome.jspx created from mainTemplate
    - contains page customizable > panel customizable > layout customizable > various custom panel configs.
    ADF security is configured with BASIC, authentication only. Because form authentication seems harder to get working.
    We have one weblogic user, and currently deploy to the integrated WLS, although we'll deploy out to a full server once security/composer is working.
    The problem is, when we run the Welcome.jspx, and because we added a reference to a logged in var, it requests http login fine.
    We then refresh the page and see that we are indeed logged in as 'weblogic'.
    Is weblogic a special user? should I create a new one? Is there any setup required on the Integrated WLS to get this working?
    However when we click on 'add Content' using the composer we get a permission error.
    +<RegistrationConfigurator><handleError> Server Exception during PPR, #1+
    javax.el.ELException: oracle.adf.view.page.editor.security.ComposerSecurityException: You do not have permission to edit the page
    +     at com.sun.el.parser.AstValue.invoke(AstValue.java:161)+
    +...+
    Caused by: oracle.adf.view.page.editor.security.ComposerSecurityException: You do not have permission to edit the page
    +     at oracle.adfinternal.view.page.editor.bean.DialogBean.setDialogHelp(DialogBean.java:129)+
    +     at oracle.adfinternal.view.page.editor.bean.DialogBean.showResourceCatalog(DialogBean.java:356)+
    +     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)+
    +...+
    I tried using the Customization allowed var in the property inspector, but could not map 'allowed by' to a user or role that my setup would recognise. The doco specifies 'admin' which does not work for me.
    In my catalog I have a WCM portlet taskflow, which will require its own permissions.
    I tried enabling permissions for the test-all role to all of my pages/taskflows, leaving just the 'view' permission to the anonymous role.
    I also tried authentication/authorization profiles, and building my own jspx login/error pages, but no luck there either, the login button doesn't seem to tirgger my java doLogin class, even though I set the binding on the button using the method expression builder to the bean method.
    *note: I didn't try the welcome/login/error page auto create as they generate html files, I created JSFs with full UI in there. Am I required to use those html types instead of jspx? I found that the redirection worked by appending the jspx reference with '/faces/Login.jspx'. The problem seemed to have been somewhere else.
    If we have any Webcenter Composer / Security gurus out there, help would be greatly appreciated.
    Our main goal is to create a Webcenter App which has security/composer/navigation and a catalog with WCM/Siebel portlets similar to the Avitek demo without using WC Spaces.
    Thanks.
    Thanks.
    Edited by: Guillaume_Davies_SC on Apr 20, 2010 7:28 PM

    When you want to achieve this you need to configure ADF security with basic authentication & authorization. THe authorization is the part that takes care of what a user may and may not do in an application. Authentication is just the log in part.
    When you have configured your application for authorization as well, you have to create roles and groups.
    You will also have to set the authorization of your pages. Open a jsxp and in the design or source view, right click and "edit authorization". You then have to add roles to your pages and define their rights. Then you can set the authorization for edit,cuustomize,personlise,view,...
    Hope this helps.

  • Swing application with network event handling

    Hello, hope this is the right place for this post. I'm the design phase of a client application in java which talks to a remote server written in C via sockets. I have a design problem: I want my Swing app to have a GUI with buttons and all for normal activities, which activities report to the server, and I want the client to react to server calls anytime without interrupting normal GUi activities. Plus, all must work together, so I would prefer having a single thread for the app. (Think of an IRC client: the user uses the GUI for activities and sendim messages, and meanwhile the client listens for messages from the server and display them as they arrive). My question is: is this possible?
    I have something like (in pseudo-java):
    classMyApp extends JFrame {
      public MyApp() {
        // Manages and create the GUI
        NetHandler h = new NetHandler(this);
        h.connect();
        while(true) {
          h.pollNetEvents();
    class NetHandler {
      private BufferedReader iStream;
      private PrintWriter oStream;
      private MyApp app;
      public NetHandler(MyApp a) {
        app = a;
        Socket socket = createSocket(ip, port);
        iStream = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        oStream = new PrintWriter(socket.getOutputStream());
        handshakeWithServer(); // Login & Password
      public pollNetEvents() {
        try {
          String s;
          for (;;) {
            s = iStream.readLine();
            if (s.equals("") == false)
              break;
            else
              app.parseCommand(s);
        catch (IOException e) {
          app.sendMessage("Error in pollNetEvent: " + e);
    }Roughly, something like this. With this solution the GUI works, but I cannot get the message the server sends.
    I hope my message is clear enough. Can anybody help me with the design of my app? Thanks a lot.
    Fabio.

    You might consider posting this in the Swing forum. You might get a more complete response there, but here are my first thoughts.
    -- I think you will end up wanting to use multiple threads, but only one thread will update the UI. For more about threading in Swing, see this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
    and maybe also here: http://www.sourcebeat.com/TitleAction.do?id=10 (look at the sample chapter on Threads)
    -- For the polling code ...
    Of course, if you use the classes provided for client/server communication described below, you don't need to write your own polling code. You may still wish worry about threading so that your UI remains responsive and does not encounter major issues: http://java.sun.com/developer/JDCTechTips/2005/tt0419.html#1
    -- Updates to the UI from thread(s) that are not on the Event Dispatch Thread (the one that controls the UI) must be posted using the SwingUtilities methods, such as invokeLater
    Message was edited by:
    pthorson

  • Coding Swing Applications with Large JDBC ResultSets

    Hi,
    Does anyone know where I can find information regarding efficient ways to code Swing UI's with large JDBC result sets. I have been using JTextArea but my application seems to constantly run out of memory when I encounter a large result set. Also, any information regarding threading and if running database queries should be done entirely off the event thread vs SwingUtilities.invokeLater() would be of tremendous help.
    Thanks,
    John Meah

    If doing operations in the awt thread starts to impair the performance of your app, then create a new class that implements Runnable, and do this:
    Thread t = new Thread (new yourRunnable());
    t.start();
    t should have lower priority than the AWT thread.
    As far as large result sets, it is a fairly universal problem. My recommendation is that you arbitrarily impose a limit on how many of the records returned are displayed, like maybe 25 records. This should fix your problem

  • Unable to launch Java Swing application with JSE 5.0

    Hi,
    we have a swing appln that gets downloaded via java webstart - which was working fine with 1.4.x until 5.0 came. I know that JSE 5.0 includes java webstart too - but when I start my application, I get Marshal error & filenotfound Exception. What we are doing in the application is to download some XML files that are to be used by the program. But the program is unable to find the files.
    If I manually install 1.4.x & Web Start separately, everything works fine.....
    Is there any change needed in the JNLP file?
    TIA

    Hi there,
    Here's the issue:
    I have modified our web page that helps the user download the swing appln - as per the guidelines given in the web site:
    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/launch.html
    Let's say that I already have JRE 1.4x & JWS installed on my m/c. When I visit our web page that downloads / starts the client application, I get an error:
    Java Web Start : Invalid Argument Error.
    General
    An error occurred while launching/running the application.
    Category: Invalid Argument error
    Could not load file/URL specified: http://myserver:8080/testdev/app/testb.jnlp
    Exception
    CouldNotLoadArgumentException[ Could not load file/URL specified: http://myserver:8080/testdev/app/testb.jnlp]
         at com.sun.javaws.Main.main(Unknown Source)
    Wrapped Exception
    java.io.IOException: Service Unavailable : http://myserver:8080/testdev/app/testb.jnlp
    at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
    at com.sun.javaws.Main.main(Unknown Source)
    If I uninstall JRE 1.4+ & etal - JRE 5.0 gets downloaded and everything works smooth. But I need to take care of backward compatibility... Hence this post....
    BTW, the JNLP file looks like:
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+"
         codebase="$$codebase"
         href="testb.jnlp">
    <information>
    <title>Test Application</title>
    <vendor>TP</vendor>
    <homepage href="help.htm"/>
    <description>TEST Application using Java Web Start </description>
    <description kind="short">TEST Application.</description>
    <icon href="logocropped.jpg"/>
    <icon kind="splash" href="logocropped.jpg"/>
    <offline-allowed/>
    </information>
    <resources>
    <j2se version="1.4+"/>
    <jar href="bars.jar" part="lpc" />
    <jar href="castor-0.9.4.3.jar" part="lpc" download="eager" />
    <jar href="xercesImpl.jar" download="eager"/>
    <jar href="xmlParserAPIs.jar" download="eager"/>
    <jar href="bsh-1.2b6.jar" download="eager"/>
    <jar href="gnujaxp.jar" download="eager"/>
    <jar href="itext-0.99.jar" download="eager"/>
    <jar href="jcommon-0.8.2.jar" download="eager"/>
    <jar href="junit.jar" download="eager"/>
    <jar href="pixie-0.8.0.jar" download="eager"/>
    <jar href="BarsUtil.jar" download="eager"/>
    </resources>
    <application-desc main-class="bars.Bars"/>
    <security>
    <all-permissions/>
    </security>
    </jnlp>
    Is there a version incompatibility issue that I need to take care of ?
    TIA for any help/direction......

  • Creating Custom Mobile Application with CRM

    Hi ,
    After reading some staff about the CRM Mobile client solutions , I have not figure it out weather I can create my own mobile applications  using the CRM Mobile Technology .
    I know that the mobile clients need CRM Middleware server for synchonization and for access to backend systems, but can I call any rfc on any backend system (for example R3)
    for synchronization meaning that my CRM server will be used only as middleware server to access non crm functionality on other backend systems
    Thnaks,
    Oren

    What you can do is the following:
    data-save on MSA triggers an outbound sbdoc (containing the update objects)
    -->this one is sent to CRM by the conntrans
    --> the sbdoc is created from the data, stored in the inbound queue, and processed through it's CRM flow (meaning mapping to mbdoc, processing of inbound mbdoc, creation of outbound mbdoc and mapping to outbound sbdoc).
    What you can do is use or exit the bdoc flow to trigger whatever other process you want.
    What exactly is the requirement?
    Michael.

  • How to create applications with forms61?

    I am using forms6i. i want to know how to create a standalone
    application with this. please give me what are the components
    required to create an application with forms6i. can i use
    crystal reports to generate reports instead of oracle reports
    with the combination of forms?

    Well to create a stand alone application all you need is the
    executable (FMX) and the runtime - thats it!
    As for using Crystal Reports - yes you could use ORA_FFI to
    integrate.
    Regards
    Grant Ronald
    Forms Product Management

  • Memory Leak in a multi threaded Swing application  (ImageIcon)

    When I profile my swing application with netbeans 5.5 , I notice that after each periodically tidy up my image container (add,remove IconImage objects to a hashmap or arraylist), there gather by and by surviving objects. This leads to run out of memory after a while. Is there any other way to avoid this effect?
    Any ideas about "The JVM is notorious for caching images."
    please help..
    what I have made briefly:
    1.) Read the binary stream from the db :
    rs=stmt.executeQuery(query);
    if(rs.next()){
        int len=rs.getInt(2);
        byte [] b=new byte[len];
        InputStream in = rs.getBinaryStream(3);
        try {
                in.read(b);
                in.close();
                img=Toolkit.getDefaultToolkit().createImage(b);
         } catch (IOException e) {
                e.printStackTrace();
    stmt.close();
    rs.close();2.) hold the icon as field :
    this.icon =  new ImageIcon(img);3.) After a while I remove the object from my collection and on the
    overridden method finalize() I also call the flush() method.
    if(this.icon != null){
                this.icon.getImage().flush();
                this.icon = null;
    }The surviving objects still increase?! On the page of SUN they
    submitted a bug. But this is set on closed/fixed.
    (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4014323)
    What am I doing wrong? I also use the byte[] constructor on creating the icon and
    my java version is 1.5.0_10.

    If in your JFrame u have placed your image, before invoke the dispose()
    method put explicitly the image pointer to null and deregister all listener
    you have added to any componentI implemented your suggest and after starting a long time test, in one hour there gathered aprox. 500 surviving generations. I attach a snapshot and the java file ( http://www.box.net/public/eqznamrazd ). The used heap size swings between 3MB and 5MB. I guess this wont kill so quickly the application but anyway there is something wrong!
    Even properly closed streams, database connections etc.. Really despairing. Could one take a look to the java source?
    some snippets bellow:
    private class MyImageIcon extends ImageIcon {
            public MyImageIcon(Image img){
                super(img);
            public void removeImage(Image anImage){
                tracker.removeImage(anImage);
    private class DetailDialog extends javax.swing.JFrame {
            private String personnr;
            private MyImageIcon icon;
            public DetailDialog(String personnr,MyImageIcon icon){
                this.personnr = personnr;
                this.icon = icon;
            public void dispose() {
                if(icon != null){
                    icon.removeImage(icon.getImage());
                    icon.getImage().flush();
                    icon = null;
                super.dispose();
    private class Person extends Object {
            private MyImageIcon icon;
            private String number;
            private DetailDialog detailDialog;
            protected void destroy() {
                if(icon!=null){
                    icon.removeImage(icon.getImage());
                    icon.getImage().flush();
                    icon = null;
                if(detailDialog!=null){
                    detailDialog.dispose();
    private Image LoadImageFromDB(String personnr){
            Image img = null;
            String filename = personnr + ".jpg";
            Connection con = getMysqlConnection();
            Statement stmt;
            ResultSet rs;
            try {
                stmt = con.createStatement();
                String query = "select * from personImage where image='"+filename+"'";
                rs=stmt.executeQuery(query);
                if(rs.next()){
                    int len=rs.getInt(2);
                    byte [] b=new byte[len];
                    InputStream in = rs.getBinaryStream(3);
                    try {
                        in.read(b);
                        in.close();
                        img =
                                java.awt.Toolkit.getDefaultToolkit().createImage(b);
                    } catch (IOException e) {
                        e.printStackTrace();
                rs.close();
                rs = null;
                stmt.close();
                stmt = null;
                con.close();
                con = null;
            } catch (SQLException e) {
                e.printStackTrace();
            return img;
    public void random(){
            java.sql.ResultSet rs = null;
            java.sql.Statement stmt=null;
            java.sql.Connection con = getSybaseConnection();
            try {
                try {
                    stmt = con.createStatement();
                    rs = stmt.executeQuery(randomquery);
                    while(rs.next()){
                        Person person = new Person();
                        person.number = rs.getString("PersonNr");
                        Image img = LoadImageFromDB(person.number);
                        if(img !=null){
                            MyImageIcon ico = new MyImageIcon(img);
                            person.icon = ico;
                        person.detailDialog = new
                                DetailDialog(person.number,person.icon);
                        personList.add(person);
                        System.out.println("Container size: " +
                                personList.size());
                        counter++;
                    if(counter%20 == 0){
                        for(Person p : personList){
                            p.destroy();
                        personList.clear();
                        System.gc();//no need, but I force for this example
                        System.out.println("Container cleared, size: " +
                                personList.size());
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }finally{
                    if(rs != null){
                        rs.close();
                    }if(stmt != null){
                        stmt.close();
                    }if(con != null){
                        con.close();
            } catch (SQLException ex) {
                ex.printStackTrace();
        }

  • PosgreSQL LAN-Based Swing Application

    is it possible to create a lan-based swing application with database connectivity?
    how?
    thanxx

    flor.jerico.m wrote:
    is it possible to create a lan-based swing application with database connectivity?
    how?
    thanxxYou mean swing application(s) on various hosts pointing to same database ?
    http://jdbc.postgresql.org/doc.html
    check out jdbc url
    jdbc:postgresql://host/database
    jdbc:postgresql://host:port/database

  • ?? Several applications with one JVM ??

    Hi,
    I need to run several swing application with a single JVM. (for performance reasons, especially with memory). This is ok.
    But swing applications uses only one AWT-Event-Thread that is shared by all applications (Frames).
    The consequence is, per example, that a modal dialog in one of the applications will block all other running applications.
    Actually, this problem is bug-id = 4080029.
    But there's no workaround.
    Is there anyone who knows how to deal with this ??
    I read an article about AppContext where I understand that it should be possible to assign a different context to each application, and also a different EventQueue to each application.
    But I cannot find any documentation about AppContext, and can't understand how to use it.
    Is there someone who can help with AppContext ??
    -Herbien (Switzerland)

    I've found the following in the src directory of JDK1.3.1 -- it's supposed to be part of javax.swing but I can't find it documented anywhere, so here goes (don't forget the Dukes if this helps):
    V.V.
    * @(#)AppContext.java     1.7 00/02/02
    * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
    * This software is the proprietary information of Sun Microsystems, Inc. 
    * Use is subject to license terms.
    package javax.swing;
    import java.util.Hashtable;
    import java.util.Enumeration;
    * The AppContext is a per-SecurityContext table which stores application
    * service instances.  (If you are not writing an application service, or
    * don't know what one is, please do not use this class.)  The AppContext
    * allows applet access to what would otherwise be potentially dangerous
    * services, such as the ability to peek at EventQueues or change the
    * look-and-feel of a Swing application.<p>
    * Most application services use a singleton object to provide their
    * services, either as a default (such as getSystemEventQueue or
    * getDefaultToolkit) or as static methods with class data (System).
    * The AppContext works with the former method by extending the concept
    * of "default" to be SecurityContext-specific.  Application services
    * lookup their singleton in the AppContext; if it hasn't been created,
    * the service creates the singleton and stores it in the AppContext.<p>
    * For example, here we have a Foo service, with its pre-AppContext
    * code:<p>
    * <code><pre>
    *    public class Foo {
    *        private static Foo defaultFoo = new Foo();
    *        public static Foo getDefaultFoo() {
    *            return defaultFoo;
    *    ... Foo service methods
    *    }</pre></code><p>
    * The problem with the above is that the Foo service is global in scope,
    * so that applets and other untrusted code can execute methods on the
    * single, shared Foo instance.  The Foo service therefore either needs
    * to block its use by untrusted code using a SecurityManager test, or
    * restrict its capabilities so that it doesn't matter if untrusted code
    * executes it.<p>
    * Here's the Foo class written to use the AppContext:<p>
    * <code><pre>
    *    public class Foo {
    *        public static Foo getDefaultFoo() {
    *            Foo foo = (Foo)AppContext.getAppContext().get(Foo.class);
    *            if (foo == null) {
    *                foo = new Foo();
    *                getAppContext().put(Foo.class, foo);
    *            return foo;
    *    ... Foo service methods
    *    }</pre></code><p>
    * Since a separate AppContext exists for each SecurityContext, trusted
    * and untrusted code have access to different Foo instances.  This allows
    * untrusted code access to "system-wide" services -- the service remains
    * within the security "sandbox".  For example, say a malicious applet
    * wants to peek all of the key events on the EventQueue to listen for
    * passwords; if separate EventQueues are used for each SecurityContext
    * using AppContexts, the only key events that applet will be able to
    * listen to are its own.  A more reasonable applet request would be to
    * change the Swing default look-and-feel; with that default stored in
    * an AppContext, the applet's look-and-feel will change without
    * disrupting other applets or potentially the browser itself.<p>
    * Because the AppContext is a facility for safely extending application
    * service support to applets, none of its methods may be blocked by a
    * a SecurityManager check in a valid Java implementation.  Applets may
    * therefore safely invoke any of its methods without worry of being
    * blocked.
    * @author  Thomas Ball
    * @version 1.7 02/02/00
    final class AppContext {
        /* Since the contents of an AppContext are unique to each Java
         * session, this class should never be serialized. */
        /* A map of AppContexts, referenced by SecurityContext.
         * If the map is null then only one context, the systemAppContext,
         * has been referenced so far.
        private static Hashtable security2appContexts = null;
        // A handle to be used when the SecurityContext is null.
        private static Object nullSecurityContext = new Object();
        private static AppContext systemAppContext =
            new AppContext(nullSecurityContext);
         * The hashtable associated with this AppContext.  A private delegate
         * is used instead of subclassing Hashtable so as to avoid all of
         * Hashtable's potentially risky methods, such as clear(), elements(),
         * putAll(), etc.  (It probably doesn't need to be final since the
         * class is, but I don't trust the compiler to be that smart.)
        private final Hashtable table;
        /* The last key-pair cache -- comparing to this before doing a
         * lookup in the table can save some time, at the small cost of
         * one additional pointer comparison.
        private static Object lastKey;
        private static Object lastValue;
        private AppContext(Object securityContext) {
            table = new Hashtable(2);
            if (securityContext != nullSecurityContext) {
                if (security2appContexts == null) {
                    security2appContexts = new Hashtable(2, 0.2f);
                security2appContexts.put(securityContext, this);
         * Returns the appropriate AppContext for the caller,
         * as determined by its SecurityContext. 
         * @returns the AppContext for the caller.
         * @see     java.lang.SecurityManager#getSecurityContext
         * @since   1.2
        public static AppContext getAppContext() {
            // Get security context, if any.
            Object securityContext = nullSecurityContext;
    Commenting out until we can reliably compute AppContexts
            SecurityManager sm = System.getSecurityManager();
            if (sm != null) {
                Object context = sm.getSecurityContext();
                if (context != null) {
                    securityContext = context;
            // Map security context to AppContext.
            if (securityContext == nullSecurityContext) {
                return systemAppContext;
            AppContext appContext =
                (AppContext)security2appContexts.get(securityContext);
            if (appContext == null) {
                appContext = new AppContext(securityContext);
                security2appContexts.put(securityContext, appContext);
            return appContext;
         * Returns the value to which the specified key is mapped in this context.
         * @param   key   a key in the AppContext.
         * @return  the value to which the key is mapped in this AppContext;
         *          <code>null</code> if the key is not mapped to any value.
         * @see     #put(Object, Object)
         * @since   1.2
        public synchronized Object get(Object key) {
            if (key != lastKey || lastValue == null) {
                lastValue = table.get(key);
                lastKey = key;
            return lastValue;
         * Maps the specified <code>key</code> to the specified
         * <code>value</code> in this AppContext.  Neither the key nor the
         * value can be <code>null</code>.
         * <p>
         * The value can be retrieved by calling the <code>get</code> method
         * with a key that is equal to the original key.
         * @param      key     the AppContext key.
         * @param      value   the value.
         * @return     the previous value of the specified key in this
         *             AppContext, or <code>null</code> if it did not have one.
         * @exception  NullPointerException  if the key or value is
         *               <code>null</code>.
         * @see     #get(Object)
         * @since   1.2
        public synchronized Object put(Object key, Object value) {
            return table.put(key, value);
         * Removes the key (and its corresponding value) from this
         * AppContext. This method does nothing if the key is not in the
         * AppContext.
         * @param   key   the key that needs to be removed.
         * @return  the value to which the key had been mapped in this AppContext,
         *          or <code>null</code> if the key did not have a mapping.
         * @since   1.2
        public synchronized Object remove(Object key) {
            return table.remove(key);
         * Returns a string representation of this AppContext.
         * @since   1.2
        public String toString() {
            Object securityContext = nullSecurityContext;
            SecurityManager sm = System.getSecurityManager();
            if (sm != null) {
                Object context =
                    System.getSecurityManager().getSecurityContext();
                if (context != null) {
                    securityContext = context;
            String contextName = (securityContext.equals(nullSecurityContext) ?
                "null" : securityContext.toString());
         return getClass().getName() + "[SecurityContext=" + contextName + "]";
    }

  • How to ... Generate PDF from BexWAD Application with company Logo in header

    Hi all profis,
    I read many theories (on-line help, sdn forum, google) about creating a PDF document with pictures, logos, texts and so on, but in each of them is some "...but, limitations, only if ..."
    The easiest way, I guess is to create a BexWAD Application with item "REPORT" and "ANALYSIS ITEM".
    In REPORT - a crystal report page, is saved company logo with text
    ANALYSIS item includes data
    Via Export (into PDF) those both items has to be exported. The only topic is, how to repeat the report item on each page of a PDF document? There is a possibility to repeat column names, but not a company logos as a header.
    I will ask in general -> Does someone has a solution, how to export data from SAP BI into PDF including  Logo and Text(Company Adress) in header (which will repeat on each page) ??
    Thank you very much for any purposes. As answer I prefer a concrete suggestions, not links to on-line help.
    Have a nice day.
    Standa

    I have another idea to create a PDF file with company logo and hierarchical structure of data.
    Via Report designer, it is not possible to display data in hierarchical structure, but it is possible to add logo (picture) into header.
    Via WADWeb Application designer, it is possible to display data with a hierarchy, but a logo is not shown on each page.
    Via InformationBroadcaster, there is a possibility to add into header a free text. There is an option <PR_ONLINE_LINK> . Can I create another element (new, own one), which will contain a picture? How can I edit this element <PR_ONLINE_LINK> ? Would it be possible to add there a picture?
    Thank you
    Standa

Maybe you are looking for

  • Adobe Photoshop CC 2014 no 3d menu

    I have photoshop cc 2014 and I cant find a 3d option. it snot greyed out, I just cant find it. Somebody knows what the problem is? I have a HP EliteBook 8540w with a Nvidia Quadro FX 880m GPU. This is my system info: Adobe Photoshop Version: 2014.1.0

  • How can I delete old web site designs from Muse CC 2014.1. (13 Aug. 2014)?

    Having recently installed the latest update to Muse and been obliged to re-name my web site file I thought it only appropriate to clean up the desktop.  In DW there is a message window where a site can be deleted but I do not see a similiar method in

  • InDesign CS3 index crash/quit

    We have a file that was originally created using InDesign CS3 on OS X with an index but it's now crashing: if any of the index text is amended/deleted it crashes and quits. Even trying to delete the actual index pages does the same. The file won't op

  • Remove certain movies from Front Row

    Hi guys! I appreciate any advice or guidance on the issue; thank you in advance. I have my movies in iTunes; they play fine in FR. A good chunk of them have terrible resolution from being compressed over and over with bad setting choices, mainly digi

  • Pasting Into Successive Keyframes

    I like to keep my timelines compact, so I often have several graphics in a single layer. Let's imagine that I have a series of five keyframes, with four shapes in each one. Over the course of those five keyframes, one of the four shapes changes into