Naming a ScriptUI Main Panel

I wonder if it is possible to give a name to the main Panel of a ScriptUI so the tab of that window and the name appearing in the window menu is not "yourscriptname.jsx" ?

Don't think so, you could have a main script that you name just for that purpose and get that script to call one that sits along side it that does all the meaty work.

Similar Messages

  • 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();          

  • How can show the result of a measuring that is done in a sub-program in my main panel?

    How can show the result of a measuring that is done in a sub-program in my main panel?

    In your subvi, wire the result(s) you want to ouput to the main program to an output terminal on the connector pane.
    For a tutorial on subvi's, search the help for "connector panes" anc click on tutorial.
    ~Tim

  • Panel class not adding to main panel...

    I have a panel class that has a borderlayout which is to be nested in another panel with a borderlayout. I'm not sure what I'm doing wrong. Here is my code for the problematic classes:
    1st: Panel that needs to be added:
    public class SizePanel extends JFrame
         private JPanel sizePanel;
         private JPanel selectedSizePanel;
         private JList sizeList;
         private JScrollPane scrollPane;
         private JTextField selectedSize;
         private JLabel sizeLbl;
         private String[] sizes = {"Starter", "Standard", "Better", "Best" };
         public SizePanel()
              setLayout(new BorderLayout());
              buildSizePanel();
              buildSelectedSizePanel();
              add(sizePanel, BorderLayout.CENTER);
              add(selectedSizePanel, BorderLayout.SOUTH);
              pack();
              setVisible(false);
         private void buildSizePanel()
              sizePanel = new JPanel();
              sizeList = new JList(sizes);          
              sizeList.setSelectionMode(
                        ListSelectionModel.SINGLE_SELECTION);          
              sizeList.addListSelectionListener(
                        new ListListener());     
              sizeList.setVisibleRowCount(4);     
              scrollPane = new JScrollPane(sizeList);     
              sizePanel.add(scrollPane);
         private void buildSelectedSizePanel()
              selectedSizePanel = new JPanel();          
              sizeLbl = new JLabel("Price: ");     
              selectedSize = new JTextField(9);     
              selectedSize.setEditable(false);     
              selectedSizePanel.add(sizeLbl);
              selectedSizePanel.add(selectedSize);
         private class ListListener implements ListSelectionListener
              public void valueChanged(ListSelectionEvent e)
                   String selection = (String) sizeList.getSelectedValue();
                   selectedSize.setText(selection);
    }2nd: My code for adding it to the main panel:
    public HouseCalcGUI() {
            setTitle("McKeown's Real Estate Program");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setLayout(new BorderLayout());
            greetingPnl = new GreetingPanel();
            featuresPnl = new FeaturesPanel();
            sizePnl = new SizePanel();
            stylePnl = new StylePanel();
            buildButtonPanel();
            add(greetingPnl, BorderLayout.NORTH);
            add(stylePnl, BorderLayout.EAST);
            add(featuresPnl, BorderLayout.CENTER);
            add(sizePnl, BorderLayout.WEST);
            add(buttonPanel, BorderLayout.SOUTH);
            pack();
            setVisible(true);
        }

    Hey, guess what I just did...? BANGED MY HEAD AGAINST THE WALL. Your ingeniousness is in the form of my stupidity. Thank you though. Here are your dukes...What I did was take some sample program from my text to make my program.

  • [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).

  • Disable all the components of a panel ( panels within the main panel )

    Hi guys!
    I have a problem!
    i have to disable all the components of a panel. please note that i am also having panels within the main panel. please tell me how to do that!!!
    its urgent!!

    Hi guys!
    I have a problem!Wouldn't have figured that one out by myself ...
    its urgent!!No, it's not.
    You know, a panel is most often a subclass of Container, so all you need to do is recursively disable all child components. The methods getComponents and getComponent are very helpful when trying to access child components. Code likeif ( comp instanceof Container )
      // do soemthing
    }will help in determining whether a child component is yet another Container.

  • Access the main panel when a message popup is open

    Hi,
    I would apprecaite if someone can help me out with my current problem. Basically  i am trying to access my main panel when a messege popup is open...say i choose a file to save my data from the user panel.....after i select the fiel.....a messege pops up saying file selected or something....but i dont want to make the user press the ok button before he can do anything else on the main UAP.....is there a way i can have the popup be there but yet hv access to the stuff on the main window and later the user can press ok....basically thats popup is just t notify the user..
    Hope to hear from someone.
    Thanks
    k1_ke

    You cannot do it with popup panels: a popup is intrinsically a modal window, that is user input is confined to this window and the operator cannot access other panels in your applicatin until the popup is closed.
    You need to create a panel to display your messages and setup it as a "floating" panel: floating style is one of the additiona attributes of the panels, located in the same dialogue into which you specify if the panel is sizable, movable... A floating panel remains on top of other panels of the application but the user can operate on those other panels while the floating one is displayed (you'll need to show it with DisplayPanel instead of InstallPopup).
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • CS3 - Main panel missing!

    Hi. I installed Premiere CS3. I used it once, but the next time I tried to open a new project (with customized options) and the main panel in Premiere disappeared! I mean the panel in wich you can put the videos and the sound. What happened?
    Bye
    Giulio

    If Premiere acts funny trash your prefereces by holding shift+ctrl+alt when opening Premiere.

  • 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

  • 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

  • Parent directory on JFileChooser main panel

    Yes I did a search on the forum before posting.
    How could I display the parent directory '..' of the current directory on the file list panel of a JFileChooser? It should be selectable/clickable/openable, of course.

    Thanks camickr.
    It does barely works but problems are:
    1) A mouse selection on the parent directory [icon + text] item behaves weird at the initial launch time of the program and when we have returned back from a subsub-directory.
    2)The parent directory [icon + text] item doesn't come at the top of the file list. How to achieve this requirement?
    Here's a quick and dirty SSCCE:
    import javax.swing.*;
    import javax.swing.filechooser.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.beans.*;
    import java.io.*;
    import java.net.*;
    public class ParentFcTest{
      JFrame frame;
      JFileChooser jfc;
      JPanel contentPane, mainPanel;
      Box buttonPanel;
      JButton convButton, rescanButton;
      boolean inProgress;
      File cf; // file currently processed
      FsvWithParentDir fwp;
      FvForPd ffp;
      public ParentFcTest(){
        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jfc = new JFileChooser(".", fwp = new FsvWithParentDir());
        jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
        Component comp = jfc.getComponent(3);
        comp.setVisible(false); // hide labels, textfields, buttons etc.
        ffp = new FvForPd(fwp);
        jfc.setFileView(ffp);
        mainPanel = new JPanel(new BorderLayout());
        mainPanel.add(jfc, BorderLayout.CENTER);
        convButton = new JButton("...Select file or folder");
        buttonPanel = new Box(BoxLayout.Y_AXIS);
        JPanel p1 = new JPanel();
        p1.add(convButton);
        rescanButton = new JButton("Update file list");
        rescanButton.setBackground(new Color(200, 255, 50));
        JPanel p2 = new JPanel();
        p2.add(rescanButton);
        buttonPanel.add(p1);
        buttonPanel.add(p2);
        rescanButton.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){
            jfc.rescanCurrentDirectory();
        contentPane = (JPanel)frame.getContentPane();
        contentPane.add(mainPanel, BorderLayout.CENTER);
        contentPane.add(buttonPanel, BorderLayout.SOUTH);
        frame.pack();
        frame.setVisible(true);
        jfc.addPropertyChangeListener(new PropertyChangeListener(){
          File f;
          public void propertyChange(PropertyChangeEvent pce){
            f = jfc.getSelectedFile();
            if (f == cf){ // we need this because of #$# below
              return;
            if (inProgress){ // vv restore old selection
              jfc.setSelectedFile(cf); // #$# generates another PCE !
              JOptionPane.showMessageDialog
           (frame, "Can't select a new file while processing current file");
              return;
            if (pce.getPropertyName().equals
             (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)){ // selected
              if (f.isFile()){
                convButton.setText("Process this file");
              else if (f.isDirectory()){
                convButton.setText("Open this folder");
            else if (pce.getPropertyName().equals
             (JFileChooser.DIRECTORY_CHANGED_PROPERTY)){ // physical dir change
              convButton.setText("...Select file or folder");
        convButton.addActionListener(new Converter(jfc));
      } // constructor
      class Converter implements ActionListener{
        JFileChooser fc;
        public Converter(JFileChooser jf){
          fc = jf;
        public void actionPerformed(ActionEvent e){
          JButton btn = (JButton)e.getSource();
          if (btn.getText().startsWith("...")){ // message only, no action
            return;
          File f = fc.getSelectedFile();
          if (f.isFile()){
            inProgress = true;
            rescanButton.setEnabled(false);
            cf = f;
            convButton.setText("...please wait");
            ConvWorker cw = new ConvWorker();
            cw.execute();
          else{
            jfc.setCurrentDirectory(f);
      class ConvWorker extends SwingWorker<Object,Object>{
        public Object doInBackground(){
          return null;
        protected void done(){
          inProgress = false;
          jfc.rescanCurrentDirectory();
          convButton.setText("...Select file or folder");
          rescanButton.setEnabled(true);
      class FvForPd extends FileView{
        FsvWithParentDir fsvp;
        ImageIcon ii;
        public FvForPd(FsvWithParentDir fsv){
          fsvp = fsv;
          try{
            ii = new ImageIcon
              (new URL("http://homepage1.nifty.com/algafield/pardir.gif"));
          catch (MalformedURLException e){
            e.printStackTrace();
        public Icon getIcon(File f){
          if (f.equals(fsvp.getParent())){
            return ii;
          else{
            return super.getIcon(f);
        public String getName(File f){ // it does work but...
          if (f.equals(fsvp.getParent())){
            return ("..");
          else{
            return super.getName(f);
      public static void main(String[] args){
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new ParentFcTest();
    import java.io.*;
    import javax.swing.*;
    import javax.swing.filechooser.*;
    public class FsvWithParentDir extends FileSystemView{
      File[] filelist;
      File parent;
      public File createNewFolder(File containingDir){
        File folder = new File(containingDir, "NEWFOLDER");
        folder.mkdir();
        return folder;
      public File[] getFiles(File dir, boolean useFileHiding){
        File[] files = super.getFiles(dir, useFileHiding);
        File[] nfiles = new File[files.length + 1];
        for (int i = 1; i < nfiles.length; ++i){
          nfiles[i] = files[i - 1];
        parent = dir.getParentFile();
        if (parent != null){
          nfiles[0] = parent;
          filelist = nfiles;
        else{
          filelist = files;
        return filelist;
      public File getParent(){
        return parent;
      // this doesn't work
      public Icon getSystemIcon(File f){
        if (parent != null && f.equals(parent)){
          ImageIcon ii = new ImageIcon(getClass().getResource("/pardir.gif"));
          return ii;
        else{
          return super.getSystemIcon(f);
    }

  • Continuously update time stamp on main panel

    Hello,
    I am trying to continuously update/show the time stamp based of a fixed starting point.  I made a SubVI, to accomplish the task, however, how can I go about using this subVI into a main program?  Alternatively, how can I continuously update the timestamp on the main VI?
    Any help will be greatly appreciated.
    Thanks,
    hiNi.
    Attachments:
    Update timestamp.llb ‏25 KB

    Why you want to read time stamp from Subvi. If you’re not doing anything in subvi (except time) then there is no use. You can simply update your time in Main VI ( as per my previous post).
    Please check this VI. I hope this will help you.
    Munna
    Attachments:
    Update timestamp_MOD.llb ‏31 KB

  • Lightroom 2.4 - Won't display pictures in preview thumbnail and main panel

    I've included a picture so you get what i mean?
    I'm currently using lightroom 2.4 which i've upgraded from 2.2 (2.2 actually had this problem so i decided to bite the bullet and upgrade but it didn't help my problem). I tried creating a new catalogue, importing a new photo, syncronising the folders, optimising the catalogue and re-installing lightroom 2.4. I also restored my computer to a couple of days ago. I know it worked a couple of days ago so im not sure exactly whats happening here.
    I've opened up other photo editing programs to see if i can view the photos and yes I can.
    I know in lightroom when i go to print or web or slideshow it will show the picture but I just don't understand what i can do to resolve this problem. I tried searching on google and its driving me up the wall.
    I hope someone knows whats going on here!
    Regards
    B

    sorry Ian and kwdaves. yeah I'm using windows vista on my laptop updated to the latest Service pack (2)
    I'll have a look at that faq and having said that. for some reason it was on YCC Profiles? that may have been due to me using a pdfcreator program the other day.. I feel stupid i changed it to adobeRGB (1998) as shown in solution 2 on http://kb2.adobe.com/cps/402/kb402376.html
    thanks a lot guys. you both helped immensely and I can actually get a good nights rest.
    You guys rock
    Regards
    B

  • Handling User Events in sub panel vis and main vis with same Event reference Number.

    Hi All, Iam trying to work to handle events in both subpanel vi and main vi.
    I have a main program, and 2 sub vi. I will load the sub VI in 2 sub panels in main vi. Each sub pael vi has controls on it.
    I have created 2 User events for 2 sub panels vi. One user event consits of a Cluster with 2 Booleans (x & Y) and Other User Event consists of cluster of 2 unsigned 8 Numbers (a & b). These are created and registered in the main Vi and event register refnum is passed to the subpanel vi from the main panel vi.
    I have Event structure in main panel and sub panel vis.
    In one sub panel vi, When the value of one boolean(i.e. X) in the clusters changes, the Events structure in sub panel vi should perform some operation in sub panel vi only. When the value of other boolean (i.e. Y) changes it should perform some operation in main vi. I will try to Generate user event with the x value and Y value changed based on the control clicks in the sub panel vi.
    The OTher panel vi should behave in the smae way when the a & b value changes.
    The "Generate User Event" is working fine some times and sometimes there in no event triggered in the sub panel vi or main vi.
    Please let me know what is the problem Ramesh.

    There is a lot of talking, but not much understanding.  It'd be better if you posted some example VI's of what you are trying to do so that the words will make sense.
    One thing I can tell you is that you don't want to have two event structures handle the same event reference number.  You want to have two event registrations with each one going to its own event structure.

  • I am having trouble stopping a sub VI from the front panel of my main VI.

    Whenever I try to stop my sub VI from the main panel i cannot get it to work. It has entered the value of the switch from the main VI and does not update it within the sub VI after it has started the sub VI and hence does not look for a changed value on the switch. Is there any way that I can get the sub VI to check the state of the switch on the Main VI on each loop?
    Thanks
    Ross H

    Hi,
    I am including 3 VI programs, here main vi controls the sub vi, i mean sub vi can be stopped either from main vi or from stop button put on its front panel. Also main vi still works incase sub vi is running.
    Hope it works. If above does not answer your problem completely, Pl. do write.
    Best Regards,
    Nirmal Sharma
    India
    Attachments:
    Main_Vi.vi ‏56 KB
    sub_vi.vi ‏25 KB
    global_stop.vi ‏6 KB

Maybe you are looking for

  • MM - Pedido de Compra - Determinação de Preços por Data do Doc MIGO ou MIRO

    Olá Pessoal, Tenho uma particularidade neste momento que talvés possam me ajudar: A empresa onde trabalho atualmente recebe diariamente uma grande quantidade de materiais de compras e boa parte destes materiais possuem variação de preços mensal. Visa

  • Trouble with Mouse

    I have a logitech 570 wireless mouse and it is working great in every other program, still I did a troubleshoot on it and everything seems to be working fine. In Indesign CS5 after I have selected the text tool I cannot then select anything else.  No

  • Need flag to be deactivate at installation level

    hi all, In my case,  At installation level one flag is active, this flag is basically a service which BP opt at the time of move-in, once the BP left that premise (means Move-out) than this flag should automatically become incative. but this thing is

  • WLC 2006 LWAPP issue?

    Hi, I am setting up a WLC2006 with 2 AP1010's. I cannot get the controller to see either AP. When I place the AP's on a network with a WLC 4400, they are recogized immediately by the 4400 at Layer-2 LWAPP. Since the WLC2006 only works at Layer-3 LWAP

  • Circular Parent-Child relationship among widgets.

    I am trying to draw a Bar Graph on a panel which in turn sits on the main window. The height policy of the panel widget is set to SP_TO_PARENT so that when the window is resized the panel is also resized according to the parent window. I have a situa