How to open a JPanel

Hi
I have created a JPanel in JDeveloper 10.1.3. It has a main method with (see below) but when opened from my application I must use something else than JUTestFrame but what? How should the JPanel be opened the right way?
public static void main(String [] args) {
try {
UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
} catch (ClassNotFoundException cnfe) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception exemp) {
exemp.printStackTrace();
} catch (Exception exemp) {
exemp.printStackTrace();
CurrencyRateEdit panel = new CurrencyRateEdit();
panel.setBindingContext(JUTestFrame.startTestFrame("mypackage.DataBindings.cpx", "null", panel, panel.getPanelBinding(), new Dimension(400,300)));
panel.revalidate();
}

Thanks for the input, unfortunately using the JFrame provided by the JDev wizard is what we are trying to avoid. We do not want a JFrame of any kind.
I have it working now with a JPanel as the top level container for the ADF plumbing. This allows me to place the ADF bindings virtually anywhere without any type of boarders. Here is how I did it. (by the way I am still testing out Erik's recommendation)
1) create a default application with an empty runable panel. (the main() can be moved out later but makes it easy for testing) The code here assumes you are using all the default naming in the wizard. If not you will have to make the appropriate changes.
2) Just under the class definition create an instance of a class named "appPanel". This class will be defined below and is a gutted/modified version of JUTestFrame which extends JPanel instead of JFrame. It should look something like this:
public class Panel1 extends JPanel implements JUPanel {       
public appPanel canvas = new appPanel();
3) In the main() function change
panel.setBindingContext(JUTestFrame.startTestFrame( ...
to:
panel.setBindingContext(panel.canvas.startTestFrame( ... //canvas is the name I chose in step 2.
4) If, in this test app, you don't already have a container (JForm or other) for the ADF JPanel you can create one for testing like this:
At the bottom of the main() function put :
JFrame xx = new JFrame();
xx.add(panel);
xx.setVisible(true);
5) Create the class file appPanel (menu: new >simple file > Java Class. and replace all of the contents with: (excuse the formatting. I don't know why they don't make developer forums more code friendly)
package mypackage;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;
import java.beans.PropertyVetoException;
import javax.swing.JPanel;
import javax.swing.JInternalFrame;
import javax.swing.JScrollPane;
import java.util.HashMap;
import oracle.jbo.uicli.UIMessageBundle;
import oracle.jbo.uicli.jui.JUPanelBinding;
import oracle.jbo.uicli.jui.JUEnvInfoProvider;
import oracle.jbo.uicli.controls.JUErrorHandlerDlg;
import oracle.jbo.uicli.controls.JClientPanel;
import oracle.jbo.uicli.binding.JUApplication;
import oracle.jbo.uicli.mom.JUMetaObjectManager;
import oracle.adf.model.BindingContext;
import oracle.adf.model.DataControlFactory;
import oracle.adf.model.binding.DCDataControl;
import oracle.jbo.uicli.controls.*;
public class appPanel extends JPanel
private JUPanelBinding panelBinding = null;
private DCDataControl dataControl;
private BindingContext mCtx;
appPanel frame;
public appPanel() {
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
public BindingContext startTestFrame(String cpxName, String dcName, JPanel panel, JUPanelBinding panelBinding, Dimension size)
if (!(panel instanceof JUPanel))
System.err.println(UIMessageBundle.getResString(UIMessageBundle.STR_TUI_ERROR_JCLIENTPANEL));
return null;
frame = new appPanel(cpxName, dcName, panelBinding, panel);
frame.adjustFrameSize(size);
return frame.getBindingContext();
public appPanel(JUPanelBinding designTimePanelBinding, JPanel panel)
this.setLayout(new GridLayout());
JScrollPane scPane = new JScrollPane(panel);
this.add(scPane);
JUMetaObjectManager.setBaseErrorHandler(new JUErrorHandlerDlg());
//mom will pass properties in case it's null
JUApplication app = JUMetaObjectManager.createApplicationObject(designTimePanelBinding.getApplicationName(), null, new JUEnvInfoProvider());
panelBinding = new JUPanelBinding(designTimePanelBinding.getApplicationName(), panel);
panelBinding.setApplication(app);
((JClientPanel)panel).setPanelBinding(panelBinding);
panelBinding.execute();
dataControl = app;
public appPanel(String cpxName, String dcName, JUPanelBinding panelBinding, JPanel panel)
this.setLayout(new GridLayout());
JScrollPane scPane = new JScrollPane(panel);
this.add(scPane);
createBindingCtxAndSetUpMenu(cpxName, dcName, panelBinding);
private void createBindingCtxAndSetUpMenu(String cpxName, String dcName, JUPanelBinding panelBinding)
JUMetaObjectManager.setBaseErrorHandler(new JUErrorHandlerDlg());
JUMetaObjectManager.getJUMom().setJClientDefFactory(null);
mCtx = new BindingContext();
HashMap map = new HashMap(4);
map.put(DataControlFactory.APP_PARAMS_BINDING_CONTEXT, mCtx);
JUMetaObjectManager.loadCpx(cpxName, map);
DCDataControl app = (DCDataControl)mCtx.get(dcName);
if (app != null)
dataControl = app;
app.setClientApp(DCDataControl.JCLIENT);
else
mCtx.setClientAppType(DCDataControl.JCLIENT);
panelBinding = panelBinding.setup(mCtx, null);
public DCDataControl getDataControl()
return dataControl;
public BindingContext getBindingContext()
return mCtx;
void adjustFrameSize(Dimension size)
setSize(size);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
if (size.height > screenSize.height)
size.height = screenSize.height;
if (size.width > screenSize.width)
size.width = screenSize.width;
setLocation((screenSize.width - size.width) / 2, (screenSize.height - size.height) / 2);
setVisible(true);
private static final char MNEMONICINDICATOR = '&';
public static final int MNEMONIC_INDEX_NONE = -1;
* Returns the key code for the mnemonic in the string. Returns
* VK_UNDEFINED if the string does not contain a mnemonic.
public int getMnemonicKeyCode(String string)
if (string == null)
return KeyEvent.VK_UNDEFINED;
// Minus one, because a trailing ampersand doesn't count
int lengthMinusOne = string.length() - 1;
int i = 0; // Index in the source sting
while (i < lengthMinusOne)
int index = string.indexOf(_MNEMONIC_INDICATOR, i);
// Are we at the end of the string?
if ((index == -1) || (index >= lengthMinusOne))
break;
char ch = string.charAt(index + 1);
// if this isn't a double ampersand, return
if (ch != MNEMONICINDICATOR)
// VK_* constants are all for upper case characters
return(int) Character.toUpperCase(ch);
// Skip over the double ampersand
i = index + 2;
return KeyEvent.VK_UNDEFINED;
* Removes non-displayable inline mnemonic characters.
* In order to specify a mnemonic character in a translatable string
* (eg. in a resource file), a special character is used to indicate which
* character in the string should be treated as the mnemonic. This method
* assumes that an ampersand ('&') character is used as the mnemonic
* indicator, and removes (single) ampersands from the input string. A
* double ampersand sequence is used to indicate that an ampersand should
* actually appear in the output stream, in which case one of the ampersands
* is removed.
* Clients should call this method after calling
* StringUtils.getMnemonicIndex() and before displaying the string. The
* returned string should be used in place of the input string when
* displaying the string to the end user. The returned string may be the
* same as the input string if no mnemonic indicator characters are found,
* but this is not guaranteed.
* @see #getMnemonicIndex
public String stripMnemonic(String string)
if (string == null)
return null;
int length = string.length();
// Single character (or empty) strings can't have a mnemonic
if (length <= 1)
return string;
StringBuffer buffer = null;
int i = 0;
while (i < length)
int index = string.indexOf(_MNEMONIC_INDICATOR, i);
// We've reached the append. Append the rest of the
// string to the buffer, if one exists, then exit
if ((index < 0) || (index >= length - 1))
if (buffer != null)
buffer.append(string.substring(i));
break;
if (buffer == null)
// If the string starts with an ampersand, but not a double
// ampersand, then we just want to return
// stripMnemonic(string.substring(1)). This is basically
// what we do here, only I've optimized the tail recursion away.
if ((index == 0) && (string.charAt(1) != MNEMONICINDICATOR))
string = string.substring(1);
length--;
continue;
else
// Allocate the buffer. We can reserve only space
// (length - 1), because, by now, we know there's at least
// 1 ampersand
buffer = new StringBuffer(length - 1);
// Append the bits of the string before the ampersand
buffer.append(string.substring(i, index));
// And append the character after the ampersand
buffer.append(string.charAt(index + 1));
// And skip to after that character
i = index + 2;
// If we never allocated a buffer, then there's no mnemonic
// at all, and we can just return the whole string
if (buffer == null)
return string;
return new String(buffer);
private void jbInit() throws Exception {
And now you have an ADF implementation that exists purely in a JPanel to be placed anywhere.
Again I am still testing Erik's recomendation which may prove to be a better implementation; but I wanted to share what I have working.
I hope this helps someone out. Good luck.
SMartel

Similar Messages

  • How to open a new window from the login window?

    hi,
    can someone tell me how to open a new window from an existing window, here by window i mean frame. The case is i hv two java files - oracle.java and FDoptions.java. The first frame is in the Login.java. The oracle.java file has a button "Login", when it is clicked, i want to open the next frame which is in the file FDoptions.java. Can some one help me with this? I m giving the code below -
    oracle.java
    import java.awt.BorderLayout;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    * The application's main frame.
    public class oracle {
        private JFrame frame;
        private JPanel logInPanel;
        private JButton clearButton;
        private JButton logInButton;
        private JButton newuserButton;
        private JButton forgotpasswordButton;
        private JTextField userNameTextField;
        private JPasswordField passwordTextField;
        public oracle() {
            initComponents();
        private final void initComponents() {
            JLabel userNameLabel = new JLabel("User name: ");
            JLabel passwordLabel = new JLabel("Password: ");
            userNameTextField = new JTextField();
            passwordTextField = new JPasswordField();
            JPanel userInputPanel = new JPanel(new GridLayout(2, 2, 5, 5));
            userInputPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 20));
            userInputPanel.add(userNameLabel);
            userInputPanel.add(userNameTextField);
            userInputPanel.add(passwordLabel);
            userInputPanel.add(passwordTextField);
            logInButton = new JButton(new LogInAction());
            clearButton = new JButton(new ClearAction());
            newuserButton = new JButton(new NewUserAction());
            forgotpasswordButton = new JButton(new ForgotPassword());
            JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            JPanel buttonPanel1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
            buttonPanel.add(logInButton);
            buttonPanel.add(clearButton);
            buttonPanel1.add(newuserButton);
            buttonPanel1.add(forgotpasswordButton);
            logInPanel = new JPanel(new BorderLayout());
            logInPanel.add(userInputPanel, BorderLayout.NORTH);
            logInPanel.add(buttonPanel, BorderLayout.CENTER);
            logInPanel.add(buttonPanel1,BorderLayout.SOUTH);
            frame = new JFrame("FD Tracker");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(500, 500);
            frame.setContentPane(logInPanel);
            frame.pack();
            frame.setVisible(true);
        private void performLogIn() {
            // Log in the user
            System.out.println("Username: " + userNameTextField.getText());
            char[] password = passwordTextField.getPassword();
            System.out.print("Password: ");
            for(char c : password) {
                System.out.print(c);
            System.out.println();
        private void performClear() {
            // Clear the panel
            System.out.println("Clearing the panel");
            userNameTextField.setText("");
            passwordTextField.setText("");
        private final class LogInAction extends AbstractAction {
            public LogInAction() {
                super("Log in");
            @Override
            public void actionPerformed(ActionEvent e) {
                performLogIn();
        private final class ClearAction extends AbstractAction {
            public ClearAction() {
                super("Clear");
            @Override
            public void actionPerformed(ActionEvent e) {
                performClear();
        private final class NewUserAction extends AbstractAction{
             public NewUserAction(){
                 super("New User");
             @Override
             public void actionPerformed(ActionEvent e){
                 JFrame newuser = new JFrame("NewUser");
        private final class ForgotPassword extends AbstractAction{
            public ForgotPassword(){
                super("Forgot Password");
            @Override
            public void actionPerformed(ActionEvent e){
                JFrame forgotpassword = new JFrame("Forgot Password");
        public static void main(String args[]) {
            new oracle();
         FDoptions.java
    import java.awt.FlowLayout;
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.BorderFactory;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class Fdoptions{
        private JFrame fdoptions;
        private JPanel fdoptpanel;
        private JButton enterfdbutton;
        private JButton viewfdbutton;
        public Fdoptions() {
            initComponents();
        private final void initComponents(){
            fdoptpanel = new JPanel(new BorderLayout());
            fdoptpanel.setBorder(BorderFactory.createEmptyBorder(80,50,80,50));
            enterfdbutton = new JButton(new EnterFDAction());
            viewfdbutton = new JButton(new ViewFDAction());
           JPanel enterbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
           JPanel viewbuttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
            enterbuttonpanel.add(enterfdbutton);
            viewbuttonpanel.add(viewfdbutton);
            fdoptpanel.add(enterbuttonpanel,BorderLayout.NORTH);
            fdoptpanel.add(viewbuttonpanel,BorderLayout.SOUTH);
            fdoptions = new JFrame("FD Options");
            fdoptions.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            fdoptions.setSize(1000,1000);
            fdoptions.setContentPane(fdoptpanel);
            fdoptions.pack();
            fdoptions.setVisible(true);
        private void performEnter(){
        private void performView(){
        private final class EnterFDAction extends AbstractAction{
            public EnterFDAction(){
                super("Enter new FD");
            public void actionPerformed(ActionEvent e){
                performEnter();
        private final class ViewFDAction extends AbstractAction{
            public ViewFDAction(){
                super("View an existing FD");
            public void actionPerformed(ActionEvent e){
                performView();
        public static void main(String args[]){
            new Fdoptions();
    }

    nice day,
    these lines..., despite the fact that this example is about something else, shows you two ways
    1/ modal JDialog
    2/ two JFrame
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * Parent Modal Dialog. When in modal mode, this dialog
    * will block inputs to the "parent Window" but will
    * allow events to other components
    * @see javax.swing.JDialog
    public class PMDialog extends JDialog {
        private static final long serialVersionUID = 1L;
        protected boolean modal = false;
        private WindowAdapter parentWindowListener;
        private Window owner;
        private JFrame blockedFrame = new JFrame("No blocked frame");
        private JFrame noBlockedFrame = new JFrame("Blocked Frame");
        public PMDialog() {
            noBlockedFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            noBlockedFrame.getContentPane().add(new JButton(new AbstractAction("Test button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    System.out.println("Non blocked button pushed");
                    blockedFrame.setVisible(true);
                    noBlockedFrame.setVisible(false);
            noBlockedFrame.setSize(200, 200);
            noBlockedFrame.setVisible(true);
            blockedFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
            blockedFrame.getContentPane().add(new JButton(new AbstractAction("Test Button") {
                private static final long serialVersionUID = 1L;
                @Override
                public void actionPerformed(ActionEvent evt) {
                    final PMDialog pmd = new PMDialog(blockedFrame, "Partial Modal Dialog", true);
                    pmd.setSize(200, 100);
                    pmd.setLocationRelativeTo(blockedFrame);
                    pmd.getContentPane().add(new JButton(new AbstractAction("Test button") {
                        private static final long serialVersionUID = 1L;
                        @Override
                        public void actionPerformed(ActionEvent evt) {
                            System.out.println("Blocked button pushed");
                            pmd.setVisible(false);
                            blockedFrame.setVisible(false);
                            noBlockedFrame.setVisible(true);
                    pmd.setVisible(true);
                    System.out.println("Returned from Dialog");
            blockedFrame.setSize(200, 200);
            blockedFrame.setLocation(300, 0);
            blockedFrame.setVisible(false);
        public PMDialog(Dialog parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        public PMDialog(Frame parent, String title, boolean isModal) {
            super(parent, title, false);
            initDialog(parent, title, isModal);
        private void initDialog(Window parent, String title, boolean isModal) {
            owner = parent;
            modal = isModal;
            parentWindowListener = new WindowAdapter() {
                @Override
                public void windowActivated(WindowEvent e) {
                    if (isVisible()) {
                        System.out.println("Dialog.getFocusBack()");
                        getFocusBack();
        private void getFocusBack() {
            Toolkit.getDefaultToolkit().beep();
            super.setVisible(false);
            super.pack();
            super.setLocationRelativeTo(owner);
            super.setVisible(true);
            //super.toFront();
        @Override
        public void dispose() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.dispose();
        @Override
        @SuppressWarnings("deprecation")
        public void hide() {
            owner.setEnabled(true);
            owner.setFocusableWindowState(true);
            super.hide();
        @Override
        public void setVisible(boolean visible) {
            boolean blockParent = (visible && modal);
            owner.setEnabled(!blockParent);
            owner.setFocusableWindowState(!blockParent);
            super.setVisible(visible);
            if (blockParent) {
                System.out.println("Adding listener to parent ...");
                owner.addWindowListener(parentWindowListener);
                try {
                    if (SwingUtilities.isEventDispatchThread()) {
                        System.out.println("EventDispatchThread");
                        EventQueue theQueue = getToolkit().getSystemEventQueue();
                        while (isVisible()) {
                            AWTEvent event = theQueue.getNextEvent();
                            Object src = event.getSource();
                            if (event instanceof ActiveEvent) {
                                ((ActiveEvent) event).dispatch();
                            } else if (src instanceof Component) {
                                ((Component) src).dispatchEvent(event);
                    } else {
                        System.out.println("OUTSIDE EventDispatchThread");
                        synchronized (getTreeLock()) {
                            while (isVisible()) {
                                try {
                                    getTreeLock().wait();
                                } catch (InterruptedException e) {
                                    break;
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("Error from EDT ... : " + ex);
            } else {
                System.out.println("Removing listener from parent ...");
                owner.removeWindowListener(parentWindowListener);
                owner.setEnabled(true);
                owner.setFocusableWindowState(true);
        @Override
        public void setModal(boolean modal) {
            this.modal = modal;
        public static void main(String args[]) {
            new PMDialog();
    }

  • How to open and closed posting period??

    Dear Gurus,
    Pls help me, how to open and closed posting period.when and how we used special period.
    Regrds
    Mahesh

    HI,
    Tcode is ob52
    here we generally provide the following details
    a/c type from a/c to a/c from period year to period year from period year to period
    +                                    1            2007   12         2007      13       2007   16
    + implies it applicable to all account types
    generally we can have maximum 4 special periods and total no of periods(normal+special) should not exceed 16
    generally we use special periods for year end adjustments like tax adjustments
    if it is useful assign me points

  • Help, how to open and display blobs from tables

    Dear all,
    I am trying to store ms-word files on a table using a blob column.
    Does anyone how to open the files and display them from a form using 9iAS?
    Thank you.
    Carlos.

    And there may be, but you won't likely find that here. Do some time searching Google and maybe you'll find code that someone was nice enough to make freely available, although I wouldn't count on it. Were i a programmer and took the time to read those docs and write the code, I'd want to be paid for my time. But there are a lot of programmers who swear by freeware! You may get lucky.

  • How to open a specific file in projector.

    Hi to all
    can any body tells me that how to open a specific file in
    projector with an application not in browser????
    and also want to add a button to mute the sound just like in
    intros with fade in and out effect.
    its urgent....
    Thanks in advance

    Hi,
    You can use FlashJester JStart
    http://jstart.flashjester.com
    that will open up any file the has been associated in Window
    Explorer.
    Download a FREE evaluation copy and try it for yourself.
    Please look at the example files given.
    Regards
    FlashJester Support Team
    e. - [email protected]
    w. -
    http://www.flashjester.com
    There is a very fine line between "hobby" and
    "mental illness."

  • Reporting Services - How to open a second table inside report, for each number of client (each apears in first table)

    Reporting Services - How to open a second table inside report, for each number of client (each apears in first table)?
    Exemple:
    Table1
    Cliente name:
    John
    Client number:
    12345
    Survay number of negative answers:
    3
    Table2
    Questions and answers that were negative:
    Question: How much time where you waiting
    Avaluation: 3 (from 1 to 10)
    Answer: They only called me 1 mouth later
    Can you please help me?

    Hi,
    Based on the description, I understand that you want to add subreport in the main report. When previewing the main report, the subreport can be shown in detail. Please see the screenshots on my test:
    In Reporting Services, we can create parameters and pass them from main report to subreport in order to control the data dynamically.
    References:
    Subreports (Report Builder and SSRS)
    Add a Subreport and Parameters (Report Builder and SSRS)
    If I have any misunderstanding, please feel free to contact me.
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

  • How to make a JPanel selectable

    When extending a JPanel and overriding the paintComponent() method the custom JPanel can not be selected so that it gets for example KeyEvents.
    But if I make the new Class extend a JButton it gets of course selected and able to receive for example KeyEvents.
    My question is therefore; what does the JButton implement that a JPanel doesn&#8217;t so that a JButton gets selectable? Or in other words; how to make a JPanel selectable?
    Aleksander.

    Try this extended code. Only the first panel added can get the Focus.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Test extends JFrame
      public Test()
        setLocation(400,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel panel1 = new JPanel(new BorderLayout());
        JPanel panel2 = new JPanel(new BorderLayout());
        ImagePanel imgPanel = new ImagePanel();
        panel1.setFocusable(true);
        panel2.setFocusable(true);
        panel1.setPreferredSize(new Dimension(0, 50));
        panel2.setPreferredSize(new Dimension(0, 50));
        panel1.setBorder(BorderFactory.createLineBorder(Color.RED,     4));
        panel2.setBorder(BorderFactory.createLineBorder(Color.CYAN,    4));
        imgPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 4));
        panel1.add(new JLabel("Panel 1"), BorderLayout.CENTER);
        panel2.add(new JLabel("Panel 2"), BorderLayout.CENTER);
        getContentPane().add(panel1, BorderLayout.NORTH);
        getContentPane().add(panel2, BorderLayout.SOUTH);
        getContentPane().add(imgPanel, BorderLayout.CENTER);   
        pack();
        panel1.addKeyListener(new KeyAdapter(){
            public void keyPressed(KeyEvent ke){
                System.out.println("Panel1");}});
        panel2.addKeyListener(new KeyAdapter(){
            public void keyPressed(KeyEvent ke){
                System.out.println("Panel2");}});
      public static void main(String[] args){new Test().setVisible(true);}
    class ImagePanel extends JPanel
      Image img;
      public ImagePanel()
        setFocusable(true);
        setPreferredSize(new Dimension(400,300));
        try{img = javax.imageio.ImageIO.read(new java.net.URL(getClass().getResource("Test.gif"), "Test.gif"));}
        catch(Exception e){/*handled in paintComponent()*/}
        addKeyListener(new KeyAdapter(){
          public void keyPressed(KeyEvent ke){
            System.out.println("ImagePanel");}});
      public void paintComponent(Graphics g)
        if(img != null)
          g.drawImage(img, 0,0,this.getWidth(),this.getHeight(),this);
        else
          g.drawString("This space for rent",50,50);
    }

  • How to open new window and generate oracle report from apex

    Hi,
    I had created an application that generates PDF files using Oracle Reports, following this Guide.
    http://www.oracle.com/technology/products/database/application_express/howtos/howto_integrate_oracle_reports.html
    And I followed 'Advanced Technique', so that users can't generate PDF file by changing URL and parameters. This is done for security reasons.
    But in this tutorial, when 'Go' button is pressed, the PDF file is displayed on the same window of apex application. If so, user might close the window by mistake. In order to avoid this, another window have to be opened.
    So, I put this code in the BRANCH - URL Target. (Note that this is not in Optional URL Redirect in the button property, but the branch which is called by the button.)
    javascript:popupURL('&REPORTS_URL.quotation&P2100_REP_JOB_ID.')
    But if the button is pressed, I get this error.
    ERR-1777: Page 2100 provided no page to branch to. Please report this error to your application administrator.
    Restart Application
    If I put the code 'javascritpt ....' in the Optional URL Redirect, another window opens successfully, but the Process to generate report job is not executed.
    Does anyone know how to open new window from the Branch in this case?

    G'day Shohei,
    Try putting your javascript into your plsql process using the htp.p(); procedure.
    For example, something along these lines should do it:
    BEGIN
    -- Your other process code goes here...
    htp.p('<script type="javascript/text">');
    htp.p('popupURL("&REPORTS_URL.quotation&P2100_REP_JOB_ID.")');
    htp.p('</script>');
    END;
    What happens is the javascript is browser based whereas your plsql process is server based and so if you put the javascript into your button item Optional URL Redirect it is executed prior to getting to the page plsql process and therefore it will never execute the process. When you have it in your branch which normally follows the processes, control has been handed to the server and the javascript cannot be executed and so your page throws the error "Page 2100 provided no page to branch to"... By "seeding" the plsql process with the embedded javascript in the htp.p() procedure you can achieve the desired result. You could also have it as a separate process also as long as it is sequenced correctly to follow your other process.
    HTH
    Cheers,
    Mike

  • How to open a new window from submit button &dialog page in current window?

    We have a requirement, wherein we have a OAF search page for PO lines with search criteria, Go button to search ,result region (table layout) and a submit button(Create new expedite).
    1. Now user can select some lines from result region and click on Submit button.
    2. On click of submit button we need to pop up a window or may be a dialog page asking that " Do you want open supplier web link portal or not?".
    3. If user clicks yes(in Dialog page) then first fetch the URL from a look up maintained in Oracle EBS on the basis of supplier of the lines selected and then open that URL in a new window and side by side we need to open a dialog page in search page asking "whether user has updated the expedite info in supplier portal or not?". On basis of this we need to updated some count in custom tables.
    So in step 3 i am facing problem, that how to open an URL in a new window through a submit button and side by side want to open a dialog page in the current window also.
    Hope a quick response from you all.
    Note:- To open a custom page we can have a link or button(button of type button and not submit button) on base page with destination url property as following javascript:
    javascript:var a = window.open('OA.jsp?page=/XXX/oracle/apps/xxx/......&retainAM=Y', 'a','height=500,width=900,status=yes,toolbar=no,menubar=no,location=no'); a.focus();
    So the question is how to do the same for submit button on OAF page???

    Antriksh,
    You just need to attach a submit action in button bean and not submit button bean, based on the output of confirm type of alert in javascript.
    Here is code u need to put in destination url of the button:
    //replace <confirm message> by message you want to show.
    javascript:input=confirm('<confirm message>');if(input==true){submitForm('DefaultFormName',0,{XXX:' abc'});}" Now in the process request of the base page CO, u can get parametre 'XXX' from the pagecontext....so
    if((("abc").equals(pageContext.getParameter("XXX"))))
    {/// custom LOGIC }
    The same i have replied in your mail. I hope this resolves the issue.
    --Mukul

  • I am getting this error message when trying to get to a college webpage Firefox doesn't know how to open this address, because the protocol (html) isn't associated with any program.

    I am trying to get to a college webpage for information and get this error message from firefox Firefox doesn't know how to open this address, because the protocol (html) isn't associated with any program.
    == This happened ==
    Every time Firefox opened
    == whe trying to access webpage

    Is this coming from a link, or from something you are trying to type in the address bar?
    Try replacing the "html" at the start with "http",
    so if you have html://somesite.edu,
    change it to http://somesite.edu.

  • How to open and read data from text file in PL/SQL

    We have a project ,need to open a file containing entries of data
    ,then process those data records one by one to update the
    database.This operation shoulbe be done in the database
    enviroment. Is there any hint about the file operation in
    PL/SQL? How to open the file and get one record ,maybe one line,
    and parse and get the data field ?
    thanks
    defang

    There was also a question on this over at AskTom
    (asktom.oracle.com) about a week ago complete with sample code.
    The pointer to the sample code is here:
    <A HREF="http://asktom.oracle.com/pls/ask/f?
    p=4950:8:::::F4950_P8_DISPLAYID:464420312302
    TARGET=_blank>http://asktom.oracle.com/pls/ask/f?
    p=4950:8:::::F4950_P8_DISPLAYID:464420312302</A>
    Admittedly it's about Win95, but the principles should apply.
    Yours faithfully, Graham Reeds.
    [email protected] | http://omnieng.co.uk/

  • How to open and close posting period for both material  , n invoicing

    HI
    how to open and close posting period for both material  , n invoicing , AM NEW TO SD , SO ALL DOUBTS I DO POST IN HERE PLEASE DONT MIND

    Hi Sunaina
    Period Open T.code: MMP1
    Period Close T-Code: MMPV
    Automate the opening of MM periods 
    How can you automate the monthly opening of MM periods (transaction MMPV - program RMMMPERI) with 
    SM36?
    RMMMPERI accepts a period/year or a date.
    If you enter a date the period is derived by it.
    1. create a variant and check the attribute 'selection variable' for the parameter date. Then click the button 'Selection variables' and set the current date. Every time this variant is used the parameter DATE is filled with the current date.
    2. create a job for RMMMPERI with the variant created in the preceding step. Set it as periodic.
    If you're not using a fiscal year variant simply schedule it as monthly (to be executed the first day of the month).
    If you are using a fiscal year variant you'd have to define a calendar with only the first day of each period defined as working 
    day and use it in the periodicity restrictions.
    Another possibility:
    Write a very simple ABAP which run daily to check if the period has changed and submit RMMMPERI.
    Reward if useful to u

  • How to open front panel of a VI running in RT.

    Hi,
    I have an application to read the encoder position using the cRIO program. I have made an executable and this application runs as startup application whenever the controller reboots. Right now, i am accessing the VI of the startup exe through Remote Panel connection. This works fine but everytime i close the remote panel , i have to reboot the controller for the next view.
    So is there any alterntaive to open the front panel of the VI.
    I tried using VIServer but ran into errors. (i tried using front panel -open property node.did not work)
    Also i do not have any VIs stored on the controller. Only the exe is stored on the ni-rt/startup folder on the RT controller.
    Please let me know how to open this VI.
    Thanks.

    Hi Ben,
    When i close the remote front panel the first time, i am terminating the RT VI which is running on startup.
    So i had to reboot everytime to access the remote VI.  I guess that the VI (exe) should be continuosly running when the RT is started up. The remote panel only should be opened and closed. After I close the remote panel , i want a windows VI to be opened up.
    I have a Windows VI which programmatically opens connection to the RT server for opening the remote panel. The VI runs. When the user clicks Exit on this RT VI, the VI running is stopped and then another windows VI opens up. This works fine for first time. Since the RT VI is terminated, second time , if I run, it says, VI not in server memory.
    Is there a method to close the remote panel programmatically in the RT VI itself. I have a Exit button in this RT VI, so if the user clicks, Exit, the program has to be running, but the remote panel has to close. There is a method called close connection to client , but this does not work in RT , as this requires VI path.. Right now , when the remote panel RT VI is launced, to close the remote panel, i click on the 'close' button on the VI title bar. Again when the remote panel is launched, there is no error. but is there a method to close the remote panel in the server(RT VI itself).   i have attached the VI.
    Thank you.
    Attachments:
    Dummytest.vi ‏39 KB

  • How to Open & Close the periods in Asset Accounting for Depreciation.

    Dear All,
    How to to How to Open & Close the periods in Asset Accounting for Depreciation ? Please let me know
    If there is any T.Code or procedure for it.
    Your help is highly appreciated.
    Thanks & Regards,
    Pankaj.

    Dear Alex ,
    1) I am facing one problem that one of my asset 123 I Capitalized on 13.09.2006 have deactivated on
    14.05.2008. with value of Rs.1.00.000/- all the activities are closed down related it on deactivation date.
    In 2009 a new asset 456 purchased with different value. But in T.code OARP in column cumulative acquisition
    value it is showing value of Asset 123 instead of it's own capitalization value.
    2 ) And about my Asset 123 it is also showing a Cumulative Acquisition value in year 2009 which it
    should not display because I have already deactivated that asset. ( The same checked in AR03 )
    Please help.
    Your help is highly appreciated.
    Regards,
    Pankaj.
    P.S :- Keep the discussion on for further assistance.

  • How to open and save PDF from web?

    I can't see how to open a PDF in adobe from safari

    This should help:
    http://forums.adobe.com/docs/DOC-2532

Maybe you are looking for

  • Clunky movie

    I'm having trouble with a .mov clip and quick time. I drag the movie out of the SD card into a movie folder. When I open it, it starts playing in quick time. When I plug in the SD card, iPhoto opens up too, same problem there. The movie just chugs al

  • Verizon Prepaid Questions - Different From AT&T?

    I am currently a prepaid customer with AT. I'm also an avid forumer on their website, and I "specialize" in their prepaid offerings and services. I have had Verizon prepaid and postpaid services in the past, and I left due to the high prices and the

  • Plsql code - error

    Dear sir, I am using forms 6i and oracle 9i. I have 2 blocks Master Block_a invoice_no - database item invoice_date ( not a database column ) Search button Details Block_b invoice_no - database item invoice_date - database item My master and details

  • My mac is slowing down.  How can I speed it up?

    My computer just started running VERY slowly today.  What could be causing this and how can I clean it up to increase the speed?

  • 32 bit option does not appear

    Hi I am trying to change my 64 bit to 32 bit. I have tried going to the application get info to changed it but it does not give me this option. Is there another way to change to 32 bit. thanks