Dialog updates database... refresh Main panel?

ref: JDev 3.1
Given an application that has a Master/Detail Form with details in a gridcontrol, and a button that kicks up a dialog panel that allows the user to edit extensively a row that appears in the said gridcontrol...
How does one force a refresh of the underlaying rowset in the original panel ( and force a redisplay into the grid control to reflect the updated data )?
I'm trying to avoid instantiating the rowset as a passed parameter to the dialog and then manually pushing everything back on the main panel...
Or am I ( again ) conceptually missing some significant approach to solving this task?
TIA

OK... here's some (working) sample code for an application based on Brian's help to Ali's session question, that also answers my question. Probably obvious to many, it may be helpful to newbies like me who are very confused reading the postings and trying to figure this stuff out.
It shares a rowset between a frame and a dialog box. The data is kept in synch (automagically) as things change in the dialog box.
Steps:
1. Build a database connection class
2. Put it in the application before opening the base frame.
3. Build the frame/dialog. DO NOT specify a sessioninfo/rowsetinfo using the infoproducer drag/drops.
4. Manually hardcode the sessioninfo/rowset stuff manually as noted.
Note also that session info is not passed nor published except once.
This seems to work. Please advise if you know of any glaring flaws. I wouldn't be surprised. Obviously, this is easier to actually do when you see the sample code than what it sounds like reading the postings! TIA.
public class Application1
public Application1()
/** call the generic database connections **/
/** Note that this is a simple class that used the IDE **/
/** to define a sessioninfo and rowset using drag and drop **/
/** in the DESIGN mode to the Structure pane... then edit the attributes **/
dbConnections x = new dbConnections();
/** THEN open the frame **/
Frame1 frame = new Frame1();
frame.show();
public static void main(String[] args)
new Application1();
package package2;
import oracle.dacf.dataset.*;
import oracle.dacf.dataset.connections.*;
public class dbConnections extends Object
SessionInfo sessionInfo3 = new SessionInfo();
RowSetInfo rowSetInfo3 = new RowSetInfo();
AttributeInfo ACTION_CODErowSetInfo3 = new AttributeInfo(java.sql.Types.VARCHAR);
AttributeInfo ACTION_TEXTrowSetInfo3 = new AttributeInfo(java.sql.Types.VARCHAR);
public dbConnections()
try
jbInit();
sessionInfo3.publishSession();
catch (Exception e)
e.printStackTrace();
private void jbInit() throws Exception
ACTION_TEXTrowSetInfo3.setName("ACTION_TEXT");
ACTION_CODErowSetInfo3.setName("ACTION_CODE");
rowSetInfo3.setAttributeInfo( new AttributeInfo[] {
ACTION_CODErowSetInfo3,
ACTION_TEXTrowSetInfo3} );
sessionInfo3.setAppModuleInfo(new PackageInfo("", "MyProject3"));
sessionInfo3.setConnectionInfo(new LocalConnection("qms"));
sessionInfo3.setName("sessionInfo3");
rowSetInfo3.setQueryInfo(new QueryInfo(
"rowSetInfo3ViewUsage",
"package2.ActionCodes",
"action_code, action_text",
"action_codes",
null,
null
rowSetInfo3.setSession(sessionInfo3);
rowSetInfo3.setName("rowSetInfo3");
package package2;
import javax.swing.*;
import java.awt.*;
import oracle.dacf.control.swing.*;
import oracle.jdeveloper.layout.*;
import oracle.dacf.dataset.*;
import java.awt.event.*;
public class Frame1 extends JFrame
JPanel jPanel1 = new JPanel();
GridControl gridControl1 = new GridControl();
XYLayout xYLayout1 = new XYLayout();
XYLayout xYLayout2 = new XYLayout();
JButton jButton1 = new JButton();
public Frame1()
super();
try
jbInit();
catch (Exception e)
e.printStackTrace();
private void jbInit() throws Exception
this.getContentPane().setLayout(xYLayout2);
this.setSize(new Dimension(517, 549));
jButton1.setText("Detail");
jButton1.addActionListener(new java.awt.event.ActionListener()
public void actionPerformed(ActionEvent e)
jButton1_actionPerformed(e);
gridControl1.setLayout(xYLayout1);
this.getContentPane().add(jPanel1, new XYConstraints(0, 0, 508, 284));
jPanel1.add(gridControl1, null);
this.getContentPane().add(jButton1, new XYConstraints(219, 268, -1, -1));
/** manually typed this in **/
gridControl1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3");
void jButton1_actionPerformed(ActionEvent e)
Dialog1 myDialog = new Dialog1();
myDialog.show();
package package2;
import javax.swing.*;
import java.awt.Frame;
import java.awt.BorderLayout;
import oracle.jdeveloper.layout.*;
import oracle.dacf.control.swing.*;
import oracle.dacf.dataset.*;
public class Dialog1 extends JDialog
JPanel jPanel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
TextFieldControl textFieldControl1 = new TextFieldControl();
NavigationBar navigationBar1 = new NavigationBar();
TextFieldControl textFieldControl2 = new TextFieldControl();
public Dialog1(Frame parent, String title, boolean modal)
super(parent, title, modal);
try
jbInit();
pack();
catch (Exception e)
e.printStackTrace();
public Dialog1()
this(null, "", false);
private void jbInit() throws Exception
jPanel1.setLayout(xYLayout1);
getContentPane().add(jPanel1);
jPanel1.add(textFieldControl1, new XYConstraints(89, 125, 234, -1));
jPanel1.add(navigationBar1, new XYConstraints(99, 314, -1, -1));
jPanel1.add(textFieldControl2, new XYConstraints(89, 158, 236, -1));
/** Manually typed the following in **/
textFieldControl1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3/ACTION_CODE");
textFieldControl2.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3/ACTION_TEXT");
navigationBar1.setDataItemName("infobus:/oracle/sessionInfo3/rowSetInfo3");
null

Similar Messages

  • How to update/refresh main panel's image displays inside subvi?

    Hi everyone,
    I have a image display control located in my main panel,  and I have a subvi which do some process works inside it.
    but what I have done inside the subvi can not be seen in the main panel.
    I used image session controls as the input/outpout nodes for subvi.
    If I use image display control as input node for subvi,
    I can see the realtime displays in the subvi's panel,
    but this is not waht I wanted.
    anyone have good idea?
    Solved!
    Go to Solution.

    Reall sorry, i have attached 8.6 version.
    Also, I think the answer of Andrey_Dmitriev is what you are looking for. I think I understand your problem now. My example updates the image only after subVI is executed.
    Regards,
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
    Attachments:
    mainVI_1.vi ‏36 KB
    mainVI_2.vi ‏36 KB
    subVI_sobel.vi ‏9 KB

  • Saving parameters entered in a gui dialog to be used in the main panel

    Hi,
    I'm having a nightmare at the moment.
    I've finished creating a program for my final year project, that is all comand line at the moment.
    i'm required to design a GUI for this. i've started already and have a main panel that has a few buttons one of which is a setParameters button. which opens up a file dialog that allows the user to enter parameters that will be used by the main panel later on.
    I'm having trouble imagining how these parameters will be accessed by the main Panel once they are saved.
    At the moment, without the GUI i have get and set methods in my main program which works fine. Is this the kind of thing i'll be using for this?
    my code for the parameters dialog
    public class Parameters  extends JDialog
         private GridLayout grid1, grid2, grid3;
         JButton ok, cancel;
            public Parameters()
                    setTitle( "Parameters" );
                    setSize( 400,500 );
                    setDefaultCloseOperation( DISPOSE_ON_CLOSE );
              grid1 = new GridLayout(7,2);
              grid2 = new GridLayout(1,2);
                    JPanel topPanel = new JPanel();
                    topPanel.setLayout(grid1);
              JPanel buttonPanel = new JPanel();
                    buttonPanel.setLayout(grid2);
              ok = new JButton("OK");
                  ok.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                  //when pressed i want to save the parameters that the user has entered
              //and be able to access these in the RunPanel class
              cancel = new JButton("Cancel");
                 cancel.addActionListener(new ActionListener() {
                          public void actionPerformed(ActionEvent e) {
                        //when pressed just want the Jdialog  to close
              buttonPanel.add(ok);
              buttonPanel.add(cancel);
              JTextArea affinityThresholdScalar = new JTextArea();
              JTextArea clonalRate = new JTextArea();
              JTextArea stimulationValue = new JTextArea();
              JTextArea totalResources = new JTextArea();
              JLabel aTSLabel = new JLabel("affinityThresholdScalar");
              JLabel cRLabel = new JLabel("clonalRate");
              topPanel.add(aTSLabel);
              topPanel.add(affinityThresholdScalar);
              topPanel.add(cRLabel);
              topPanel.add(clonalRate);
                    Container container = getContentPane();//.add( topPanel );
              container.add( topPanel, BorderLayout.CENTER );
              container.add( buttonPanel, BorderLayout.SOUTH );
         }the main panel class is:
    public class RunPanel extends JPanel implements ActionListener
         JButton openButton, setParametersButton, saveButton;
         static private final String newline = "\n";
         JTextArea log;
             JFileChooser fc;
         Data d = new Data();
         Normalise rf = new Normalise();
         Parameters param = new Parameters();
        public RunPanel()
            super(new BorderLayout());
            log = new JTextArea(5,20);
            log.setMargin(new Insets(5,5,5,5));
            log.setEditable(false);
            JScrollPane logScrollPane = new JScrollPane(log);
            fc = new JFileChooser();
            openButton = new JButton("Open a File...")
            openButton.addActionListener(this);
         setParametersButton = new JButton("Set User Parameters");
            setParametersButton.addActionListener(this);
         saveButton = new JButton("save");
            saveButton.addActionListener(this);
            JPanel buttonPanel = new JPanel(); //use FlowLayout
            buttonPanel.add(openButton);
         buttonPanel.add(setParametersButton);
         JPanel savePanel = new JPanel();
         savePanel.add(saveButton);
            add(buttonPanel, BorderLayout.PAGE_START);
            add(logScrollPane, BorderLayout.CENTER);
         add(savePanel, BorderLayout.SOUTH);
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() == openButton) {
                int returnVal = fc.showOpenDialog(RunPanel.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    log.append("Opening: " + file.getName() + "." + newline);
              Vector data = d.readFile(file);
              log.append("Reading file into Vector " +data+ "." + newline);
              Vector dataNormalised = rf.normalise(data);
             else {
                    log.append("Open command cancelled by user." + newline);
                log.setCaretPosition(log.getDocument().getLength());
         else if (e.getSource() == saveButton) {
                int returnVal = fc.showSaveDialog(RunPanel.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    log.append("Saving: " + file.getName() + "." + newline);
                } else {
                    log.append("Save command cancelled by user." + newline);
                log.setCaretPosition(log.getDocument().getLength());
         else
              if (e.getSource() == setParametersButton)
                    log.append("loser." + newline);
                          param.show();
        private static void createAndShowGUI() {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("AIRS");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JComponent newContentPane = new RunPanel();
            newContentPane.setOpaque(true);
            frame.setContentPane(newContentPane);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }Can anybody offer any suggestions?
    Cheers

    What you need is my ParamDialog. I think it could be perfect for this sort of thing. There are a few references in it to some of my other classes namely
    StandardDialog. Which you can find by searching for other posts on this forum. But if you'd rather not find that you could just use JDialog instead
    WindowUtils.visualize() this is just a helper method for getting things visualized on the screen. You can just use setBounds and setVisible and you'll be fine.
    You are welcome to use and modify this code but please don't change the package or take credit for it as your own work.
    If you need to bring up a filedialog or a color chooser you will need to make some modifications. If you do this, would you mind posting that when you are done so that myself and others can use it? :)
    StandardDialog.java
    ================
    package tjacobs.ui;
    import java.awt.Dialog;
    import java.awt.Frame;
    import java.awt.GraphicsConfiguration;
    import java.awt.HeadlessException;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    import java.awt.*;
    import java.util.HashMap;
    import java.util.Properties;
    /** Usage:
    * *      ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
    * pd.pack();
    * pd.setVisible(true);
    * Properties p = pd.getProperties();
    public class ParamDialog extends StandardDialog {
         public static final String SECRET = "(SECRET)";
         String[] fields;
         HashMap<String, JTextField> mValues = new HashMap<String, JTextField>();
         public ParamDialog(String[] fields) throws HeadlessException {
              this(null, fields);
         public ParamDialog(JFrame owner, String[] fields) {
              super(owner);
              setModal(true);
              this.fields = fields;
              JPanel main = new JPanel();
              main.setLayout(new GridLayout(fields.length, 1));
              for (int i = 0; i < fields.length; i++) {
                   JPanel con = new JPanel(new FlowLayout());
                   main.add(con);
                   JTextField tf;
                   if (fields.endsWith(SECRET)) {
                        con.add(new JLabel(fields[i].substring(0, fields[i].length() - SECRET.length())));
                        tf = new JPasswordField();
                   else {
                        con.add(new JLabel(fields[i]));
                        tf = new JTextField();
                   tf.setColumns(12);
                   con.add(tf);
                   mValues.put(fields[i], tf);
              this.setMainContent(main);
         public boolean showApplyButton() {
              return false;
         public void apply() {
         private boolean mCancel = false;
         public void cancel() {
              mCancel = true;
              super.cancel();
         public Properties getProperties() {
              if (mCancel) return null;
              Properties p = new Properties();
              for (int i = 0; i < fields.length; i++) {
                   p.put(fields[i], mValues.get(fields[i]).getText());
              return p;
         public static void main (String[] args) {
              ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
              WindowUtilities.visualize(pd);     
         public static Properties getProperties(String[] fields) {
              ParamDialog pd = new ParamDialog(fields);
              WindowUtilities.visualize(pd);
              return pd.getProperties();          

  • Help needed in refreshing a panel in my window.

    I have some problem in refreshing a panel of a window.
    Here I am writting the sample code bellow.
    My program contains 2 classes, one is "Test" other is "Testwindow".
    class Test contains main(),displays the buttons reading from the string array obtained by listing a directory in my local file system through the panel p2 .If I click "Add" button in Test, class Testwindow's constructor is called & "Testwindow" is visible, which has a textfield. If you enter a string in the textfield, that string will be stored as a file in the same directory that the 1st window use. here I choose "C:\\temp" of my filesystem as the directory.
    My requirement is:
    when I enter a string in the textfield of Testwindow, then after clicking "Finish" button, that inputted string should be added to the panel p2 of 1st window(Test)during runtime.It means the panel p2 should be refreshed reading from the "C:\\temp" as soon as a new button is added to temp directory during runtime.
    If any of you have idea over this,please help sending me the updated version of the code given below.
    Regards.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Test extends JFrame
         JPanel p1,p2;
         JButton b1,bdir[];
         File f;
         String s[];
         int n,nmax;
         public Test()
              super("Test");
              JPanel con=(JPanel)getContentPane();
              con.setLayout(new BorderLayout());
              addWindowListener(new WindowAdapter(){
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              p1=new JPanel();
              p2=new JPanel();
              p2.setLayout(new GridLayout(nmax,1));
              b1=new JButton("Add");
              b1.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e)
                        if(e.getActionCommand()=="Add")
                             new Testwindow();
              p1.add(b1);
              f=new File("c:\\temp");
              s=f.list();
              n=s.length;
              nmax=n+20;
              bdir=new JButton[n];
              for(int i=0; i<n; i++)
                   bdir=new JButton(s[i]);
                   bdir[i].setHorizontalAlignment(AbstractButton.LEADING);
                   p2.add(bdir[i]);
              int hor=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
              int ver=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
              JScrollPane jsp=new JScrollPane(p2,hor,ver);
              con.add(p1,"North");
              con.add(jsp,"Center");
              setSize(250,300);
         public static void main(String arg[])
              Test frame=new Test();
              frame.setVisible(true);
    class Testwindow extends JFrame implements ActionListener
         JPanel p1,p2,p3;
         JLabel l1;
         JTextField tf1;
         JButton b1,b2;
         String s1, sdir[];
         public Testwindow()
              setTitle("Testwindow");
              Container con=getContentPane();
              con.setLayout(new BorderLayout());
              p1=new JPanel();
              p1.setLayout(new GridLayout(1,2));
              p2=new JPanel();
              l1=new JLabel("Enter a string: ");
              tf1=new JTextField();
              b1=new JButton("Finish");
              b1.addActionListener(this);
              p1.add(l1);
              p1.add(tf1);
              p2.add(b1);
              con.add(p1,"North");
              con.add(p2, "South");
              setSize(300,150);
              show();
         public void actionPerformed(ActionEvent e)
              if(e.getActionCommand()=="Finish"){
                   try{
                        s1=tf1.getText();
                        File id_name=new File("C:\\temp\\"+s1+".txt");
                        FileOutputStream out=new FileOutputStream(id_name);
                        out.close();
                   catch(IOException x)
                        System.out.println("Exception caught"+x);
                   this.setVisible(false);

    You have 2 JFrame's: Test and TestWindow
    In order for TestWindow to send messages to Test it needs a reference of Test. Therefor write in TestWindow this:private Test parentFrame;
    public void setParentFrame (Test t)
      parentFrame = t;
    }... then after create an instance of TestWindow in Test call this method like this:...
    TestWindow tw = new TestWindow ();
    tw.setParentFrame (this);
    ...Next, in Test create a method that will be called when a string is inputted:public void sendString (String s)
      //update the panel or whatever
    }call this method when the user clicks on a button or whatever in TestWindow:parentFrame.sendString (s);greetz,
    Stijn

  • Help needed in refreshing a panel in  a JFrame.

    I have some problem in refreshing a panel of a window.
    Here I am writting the sample code bellow.
    My program contains 2 classes, one is "Test" other is "Testwindow".
    class Test contains main(),displays the buttons reading from the string array obtained by listing a directory in my local file system through the panel p2 .If I click "Add" button in Test, class Testwindow's constructor is called & "Testwindow" is visible, which has a textfield. If you enter a string in the textfield, that string will be stored as a file in the same directory that the 1st window use. here I choose "C:\\temp" of my filesystem as the directory.
    My requirement is:
    when I enter a string in the textfield of Testwindow, then after clicking "Finish" button, that inputted string should be added to the panel p2 of 1st window(Test)during runtime.It means the panel p2 should be refreshed reading from the "C:\\temp" as soon as a new button is added to temp directory during runtime.
    If any of you have idea over this,please help sending me the updated version of the code given below.
    Regards.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Test extends JFrame
    JPanel p1,p2;
    JButton b1,bdir[];
    File f;
    String s[];
    int n,nmax;
    public Test()
    super("Test");
    JPanel con=(JPanel)getContentPane();
    con.setLayout(new BorderLayout());
    addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e)
    System.exit(0);
    p1=new JPanel();
    p2=new JPanel();
    p2.setLayout(new GridLayout(nmax,1));
    b1=new JButton("Add");
    b1.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e)
    if(e.getActionCommand()=="Add")
    new Testwindow();
    p1.add(b1);
    f=new File("c:\\temp");
    s=f.list();
    n=s.length;
    nmax=n+20;
    bdir=new JButton[n];
    for(int i=0; i<n; i++)
    bdir=new JButton(s);
    bdir.setHorizontalAlignment(AbstractButton.LEADING);
    p2.add(bdir);
    int hor=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
    int ver=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    JScrollPane jsp=new JScrollPane(p2,hor,ver);
    con.add(p1,"North");
    con.add(jsp,"Center");
    setSize(250,300);
    public static void main(String arg[])
    Test frame=new Test();
    frame.setVisible(true);
    class Testwindow extends JFrame implements ActionListener
    JPanel p1,p2,p3;
    JLabel l1;
    JTextField tf1;
    JButton b1,b2;
    String s1, sdir[];
    public Testwindow()
    setTitle("Testwindow");
    Container con=getContentPane();
    con.setLayout(new BorderLayout());
    p1=new JPanel();
    p1.setLayout(new GridLayout(1,2));
    p2=new JPanel();
    l1=new JLabel("Enter a string: ");
    tf1=new JTextField();
    b1=new JButton("Finish");
    b1.addActionListener(this);
    p1.add(l1);
    p1.add(tf1);
    p2.add(b1);
    con.add(p1,"North");
    con.add(p2, "South");
    setSize(300,150);
    show();
    public void actionPerformed(ActionEvent e)
    if(e.getActionCommand()=="Finish"){
    try{
    s1=tf1.getText();
    File id_name=new File("C:\\temp\\"+s1+".txt");
    FileOutputStream out=new FileOutputStream(id_name);
    out.close();
    catch(IOException x)
    System.out.println("Exception caught"+x);
    this.setVisible(false);

    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    public class test extends JFrame {
      JPanel p1, p2;
      JButton b1, bdir[];
      File f;
      String[] s;
      int n, nmax;
      public test() {
        super("Test");
        p1 = new JPanel();
        p2 = new JPanel();
        p2.setLayout(new GridLayout(nmax ,1));
        b1 = new JButton("Add");
        b1.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new Testwindow(test.this);
        p1.add(b1);
        f = new File("c:\\temp");
        s = f.list();
        n = s.length;
        nmax = n + 20;
        bdir = new JButton[n];
        for(int j = 0; j < n; j++) {
          bdir[j] = new JButton(s[j]);
          bdir[j].setHorizontalAlignment(AbstractButton.LEADING);
          p2.add(bdir[j]);
        JScrollPane jsp = new JScrollPane(p2);
        getContentPane().add(p1, "North");
        getContentPane().add(jsp, "Center");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(250,300);
        setLocation(100,100);
        setVisible(true);
       * Called by actionPerformed method in Testwindow
      public void addButton(String title) {
        JButton button = new JButton(title);
        button.setHorizontalAlignment(AbstractButton.LEADING);
        p2.add(button);
        p2.revalidate();
      public static void main(String[] args) {
        new test();
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    class Testwindow extends JFrame implements ActionListener {
      JPanel p1,p2,p3;
      JLabel label1;
      JTextField tf1;
      JButton b1,b2;
      String s1, sdir[];
      test client;
      public Testwindow(test client) {
        setTitle("Testwindow");
        this.client = client;
        p1=new JPanel();
        p1.setLayout(new GridLayout(1,2));
        p2=new JPanel();
        label1=new JLabel("Enter a string: ");
        tf1=new JTextField();
        b1=new JButton("Finish");
        b1.addActionListener(this);
        p1.add(label1);
        p1.add(tf1);
        p2.add(b1);
        getContentPane().add(p1, "North");
        getContentPane().add(p2, "South");
        setSize(300,150);
        setLocation(360,100);
        setVisible(true);
      public void actionPerformed(ActionEvent e) {
        JButton button = (JButton)e.getSource();
        if(button == b1) {
          try {
            s1=tf1.getText();
            File id_name=new File("C:\\temp\\"+s1+".txt");
            FileOutputStream out=new FileOutputStream(id_name);
            out.close();
          catch(IOException x) {
            System.out.println("Exception caught"+x);
          s1 = tf1.getText();
          client.addButton(s1);
          this.setVisible(false);
    }

  • On closing browser window i want to update database

    I an doing it by onUnload of javascript i poping up jsp and doing database transaction there . But probelm I encountered is when page is refreshed then also this script is poping up window and doing transactions which i don't want .
    Please help out this , Very Urget
    Mohan

    thanks for U reply
    But my application it is like this a person is given with login screen after login is valid i am enter in to window having 3 frames . I am updating database on login . if user closed the window by windows cross button then database status should be updated .
    Please solve this .
    And onUnload is not working in Nescape 4.7
    Mohan

  • [SOLVED] XFCE4.10 main panel and freeze problem

    Hello everyone.
    I just have upgraded to XFCE4.10 and after rebooting (as the update included also a new kernel) the main panel is double its size just like the icons. I would have included a screenshot but here is where my second problem appears.
    Whenever I try to open a window the system just freezes.
    The strange thing is that when I try random things (checking 'Appearance' to see if my Oxygen theme wasn't working anymore with 4.10 or fixing the missing 'Separator' issue for correct window display - former freezed though after clicking on 'Accept') it works but the 'real' things (opening browser - both from applications menu or xfce shortcut panel - or Thunar) do not.
    I also noted that when trying to save the 'Separator' fix when I hit the actions button to close the session I was directly just given that option instead of displaying the full menu of restart etc.
    Should I consider this a new issue or something I have to setup in 4.10 in comparison to 4.8 where it work perfectly?
    I am considering a kernel downgrade to see if it fixes the freeze issue though I doubt, if it does, it would relate to the panel size issue (or that 'only close session' allowance that I have just referred to). The reason for not having tried the downgrade yet is that the system apparently works fine as long as I do not open any window "for real", as said.
    Any suggestions?
    Last edited by root (2012-05-02 17:34:03)

    %$$& Wrote everything nicely down and got logged out xD
    Let's see how much I remember.
    First of all, right now writing from my downgraded 3.3.3-1 kernel. I didn't succeed doing the downgrade while the 3.3.4-1 was loaded thus I had to do it using the change root method. That way I also discovered the, apparent, reason for the user modules fail at startup and the freezing at the login screen I reported in #3. Somehow the system was using the 3.3.3-1 kernel (I do not know when it installed successfully) but the 3.3.4-1 headers. Most likely I made a mistake somewhere during my previous change root attempt when fixing a *new* unable to find root device that popped up then.
    As said, I have been able to downgrade using the Arch Install CD and through the change root method but received the warning,
    directory permissions differ on usr/src/linux-3.3.3-1-ARCH/
    filesystem: 700 package: 755
    after the install/downgrade of each package (linux-docs, linux-headers and linux). Should I consider this a new problem? System works fine so far thus I am not sure about this.
    Prior to successfully downgrading I tried to install the LTS kernel but wasn't successful with the 3.3.4-1 kernel loaded. Just like with the downgrade I tried using the change root method and could install it.
    But despite updating grub's menu.lst accordingly I was receiving an 'unable to find root device message' which could not be fixed through the change root method just like with the 3.3.4-1 kernel (in case of the LTS one changing the final step from mkinitcpio -p linux to mkinitcpio -p linux-lts as far as I understand it). I might give it another try installing it in this working environment later on and report back with the results.
    @ConnorBehan
    As I have just stated the user modules fail message and the login screen freeze were surely my fault but the error messages I referred to from the beginning with the 3.3.4-1 kernel were like these,
    .... = increasing numbers/disk sectors(?) (left/right)
    .... ext4_reserve_inode_write .... [ext4]
    .... ext4_reserve_inode_dirty .... [ext4]
    .... ? unix_write_space ....
    .... ? ext4_dirty_inode .... [ext4]
    .... ? ext4_dirty_inode .... [ext4]
    .... ext4_dirty_inode .... [ext4]
    .... __mark_inode_dirty ....
    .... ? mnt_clone_write ....
    .... file_update_time ....
    .... __generic_file_aio_write ....
    .... generic_file_aio_write ....
    .... ? ext4_file_mmap .... [ext4]
    .... ext4_file_write .... [ext4]
    .... ? ext4_file_mmap .... [ext4]
    .... do_sync_readv_writev ....
    .... ? security_file_permission ....
    .... ? _copy_from_user ....
    .... ? rw_verify_area ....
    .... do_readv_writev ....
    .... ? ext4_file_mmap [ext4]
    .... ? sockfd_lookup_light ....
    .... vfs_writev ....
    .... sys_writev ....
    .... sysenter_do_call ....
    @foutrelis
    You may be right with regard to the drive as it is a quite old laptop I am running Arch on. Now that you refer to the drive could the freeze/errors I reported to ConnorBehan be related to the tweaking of the vm.vfs_cache_pressure value I did?
    I am just taking a wild guess myself comparing my ide drive to your ssd one. I had never had this kind of problem prior to 3.3.4-1. Just as if this kernel could not handle my tweak anymore (value is 50 and worked fine so far).

  • Full database refresh

    Hello Gurus,
    I am need to take make full database refresh from one database to other, Can someone let me know step how to do it?
    select * from V$VERSIONBANNER                                                          
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production                          
    CORE     10.2.0.5.0     Production                                        
    TNS for HPUX: Version 10.2.0.5.0 - Production                   
    NLSRTL Version 10.2.0.5.0 - Production      

    CKPT wrote:
    jgarry wrote:
    I'm with Ed and Brendan on this. 3 main reasons:
    1. Legacy has some special requirements.
    2. Definitely want different schema names, this has saved my bacon sooo many times. Even so, people still get it wrong (including me, and I'm totally paranoid about it to begin with).
    3. There are many more copies of production than actual production, for various reasons (test, several dev, special projects, future app versions...) . We would rather have one db with many schemata than many db's, right?
    Now if we could just rename user...Agreed some extent, I can say to refresh entire database the preferred method is RMAN restore, where it can manage very easily
    how?
    1) To import again we need to create a new database
    2) Need to create all the tablespaces with same names or we can use REMAP option
    3) need to monitor entire import process,
    4) need to take care of other things like , temp utilization and all.
    5) need to perform export, Need to copy those dumpfiles, We should have enough space on mount points of both source & destinations. ;-)
    I would just caution there that you shouldn't think that because you are taking rman backups you have no need to also regularly export the db. A good backup policy includes both physical backup (rman) and logical backup of the data (export).
    If you talk with couple of schemas the preferred method is EXPDP/IMPDP, totally agreed.
    If in case of database size is huge, then better to go with RMAN to refresh database. Either DUPLICATE or manual way restore.
    as ED said, still we could have chance to test RMAN backups too. Multiple advantages.
    Let me know if I'm wrong. :)

  • Update database

    Can anyone send me a program on updating database.I am using SQL and microsoft access to create database

    Hi,
    Can anyone send me a program on updating database.I am
    using SQL and microsoft access to create databaseimport java.sql.*;
    public class Comments
    public static void main (String args[]) {
    String driverPrefixURL = "jdbc:odbc:";
    String username = "test";
    String password = "test";
    String dataSource = "mydsn";
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch (Exception e) {
    System.out.println("Failed to load JDBC/ODBC driver.");
    return;
    try {
    Connection con = DriverManager.getConnection(driverPrefixURL+dataSource, username, password);
    Statement statement = con.createStatement();
    String strSql = "Update emp set ename='newname'";
    statement.executeUpdate(strSql);
    catch (Exception e) {
    e.printStackTrace();
    Please note that you have to create datasource before executing.
    Hope this helps.
    Good Luck.
    Gayam.Srinivasa Reddy
    Developer Technical Support
    Sun Micro Sysytems
    http://www.sun.com/developers/support/

  • Error occurred while trying to refresh edit panel "SeqEdit.ba"

    I've been working on a TestStand project for a while (my first) and lately I get the following error just by clicking on a different step (and any step thereafter, even the one I was previously on):
    Error occurred while trying to refresh edit panel "SeqEdit.ba":
    Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    Closing TS seems to temporarily clear it out, but it will come back after a while.
    Can anybody help me figure out what this is?
    Thanks!

    Here are my answers to the last two posts.
    When and what were you doing when this error first appeared?
    I'm just developing an automated test, so there's a lot of going back and forth between different subsequences filling in gaps as I go.
    Does this error cause your application to crash or hang?
    Once it appears, it just continues to appear each and every time I click a different step. I can still develop, but it sure is a pain. It's faster to restart TestStand so it doesn't pop up again (hopefully).
    When you said "closing TS seems to temporarily clear it out, but it will come back after a while", could you quantify the amount of time it would take this error to occur again?
    I haven't timed it, but it seems to take several hours. I would suspect more that it's based on the number of times I'm clicking different VIs, but I have no hard evidence.
    Your error may be due to a registry error. If that is the case, I would recommend backing up your project first and then try to repair the software. You can accomplish the repair by going into Add and Remove Software from Control Panel, selecting National Instruments in the program list, choose TestStand and click on Repair. You will need to have the install CD for this.
    Ah, my favorite suggestion...
    Do the VIs specified in a LV steps take a long time to load when you click on the LV steps?
    I'm not sure what a long time to load is. The first time LabVIEW opens, it takes a while (~30 seconds). After that, the steps typically open in about a second. I sure wish I had an SSD.
    Does the error first occur when you clicking on a different LV step or the step is calling a different type of module?
    I'm working exclusively with the LabVIEW adapter and the built-in steps: mainly Wait, Additional Results, If Statements, and For Loops.
    Do the VIs have cluster parameters?  Yes.
    Are the clusters expanded when you select a different step? I had noticed that sometimes they are open and other times they aren't any more. I tried just now and after expanding a few, they all seemed to be expanded. Then I went to another subsequence that makes some of the same VI calls and they were open to begin with, then not (~5-10 VIs clicked on). I went back to the first subsequence and they were no longer open. That's interesting, but what are you looking for here?
    Does the the error occur when you are using the LabVIEW Run-Time or LabVIEW Development System?
    I am using the LabVIEW Professional Development System with the version indicated in my first post.
    Are you running any sequences when the error occurs?
    I typically run the sequence several times when debugging to make sure that the DUT responds the way I want it to. But the error has only occurred when I'm developing while clicking on a different VI after some undefined amount of time (or number of clicks).
    Is it possible for you to post the sequence with some of the VIs that reproduce the problem?  The VI block diagrams can be empty.  I would like to see what type of controls you are using. It's a decently large application so I'm not sure you want all my code and I'm not sure I'd be able to hand it over either. (DoD contract and such.) I have defined a few (3 or 4) strict type def controls that are passed as clusters within TestStand. Other than that, most of my calls are to bench-top instruments (SigGen, SpecAn, power supplies) and a PXI switch. The other is through an RS485 connection to talk to the DUT.
    One other note: This error hasn't occurred since I posted (of course, right?), but I also haven't done as much back and forth clicking of VIs. I have a hunch that it was related to the sheer number of back and forth clicks between different VIs when I was trying to get the values to be uniform among similar calls when I was setting everything up (similar parameter names in subsequences created from custom data types). I hope that helps.
    Thanks!

  • Update database from Jtable

    Hi all,
    I am trying to update database from Jtable. I added Jtable to scrollpane .
    My question is..
    after updating the Jtable..I want to save the details to database..when I click save button on my screen...how to do that? Please help me out! Thanks in advance..
    Here is the code that I wrote...
    public class VasuTest extends JFrame {
    private boolean DEBUG = true;
    Vector column_list = new Vector();
    Vector rows = new Vector();
    public VasuTest() {
    super("VasuTest");
         JToolBar toolBar = new JToolBar();
    JButton button = null;
    button = new JButton("Send Email");
    button.setToolTipText("This is the Exit button");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         System.out.println("Send Email");
    toolBar.add(button);
    button = new JButton("Save");
    button.setToolTipText("This is the Save button");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         System.out.println("Save");
    toolBar.add(button);
    button = new JButton("Exit");
    button.setToolTipText("This is the Exit button");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         System.exit(0);
    toolBar.add(button);
         JPanel ContentPane = new JPanel();
    ImageIcon i1 = new ImageIcon("Dongle.gif");
    JLabel j1 = new JLabel( i1, JLabel.CENTER);
         ContentPane.add(j1,BorderLayout.CENTER);
         setContentPane(ContentPane);
         JDBCT myModel = new JDBCT();
    String q = "select a.email_no,a.email_ln_no,b.cust_no,null customer_name,null cdate,a.batch_no,b.purch_ord_no,a.user_part_no,null part_desc,a.user_upgraded_part_no,null prod_id,a.qty,a.price,a.encrypted_sum_id,a.decrypted_sum_id,a.approval_key,a.status_cd,decode(a.status_cd,'APPROVED','true','ERROR','false','PROCESSED','true') approved,null end_cust,null sales_ord,null so_line,null sales_ord_cust,null shipment ,null sales_end_cust_name ,null shipment_line,a.note,null fromcust from upgrade_req_key_s3 a,upgrade_req_s3 b where a.email_no = b.email_no order by a.email_no,a.email_ln_no";
    myModel.setQuery();
    final Font f = new Font("SansSerif", Font.BOLD, 10);
    JTable table = new JTable(myModel);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    // Container ContentPane = getContentPane();
         int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
         int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
         JScrollPane scrollPane = new JScrollPane(table,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
         scrollPane.setPreferredSize ( new Dimension ( 770, 400 ) );
    ContentPane.add(toolBar,BorderLayout.CENTER);
    //Add the scroll pane to this window.
    ContentPane.add(scrollPane,BorderLayout.CENTER);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public class JDBCT extends AbstractTableModel {
    Vector cache; // will hold String[] objects...
    int colCount;
    int rowHeight;
    String [] headers;
    Connection db;
    Connection conn;
    Statement statement;
    String currentURL;
    // public QueryTableModel() {
    // cache = new Vector();
    // new oracle.jdbc.driver.OracleDriver();
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch (ClassNotFoundException e) {
    System.out.println(e.getMessage());
    System.exit(-1);
    String url = "jdbc:odbc:c3-erp,s3,s3";
    public String getColumnName(int i) {
         if (i == 0)      {  return      "Email No"                     ;     } else
    if (i == 1)      {  return      "Email Line No.";} else
         if (i == 2)      {  return      "Customer";} else
         if (i == 3)      {  return      "Customer Name";} else
         if (i == 4)      {  return      "Date";} else
         if (i == 5)      {  return      "Batch No";} else
         if (i == 6)      {  return      "Customer PO";} else
         if (i == 7)      {  return      "Upgrade From Part";} else
         if (i == 8)      {  return      "Part Description";} else
         if (i == 9)      {  return      "Upgrade To Part";} else
         if (i == 10)      {  return      "Product Id";} else
         if (i == 11)      {  return      "Quantity";} else
         if (i == 12)      {  return      "Price";} else
         if (i == 13)      {  return      "Encypted Sum ID";} else
         if (i == 14)      {  return      "Decrypted Serial No";} else
         if (i == 15)      {  return      "Key";} else
         if (i == 16)      {  return      "Status";} else
         if (i == 17)      {  return      "Approved";} else
         if (i == 18)      {  return      "End Customer";} else
         if (i == 19)      {  return      "Sales Order";} else
         if (i == 20)      {  return      "SO Line";} else
         if (i == 21)      {  return      "Sales Order End Customer";} else
         if (i == 22)      {  return      "Sales Order End Customer Name";} else
         if (i == 23)      {  return      "Shipment";} else
         if (i == 24)      {  return      "Shipment Line";} else
         if (i == 25)      {  return      "Errors";} else
         if (i == 26)      { return       "From"; }
         else {return headers[i-1] ;}
    public int getColumnCount() { return colCount; }
    public int getRowCount() { return cache.size(); }
    //public Class getColumnClass(int c) {
    // return getValueAt(0, c).getClass();
    // overloaded isCellEditable method so that it returns true
    // in reference to a cell being editable.
    public boolean isCellEditable(int row, int col) { return true; }
    // overloaded setValyeAt which updates the data Vector and
    // calls the fireTableRowsUpdated() to notify any listeners
    // that data has changed and they need to redraw.
    public void setValueAt(Object value, int row, int col) {
    ((String[])cache.elementAt(row))[col] = (String)value;     
         fireTableRowsUpdated(row,row);     
    public void getInfo () {
    System.out.println("Row Count is : " + cache.size());
         System.out.println("Value at 0,0 is : " + getValueAt(0,0));
    //     boolean res = isCellEditable(0,0);
    //     System.out.println("The value of the Boolean result is : " + res);
    public Object getValueAt(int row, int col) {
    return ((String[])cache.elementAt(row))[col];
    // All the real work happens here!
    // In a real application, we'd probably perform the query in a separate thread.
    public void setQuery() {
    cache = new Vector();
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection ("jdbc:odbc:c3-erp","s3","s3");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select a.email_no,a.email_ln_no,b.cust_no,null customer_name,null cdate,a.batch_no,b.purch_ord_no,a.user_part_no,null part_desc,a.user_upgraded_part_no,null prod_id,a.qty,a.price,a.encrypted_sum_id,a.decrypted_sum_id,a.approval_key,a.status_cd,decode(a.status_cd,'APPROVED','true','ERROR','false','PROCESSED','true') approved,null end_cust,null sales_ord,null so_line,null sales_ord_cust,null shipment ,null sales_end_cust_name ,null shipment_line,a.note,null fromcust from upgrade_req_key_s3 a,upgrade_req_s3 b where a.email_no = b.email_no order by a.email_no,a.email_ln_no");
    ResultSetMetaData meta = rs.getMetaData();
    colCount = meta.getColumnCount();
    String[] record = new String[27];      
    // Now we must rebuild the headers array with the new column name
    headers = new String[27];
    for (int h=0; h < 27; h++) {
    // headers[h-1] = meta.getColumnName(h);
         headers[h] = getColumnName(h);
    // and file the cache with the record from our query. This would
    // be practical if we were expecting a few million records to our
    // response query, but we are not so we can do this.
    while(rs.next()) {
         for (int i=0; i < colCount; i++) {
         record[i] = rs.getString(i + 1);
         cache.addElement(record);
         // Get the FIRST column of the table tableView
    // TableColumn column0 = table.getColumn(cache.elementAt(0));
    // Set the cell editor as non editable.
    // column0.setCellEditor(new EditableCellEditor(new JComboBox(), true));
    fireTableChanged(null); // notify everyone the we had a new table.
    catch (Exception e) {
    cache = new Vector(); // blank it out and keep going.
         e.printStackTrace();
    public static void main(String[] args) {
    VasuTest frame = new VasuTest();
    frame.pack();
    frame.setVisible(true);
    }

    When you click on the save button, you need to go through the model and retrieve the values getValueAt().
    Convert to whatever type you want since getValueAt() returns type Object and update the DB.

  • What is the exact difference between Database Cloning and Database Refresh?

    Hi,
    Can anybody tel me the exact difference between Database Cloning and Database Refresh?
    I Have some conflicts in these topics.
    Thanks
    Rajesh

    Refresh is what it says, "refresh" . You have a main site which would always have the data being inserted into it. There would be another site which would remain some where else . This site needs to be refreshed with the primary site. So you need to do export from the primary, push it to the secondary site and done!
    HTH
    Aman....

  • Apple TV does not work after trying to update software. Main light keeps blinking and on the screen shows itunes icon and a usb cable. What does that means?

    My Apple TV does not work after trying to install the new software update. The main light keeps blinking rapidly and on the screen it shows the itunes icon and a USB cable. What does that mean?

    The Apple TV is in recovery mode. Try to restore the Apple TV. Follow the link for instructions on the restore process.
    http://support.apple.com/kb/HT4367

  • Refreshing the panels when new content added?

    Hey, guys. My first post here; hope I'm not too much of a JNewbie for you. :)
    I'm getting my feet wet in Swing, working on an invoice program for work. I want it to look like a regular invoice, with fields for SKU, description, cost per unit, units, and total per line item. Right now, I have those five fields in a Jpanel that I add to the bottom of the layout.
    The problem is that I need the ability to go to File => Add New Item... and have another JPanel with those five fields add to the bottom so a 2nd item can be added to the form below the first. I tried making a function that adds them to the panel, using the same type of syntax that the generated code (using a form builder in NetBeans) did. I don't see the lines get added.
    My thought is that there is some function I need to call to redraw or refresh the panel so that the new components start drawing. However, my Great Javadoc Adventure has turned up no clues.
    Can anyone please give me a hand with making this happen, or at the least coming up with an alternate solution that will achieve similar results?
    Thanks much.
    Jaeden Stormes
    [email protected]

    I tried revalidate() , but no change.
    Here's the function I'm using to try to add the item...
    private void NewLineItem()
    javax.swing.JPanel jLine = new javax.swing.JPanel();
    jLine.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    jItemCode.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    jLine.add(jItemCode, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 110, -1));
    jCourseDelivery.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    jLine.add(jCourseDelivery, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 0, 240, -1));
    jItemQuantity.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    jLine.add(jItemQuantity, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 0, 110, -1));
    jItemRate.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    jLine.add(jItemRate, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 0, 100, -1));
    jItemAmount.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    jLine.add(jItemAmount, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 0, 100, -1));
    jLineItemSection.add(jLine);
    jLineItemSection.revalidate();
    pack();
    JLineItemSection is a JPanel inside my frame.
    Any suggestions? I think the way I am using the AbsoluteContraints is screwed up, as I'm having a lot of trouble with the layouts in general. The form editor in NetBeans (at least, the version in 3.6) needs a LOT of work.

  • Error: 1013231 Unable to update database while in readonly mode for backup

    Hi all,
    Wen im deleting the members for dimendsion , its giving error (hyperion 11.1 aso)
    Error: 1013231 Unable to update database while in readonly mode for backup , how can i solve this problem ,plz can any one help on this
    Thanks

    Has somebody set the database ready for archiving, maybe some maxl has been run and the db has not been returned from read only mode.
    Try running the following Maxl (change app.db to match your app/db)
    alter database app.db end archive;
    Cheers
    John
    http://john-goodwin.blogspot.com/

Maybe you are looking for