Linking Java panels

Hi
i cannot figure out how to link JPanels. How can i link JPanel to another JPanel when i click a JButton, i should go to another JPanel. I dont get how to set the "PATH".
Thankx
Sman

Don't know exactly what you want to do but: if you want a button in a panel ("first") be aware of another panel ("second") you have to ensure first has a reference to second.
The simple solution: create second before you create first and give first a reference to second. When the button in first is pressed, use the reference to second to do something with it.
//Code somewhere for laying out the panels and the rest of the gui
SecondPanel second = new SecondPanel();
FirstPanel first = new FirstPanel(second);
/** A panel class that can be "notified" to do something */
public class SecondPanel extends JPanel {
  public SecondPanel () {
  public void doSomething() {
    //do something here
/** A panel class with a button that "notifies" another panel when the button is pressed */
public class FirstPanel extends JPanel implements ActionListener {
  private SecondPanel secondPanel;
  private JButton button;
  public FirstPanel(SecondPanel aSecondPanel) {
    secondPanel = aSecondPanel;
    button = new JButton("Press me");
    button.addActionListener(this);
  public void actionPerformed(Actionevent ae) {
    secondPanel.doSomething();
}If you want your classes to be somewhat reusable, you probably should use some kind of abstrction (enables you to simply add "another" JPanel type instead of SecondPanel if nessecary). Below an example of accomplishing this with an interface any class can implement:
public interface Doable {
  public void doSomething();
public class SecondPanel extends JPanel implements Doable {
  public void doSomething() { ... }
public class ThirdPanel extends JPanel implements Doable {
  public void doSomething() { ... }
public class FirstPanel extends JPanel implements ActionListener {
  private Doable doable;
  private JButton button;
  public FirstPanel(Doable aDoable) {
    doable = aDoable;
    button = new JButton("Press me");
    button.addActionListener(this);
  public void actionPerformed(Actionevent ae) {
    doable.doSomething();
//Code somewhere for laying out the panels and the rest of the gui
Doable second = new SecondPanel();
Doable third = new ThirdPanel();
FirstPanel top = new FirstPanel(second);
FirstPanel bottom = new FirstPanel(third):
...

Similar Messages

  • How to save report in PersonalCategory  after creating it using java panel?

    Hi,
    Anybody knows How to save report in PersonalCategory  after creating it using java panel?
    I dont want to save it in public folder. I want to save report (webi) in user's personal category.
    can anybody send me source code?
    It will help me a lot.
    Thanks in advance
    Amol Mali

    Hi teda,
    i'm assuming that you have seen my post that i did successfuly save report in user's personal category.
    Actually the report is created in webi java panel using RE SDK and  is saved in Report Sample Folder then i'm saving it in user's personal category by following code
    string query = "Select SI_PERSONAL_CATEGORIES From CI_INFOOBJECTS Where "
                         + "SI_INSTANCE=0 And SI_ID=" + reportID;
                    InfoObjects infoObjects = infoStore.Query(query);
                    InfoObject infoObject = infoObjects[1];
                    Webi wreport = (Webi)infoObject;
                    ObjectRelativeIDs personalIDs = wreport.PersonalCategories;
                /personalIDs.Add(Convert.ToInt32(categoryID));
                   infoStore.Commit(infoObjects);
    But the report is presents in the Folder also and in user's personal category also.
    I dont want the report to be in the folder (Report Sample) if i saved it in user's personal category.
    How can i do that?
    any idea.
    Please help me.
    Thanks in advance
    Amol Mali
    Edited by: amol mali on Jan 9, 2009 7:55 PM

  • Error while saving report after creating it using webi java panel?

    Hi,
    Whenever i create report through java panel & RE SDK and then try to save it i got below error
    Could not save the document to the repository for the following reason: [repo_proxy 30] InfoStore::ObjectExport::commit - (Helpers::InfoStore::ObjectExport::commit) Failed to commit objects to server :
    Invalid parent id.(hr=#0x80041e0e)(Error #-2147213810 (WIS 30567)
    Actuallly i want to  save report in User's personal category.
    For that i retrive the ID of that User's personal category then pass it to variable to save
    Code while saving
    //JavaScript
    if ("<%= strSubmit.Equals("submit")%>"=="True")
              var value = new Array();
               value[0] = "<%= strName %>"; //Given value of Report
               value[1] = "<%= strComments %>"; //Value ""
              value[2] = "<%= strkeywords %>"; //Value ""
              value[3] = "<%= strFolderId  %>"; //Value ""
              value[4] = "<%= strCategories  %>"; //Value ""
              value[5] = "<%= strPersonalCategories %>"; //Here i assign the ID of User's personal category
              value[6] = "<%= strRefreshOnOpen %>"; //Value ""
              //save the document
                window.opener.saveDocumentCall(value[0],value[1],value[2],value[3],value[4],value[5],value[6]);
                window.close();
    any help?
    Thanks in Advance
    Amol Mali

    Hi Teda,
    Thanks for the reply.
    Actually i'm setting User's PersonalCategory id to Parent ID not setting Folder ID to Parent ID.
    How can i proceed?
    Please help.
    Thanks
    Amol Mali

  • Java Panel not working

    We have BO XI R2.  When I try to create a new webi document, and after I select a universe, Infoview tries to install java each time.  I have java 1.4.04 (which it tries to install) on my system.  I have even let it uninstall java and reinstall it, but to no avail.  It just keeps coming back and saying I need to install the Java Virtual Machine.  I have tried changing my systems PATH settings, but that does not help.  I can run the HTML panel with no trouble, but would rather use the java panel.  Does anyone have any suggestions?  Thanks.
    David

    Hi,
    The first time when you create a report, it would install the Java, and by default it would be Java 1.4.
    You won't be prompted the next time, when you create the reports, and this is normal behavior.
      You can check the java version which your browser is using by going in to the tools Sun Java Console.
    The installation is needed only when you do not have proper java version for WebI.
    -Shreyash

  • Advice please: how to link java client with oracle AS

    Dear Sirs...
    how can i link java swing application with oracle application server? do i have to develop web service and then deploy it on the AS? or i should use another methodology? what exactly should i provide or should i use?
    thanks for any help
    best regards

    There are a number of approaches you can take. A webservice would work well. You may also consider using EJBs and calling them via RMI or a webservice.
    Either is a viable option depending on your requirements.

  • Show  flash in a java panel

    How can show a flash in Java Panel ?
    mail: [email protected]

    You could see if a flash Java type componet exists, with the Magic Of Google.
    Or you could embed the default Web Browser with JDIC.
    no emails, tis a forum

  • Linking Java to Access Database tables

    Hello,
    I need use JCreator to link Java to Access Database tables.
    Could any one tell me what kind of drivers I need use?
    Also, where could I find the examples of linking Java to Access Database tables?
    Thank you,
    Daniel

    Thanks.
    I have read the tutorial and downloaded the sample code from the web http://java.sun.com/docs/books/tutorial/jdbc/
    In the CreateCoffee.java programming, I made the following changes:
         //     String url = "jdbc:mySubprotocol:myDataSource";
              String url = "jdbc:odbc:DB1";
    DB1 is an Access Database file located in the same folder as CreateCoffee.java.
    //Class.forName("myDriver.ClassName");
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Every time when I run the CreateCoffee.java programming, it shows the following running error:
    SQLException:[Microsoft][ODBC Driver Manager]
    Data source name not found and no default driver specified.
    Could any one have any suggestions for solving the above problem?
    Thank you,
    Daniel

  • Portal 7.0 Hide Links on Panel

    Hello experts,
    I'd like to know how I can hide the links on Panel of Portal 7.0
    I know the propriety of iView for close the Panel:
    Initial State of Navigation Panel == CLOSE
    But in my case I just want to hide the links.
    Take a look the image bellow for you understand this better:
    http://img833.imageshack.us/img833/6686/helpportal.jpg
    Cheers,
    []´

    Firstly, Thanks everyone for the attention !!
    I tried to do this.. but this did not work!!
    When I set the property Invisible in Navigation Areas on the iView, then whole page goes empty !!
    The iView is like than:
    [http://img231.imageshack.us/img231/7168/helpportal10.png]
    I'd like to do something like this:
    [http://img709.imageshack.us/img709/5694/helpportal11.jpg]
    Edited by: Tulio Vargas on Aug 16, 2010 4:53 PM
    Edited by: Tulio Vargas on Aug 16, 2010 4:55 PM

  • Link to panel on seperate page

    Hello:
    I am trying to link from my menu bar to a specific panel on a different page.  I attempted to use this where hc_menu is my anchor to the specific panel (4) and heartlandcafe.html is the page.
    <a href="HeartlandCafe.html#hc_menu" onclick="TabbedPanels2.showPanel(4); return false;"> Menu</a>  
    The link will bring me to the site, but wont open my specific panel.
    I saw a thread with my exact question leading to this site: http://labs.adobe.com/technologies/spry/samples/utils/URLUtilsSample.html  but could not understand what I was supposed to do.  Can someone provide a translation?  I would greatly appreciate it!
    Thanks,
    Matt

    Hi Matt,
    change
    <a href="HeartlandCafe.html#hc_menu" onclick="TabbedPanels2.showPanel(4); return false;"> Menu</a>
    to
    <a href="HeartlandCafe.html?panel=4> Menu</a>
    Then in the new page add
    <script src="SpryAssets/spryURLUtils.js" type="text/javascript"></script>
    to the <head> section and add
    <script type="text/javascript">
    <!--
    //The defaultTab value checks to see if the url param is defined. If it is not, it sets it to 0.
    var TabbedPanels2 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab:(params.panel ? params.panel : 0)});
    //-->
    </script>
    to just above </body>
    For further info go to
    http://labs.adobe.com/technologies/spry/samples/utils/URLUtilsSample.html?panel=3#examples
    I hope this helps.
    Ben

  • Hide some types of links in Panel Links.

    Is it possible to add a filter on a list of links (Links Panel)?
    I add an observer on kDocBoss.
    In the Update function, I do not know how to retrieve the contents of the list  (kLinksListWidgetID) to hide some types of links.
    Do you have some ideas.
    Best Regards,
    Badr NASSER

    Hi,
    I tried the same code. I am getting the following error. Could anyone help me how to solve this error?
    Error(74,1): class OAGlobalButtonBarBean not found in class XXX.oracle.apps.po.requisition.webui.CustomPageCO
    I am new to OAF. Looking for some help.
    Thanks
    Edited by: 803923 on Oct 25, 2010 11:10 AM

  • Linking FileInfo Panel to an Illustrator Script

    I've got an Illustrator script (Javascript) that writes XMP based on the content of the artwork, but the script has to be manually triggered. I've got a custom FileInfo panel (built with Flex/AS3) to help me edit the XMP once stored.
    I'd like to combine the two, so the Script fires whenever the FileInfo panel opens.
    I can't do the DOM scripting directly in AS3, can I? I think that Illustrator is only open to Javascript, VB, and AppleScript. Please correct me if I'm wrong.
    Does anyone have any ideas how to call the javascript in the Scripts folder from an event in the FileInfo panel's SWF, and pass arguements back and forth? I've seen it done on webpages, but only when both the SWF  and javascript are on the same HTML page.
    Thanks

    Thanks Carlos, this led me in the right direction, but not quite far enough.
    I found Zac's Cookbook on jsxInterface, but it isn't working for me. I've set up the project linking the SWCs as directed by the SDK (csaw, apedelta, etc.), but when I use his code, I get error 1120 access of undefined property error.
    I think I've imported all of the classes that I need. I'm thinking that I might have the javacript in the wrong folder of my project (although I've tried it in several, its in the src folder of the project with the mxml file), or that the javascript itself isn't valid (I've checked that it is).
    Any ideas what I'm missing to make this work?
    Thanks,
    Alex
    import com.adobe.csawlib.*;
    import com.adobe.illustrator.Application;
    [Embed (source= "myScript.jsx" , mimeType= "application/octet-stream" )]
    private static var myScriptClass:Class;
    var jsxInterface:HostObject = HostObject.getRoot(HostObject.extensions[0]);
    jsxInterface.eval(new myScriptClass().toString())

  • Linking Java Api

    I wish to make my java documentation linked to the java 1.5.0 documentation.
    I am using Javadoc 1.5.0 I also use IE6.0
    The command line has this option:
    -link http://java.sun.com/j2se/1.5.0/docs/api
    This should make the Java Classes linked by reference to my javadocs for my code.
    When I click on one of these links I get an error: "Permision Denied..<the url of the Java Api Class Doc>" followed by a "access denied.. <the url of the Java Api Class Doc>"
    Looks like there is some javascript or something preventing this from functioning properly. I put http://java.sun.com/ in my trusted sites list. Lowered security to a min. No effect.
    I searched for a post on the forum like this. There doesn't appear to be one. If there is a post, I apologize in advance. Hopefully someone can help me.

    You may want to check your show() calls and see if
    they can be replaced with setVisible(). Forexample,
    in your Vowelm code, you have a static JFrame v.
    At
    the end of your main function, you use v.show().As
    of JDK1.1, this has been deprecated in favour of
    setVisible(boolean).hey show() in JFrame is from Window and in windowits
    not deprecated ..
    show is not decrecated thats for sure ... i dontknow
    y you said that ...
    you can look in docs as well..
    True - but this in turn overrides show() from
    java.awt.Component, which has been deprecated. My
    guess is that's where the problem comes from.
    Thanks for the Dukes!
    FlicAnd then again - perhaps not. After looking into this a bit more, I take back my last comment about the Component override. However, as I said in my original reply, compiling with -deprecation should tell you which show() call is flagging the error. There is definitely one somewhere that the JVM doesn't like - without seeing your complete code, it's hard to say exactly where. Based on what you've posted, my guess is that it is within the Vowelm class.
    Next time, I'll try to avoid 'shooting from the hip'.
    Again, thanks for the Dukes,
    Flic

  • Linking java programs to spreadsheets

    I am trying to write a program that accepts numeric input and generates four different sets of numeric data. I want to link the program to Microsoft Excel so that as the program generates the numbers, it automatically populates the cells of an Excel spreadsheet. Also I want the program and the spreadsheet to be linked in such a way that changes in the values generated in the source program due to changes in input, are reflected in the cells of the spreadsheet.
    I am using the jdk1.1.1 on a Windows 98 machine.

    JIntegra also provide a COM-Java bridge that will allow you to do something like this.
    I didn't find that any COM bridges were very successful in the end, though, since there didn't seem to be a means of differentiating between various instances of Excel that might be open (Office assumes that the first instance should always be used). For simple applications a COM bridge should prove alright, though.

  • How to integrate Explorer in a Java panel

    Hello. I beg your pardon if I'm asking something that has already been asked... I'm new in this forum. My question is simple... I'd like to put an internet explorer in my java applications... How can I get it?
    sorry for my bad english :)
    Marcus

    Your English is fine.
    Yes, this question has been asked and answered many times on this forum.
    Look left... see the "Search Forums" control?... Type "embedded browser" in the textbox below it, and then press the >> button.
    Top of the list is: http://forum.java.sun.com/thread.jspa?forumID=54&threadID=5221210
    Cheers. Keith.

  • WIJ20002 error in webi java panel

    Hi All,
    One of user trying to create a report on universe but when trying to run query, user facing WIJ20002 error.
    The web intelligence can not connect to the server please contact your administrator, but her colleague not facing any error with same configurations.
    User using Java 1.6.45 & internet explorer is 9 – 9.0.8112.16421CO, OS is windows 7 64 bit.
    I was re installed java also but had no luck.
    I'm attaching complete error message can any one help me please.

    Hi,
    According the InfoView URL in the screen shut that contains "enterprise115", it seems that you have Business Objects XIR2 and you said "User using Java 1.6.45 & internet explorer is 9 – 9.0.8112".
    Check out the XIR2 SP6 Support Platform Guide, the supported IE browser is IE7 with Sun 1.6.0_02+.
    Hope this helps,
    Jin-Chong

Maybe you are looking for