JFileChooser's approve button text changes when file

I have a JFileChooser used for loading some XML file(s). We want the approve button's text to be "Load". When I bring up the dialog, the button text initially reads "Load", when I select a directory, it reads "Open", if I select a file again, it goes back to "Load". So far, so good.
The problem comes when using it in a non-English language. When I bring up the dialog, the button text initially reads the appropriately translated "Load". However, when I select a directory, it changes to the English "Open". I do not see a method to use to adjust this text. Am I missing something, or is this a bug?
Any help is greatly appreciated.
Jamie

Here's some code I'll put into the public domain:
package com.graphbuilder.desktop;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Stack;
import java.util.Vector;
import java.util.StringTokenizer;
import java.io.File;
<p>Attempt to improve the behaviour of the JFileChooser.  Anyone who has used the
the JFileChooser will probably remember that it lacks several useful features.
The following features have been added:
<ul>
<li>Double click to choose a file</li>
<li>Enter key to choose a file after typing the filename</li>
<li>Enter key to change to a different directory after typing the filename</li>
<li>Automatic rescanning of directories</li>
<li>A getSelectedFiles method that returns the correct selected files</li>
<li>Escape key cancels the dialog</li>
<li>Access to common GUI components, such as the OK and Cancel buttons</li>
<li>Removal of the useless Update and Help buttons in Motif L&F</li>
</ul>
<p>There are a lot more features that could be added to make the JFileChooser more
user friendly.  For example, a drop-down combo-box as the user is typing the name of
the file, a list of currently visited directories, user specified file filtering, etc.
<p>The look and feels supported are Metal, Window and Motif.  Each look and feel
puts the OK and Cancel buttons in different locations and unfortunately the JFileChooser
doesn't provide direct access to them.  Thus, for each look-and-feel the buttons must
be found.
<p>The following are known issues:  Rescanning doesn't work when in Motif L&F.  Some
L&Fs have components that don't become available until the user clicks a button.  For
example, the Metal L&F has a JTable but only when viewing in details mode.  The double
click to choose a file does not work in details mode.  There are probably more unknown
issues, but the changes made so far should make the JFileChooser easier to use.
public class FileChooserFixer implements ActionListener, KeyListener, MouseListener, Runnable {
     Had to make new buttons because when the original buttons are clicked
     they revert back to the original label text.  I.e. some programmer decided
     it would be a good idea to set the button text during an actionPerformed
     method.
     private JFileChooser fileChooser = null;
     private JButton okButton = new JButton("OK");
     private JButton cancelButton = new JButton("Cancel");
     private JList fileList = null;
     private JTextField filenameTextField = null;
     private ActionListener actionListener = null;
     private long rescanTime = 20000;
     public FileChooserFixer(JFileChooser fc, ActionListener a) {
          fileChooser = fc;
          actionListener = a;
          fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
          okButton.setMnemonic('O');
          cancelButton.setMnemonic('C');
          JButton oldOKButton = null;
          JButton oldCancelButton = null;
          JTextField[] textField = getTextFields(fc);
          JButton[] button = getButtons(fc);
          JList[] list = getLists(fc);
          String laf = javax.swing.UIManager.getLookAndFeel().getClass().getName();
          if (laf.equals("javax.swing.plaf.metal.MetalLookAndFeel")) {
               oldOKButton = button[0];
               oldCancelButton = button[1];
               filenameTextField = textField[0];
               fileList = list[0];
          else if (laf.equals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")) {
               oldOKButton = button[0];
               oldCancelButton = button[1];
               filenameTextField = textField[0];
               fileList = list[0];
          else if (laf.equals("com.sun.java.swing.plaf.motif.MotifLookAndFeel")) {
               oldOKButton = button[0];
               oldCancelButton = button[2];
               button[1].setVisible(false); // hides the do-nothing 'Update' button
               button[3].setVisible(false); // hides the disabled 'Help' button
               filenameTextField = textField[1];
               fileList = list[0];
          fix(oldOKButton, okButton);
          fix(oldCancelButton, cancelButton);
          okButton.addActionListener(this);
          cancelButton.addActionListener(this);
          fileList.addMouseListener(this);
          addKeyListeners(fileChooser);
          new Thread(this).start(); // note: rescanning in Motif feel doesn't work
     public void run() {
          try {
               while (true) {
                    Thread.sleep(rescanTime);
                    Window w = SwingUtilities.windowForComponent(fileChooser);
                    if (w != null && w.isVisible())
                         fileChooser.rescanCurrentDirectory();
          } catch (Throwable err) {}
     public long getRescanTime() {
          return rescanTime;
     public void setRescanTime(long t) {
          if (t < 200)
               throw new IllegalArgumentException("Rescan time >= 200 required.");
          rescanTime = t;
     private void addKeyListeners(Container c) {
          for (int i = 0; i < c.getComponentCount(); i++) {
               Component d = c.getComponent(i);
               if (d instanceof Container)
                    addKeyListeners((Container) d);
               d.addKeyListener(this);
     private static void fix(JButton oldButton, JButton newButton) {
          int index = getIndex(oldButton);
          Container c = oldButton.getParent();
          c.remove(index);
          c.add(newButton, index);
          newButton.setPreferredSize(oldButton.getPreferredSize());
          newButton.setMinimumSize(oldButton.getMinimumSize());
          newButton.setMaximumSize(oldButton.getMaximumSize());
     private static int getIndex(Component c) {
          Container p = c.getParent();
          for (int i = 0; i < p.getComponentCount(); i++) {
               if (p.getComponent(i) == c)
                    return i;
          return -1;
     public JButton getOKButton() {
          return okButton;
     public JButton getCancelButton() {
          return cancelButton;
     public JList getFileList() {
          return fileList;
     public JTextField getFilenameTextField() {
          return     filenameTextField;
     public JFileChooser getFileChooser() {
          return fileChooser;
     protected JButton[] getButtons(JFileChooser fc) {
          Vector v = new Vector();
          Stack s = new Stack();
          s.push(fc);
          while (!s.isEmpty()) {
               Component c = (Component) s.pop();
               if (c instanceof Container) {
                    Container d = (Container) c;
                    for (int i = 0; i < d.getComponentCount(); i++) {
                         if (d.getComponent(i) instanceof JButton)
                              v.add(d.getComponent(i));
                         else
                              s.push(d.getComponent(i));
          JButton[] arr = new JButton[v.size()];
          for (int i = 0; i < arr.length; i++)
               arr[i] = (JButton) v.get(i);
          return arr;
     protected JTextField[] getTextFields(JFileChooser fc) {
          Vector v = new Vector();
          Stack s = new Stack();
          s.push(fc);
          while (!s.isEmpty()) {
               Component c = (Component) s.pop();
               if (c instanceof Container) {
                    Container d = (Container) c;
                    for (int i = 0; i < d.getComponentCount(); i++) {
                         if (d.getComponent(i) instanceof JTextField)
                              v.add(d.getComponent(i));
                         else
                              s.push(d.getComponent(i));
          JTextField[] arr = new JTextField[v.size()];
          for (int i = 0; i < arr.length; i++)
               arr[i] = (JTextField) v.get(i);
          return arr;
     protected JList[] getLists(JFileChooser fc) {
          Vector v = new Vector();
          Stack s = new Stack();
          s.push(fc);
          while (!s.isEmpty()) {
               Component c = (Component) s.pop();
               if (c instanceof Container) {
                    Container d = (Container) c;
                    for (int i = 0; i < d.getComponentCount(); i++) {
                         if (d.getComponent(i) instanceof JList)
                              v.add(d.getComponent(i));
                         else
                              s.push(d.getComponent(i));
          JList[] arr = new JList[v.size()];
          for (int i = 0; i < arr.length; i++)
               arr[i] = (JList) v.get(i);
          return arr;
     public File[] getSelectedFiles() {
          File[] f = fileChooser.getSelectedFiles();
          if (f.length == 0) {
               File file = fileChooser.getSelectedFile();
               if (file != null)
                    f = new File[] { file };
          return f;
     public void mousePressed(MouseEvent evt) {
          Object src = evt.getSource();
          if (src == fileList) {
               if (evt.getModifiers() != InputEvent.BUTTON1_MASK) return;
               int index = fileList.locationToIndex(evt.getPoint());
               if (index < 0) return;
               fileList.setSelectedIndex(index);
               File[] arr = getSelectedFiles();
               if (evt.getClickCount() == 2 && arr.length == 1 && arr[0].isFile())
                    actionPerformed(new ActionEvent(okButton, 0, okButton.getActionCommand()));
     public void mouseReleased(MouseEvent evt) {}
     public void mouseClicked(MouseEvent evt) {}
     public void mouseEntered(MouseEvent evt) {}
     public void mouseExited(MouseEvent evt) {}
     public void keyPressed(KeyEvent evt) {
          Object src = evt.getSource();
          int code = evt.getKeyCode();
          if (code == KeyEvent.VK_ESCAPE)
               actionPerformed(new ActionEvent(cancelButton, 0, cancelButton.getActionCommand()));
          if (src == filenameTextField) {
               if (code != KeyEvent.VK_ENTER) return;
               fileList.getSelectionModel().clearSelection();
               actionPerformed(new ActionEvent(okButton, 0, "enter"));
     public void keyReleased(KeyEvent evt) {}
     public void keyTyped(KeyEvent evt) {}
     public void actionPerformed(ActionEvent evt) {
          Object src = evt.getSource();
          if (src == cancelButton) {
               if (actionListener != null)
                    actionListener.actionPerformed(evt);
          else if (src == okButton) {
               File[] selectedFiles = getSelectedFiles();
               Object obj = fileList.getSelectedValue(); // is null when no file is selected in the JList
               String text = filenameTextField.getText().trim();
               if (text.length() > 0 && (obj == null || selectedFiles.length == 0)) {
                    File d = fileChooser.getCurrentDirectory();
                    Vector vec = new Vector();
                    StringTokenizer st = new StringTokenizer(text, "\"");
                    while (st.hasMoreTokens()) {
                         String s = st.nextToken().trim();
                         if (s.length() == 0) continue;
                         File a = new File(s);
                         if (a.isAbsolute())
                              vec.add(a);
                         else
                              vec.add(new File(d, s));
                    File[] arr = new File[vec.size()];
                    for (int i = 0; i < arr.length; i++)
                         arr[i] = (File) vec.get(i);
                    selectedFiles = arr;
               if (selectedFiles.length == 0) {
                    Toolkit.getDefaultToolkit().beep();
                    return;
               if (selectedFiles.length == 1) {
                    File f = selectedFiles[0];
                    if (f.exists() && f.isDirectory() && text.length() > 0 && evt.getActionCommand().equals("enter")) {
                         fileChooser.setCurrentDirectory(f);
                         filenameTextField.setText("");
                         filenameTextField.requestFocus();
                         return;
               boolean filesOnly = (fileChooser.getFileSelectionMode() == JFileChooser.FILES_ONLY);
               boolean dirsOnly = (fileChooser.getFileSelectionMode() == JFileChooser.DIRECTORIES_ONLY);
               if (filesOnly || dirsOnly) {
                    for (int i = 0; i < selectedFiles.length; i++) {
                         File f = selectedFiles;
                         if (filesOnly && f.isDirectory() || dirsOnly && f.isFile()) {
                              Toolkit.getDefaultToolkit().beep();
                              return;
               fileChooser.setSelectedFiles(selectedFiles);
               if (actionListener != null)
                    actionListener.actionPerformed(evt);

Similar Messages

  • Why does my font/text change when I switch from Classic 3D to Ray traced 3D in After Effects?

    My font/text changes when I switch from Classic 3D to Ray traced 3D. Why is it doing this? Also, I cant get the font/txt to look the same after I switch from Classic to Ray traced. How can I get it to look the same?

    I am pretty new to After Effects so I hope it's not my inexperience that's causing the problem. (It probably is)
    I just updated to the most current version of AE.
    I am on a mac pro late 2013 12GB 6 core. Running OSX 10.9.4
    Okay so after looking at it a little closer, I think the color is what mostly changes. The first screenshot is the what the text look like with Classic 3D and the second screenshot is what it looks like after I change it to Ray traced 3D. Also under the "Mode" section..the pull down that says "Normal" disappears. I'm wondering why the font color is changing?

  • No Approve button in changed PO

    Experts,
    SRM5.0 Ext classic
    We have a PO which was changed and went to the approver. Now when approver logs into approve this PO, he sees it in his inbox, clicks on it but strangely there is no approve/reject button!!(It is completely missing, not grayed out).
    The screen that opens up looks similar to the one that opens for 'Process Purchase Order'
    I have checked the roles...everything is fine. Also this is just a one off case.
    What could be the issue?
    Thanks

    Hi Mikael,
    Could you please tell me how you resolved this issue?
    For me the 'approve' button is appearing at the first time in the UWL. Then after I approve one of the leave, then the 'approve' button disappears!
    Thanks,
    Kalai

  • How to tell the PO is for re-approve after price change when release PO

    Hi,
    When doing PO approval (release) with transaction code ME28, we want to know whether the PO is a newly created PO for approval or it is for Re-approve due to changes (on price, quantity etc). We want to be able to differential the Re-approve PO in ME28 screen without drill down to the PO changes history screen. Is that possible?
    best rgds

    hi
    from ME28  goto  environmentdisplay documentit will take u to po
    in Po from menuenvironmentheader changes
    here u can see release history
    Vishal...

  • Group changes when file is created in the GUI

    Hello All,
    Here is a outline of my situation. On a 10.5 or 10.6 client machine if I go to System Prefs, Accounts and click on the "+" and change to "group" and add a new group called "video" and set the GID to 264, it will create the new group.
    Then I create a new user, right click on the user and go to Advanced Options, change the UID to the number below, and change the GID to 264.
    Now if I launch the terminal and create a new file from the terminal, and then ls -la that file all is well(see below). Then I go back to the desktop and open Text Edit, create a new file and save it, the new file belongs to the wheel group. ???
    I found some info that said to get the umask to work proper I needed to create a file in /etc called launchd-user.conf and add the entry "umask 0007" to it. I did that, and now the permissions seem to work proper, just not the group.
    Am I missing a step here somewhere along the way? Any help or ideas would be great!
    Thanks
    John
    On command line (Terminal):
    Last login: Wed Oct 27 15:58:47 on ttys000
    3032973:~ jnichol2$ cd Desktop
    3032973:Desktop jnichol2$
    3032973:Desktop jnichol2$ id -a
    uid=986638623(jnichol2) gid=264(video) groups=264(video),102(com.apple.sharepoint.group.2),9001(testgroup),101(com.app le.sharepoint.group.1),20(staff)
    3032973:Desktop jnichol2$ touch . foo
    3032973:Desktop jnichol2$ ls -ld foo
    -rw-rw---- 1 jnichol2 video 0 Oct 27 16:01 foo
    Everything looks good here, but....
    Launch GUI tool, e.g. Textedit; save file “bar”
    3032973:Desktop jnichol2$ ls -la bar.rtf
    -rw-rw----@ 1 jnichol2 wheel 318 Oct 27 16:01 bar.rtf
    Notice, the permissions and group are not what we expect. I hope this helps understand the problem. Let me know if you need more info.

    Two things are going on here.
    When a new file or folder is created, the group specified is inherited from its parent folder. So if some folder "foo" has the group "video" specified, then all new files created in that folder will also get group "video". It seems like you know this already.
    The problem you are having with TextEdit is that manner in which it saves new files. TextEdit creates a temporary directory first, saves the file there, and then moves the file to its proper destination folder as a final step. This is why it isn't getting the "video" group setting applied to it - it gets the "wheel" group from the temporary folder that it's really being created in. Some other Apple apps behave this way too - Safari when saving a web page to disk, for example.
    I have filed a bug report to Apple about this a long time ago. The report I filed was listed as a "duplicate". I don't know when, if ever, this will be fixed.

  • Gradient and text, changes when copied

    Hi, this is a CS3 document, exported in IDML for CS4.
    The price has no transparency, no other effects.
    When copied, the value stays the same but the visual changes. Any ideas?
    This thing happen in CS5 also but not in CS3.
    Thanks
    EDIT: if i change the first to -89 and then to -90, doesn't work. If i copy the third (that is now visually correct), the gradient stay normal.

    It looks like InDesign has repositioned the gradient within the text. Think of a gradient without the text masking it, as a rectangle that fades from yellow to green. With the Gradient tool you can click and drag to define the angle and size of that rectangle. The text then masks the rectangle so only the part within the text shows. I think InDesign did not reposition the text and the gradient properly when you pasted. You can highlight the text, then switch to the Gradient tool and drag to reposition the gradient. Unfortunately there is no way to make this part of a character style or paragraph style.

  • Tab strip push button text change for user-exit screen

    Hi experts
       How can I change the text of Tab strip push button which is maitained by screen user-exit.Such as I maintained the user exit MEREQ001,In the screens of TCODE me51n there have a subscreen named
    "CUSTOMER DATA",Now I want change the text.
    thanks in advance
    BR
    Chris

    create ab push button without any text. In the run time you can assign test to this as follows.
    suppose name of the button is PUSHBUT.
    PUSHBUT = 'EDIT'.

  • File Created time changes when file renamed to previously used name

    Any ideas on this one would be very gratefully received:
    I am trying to rename a file then create a new one with the original name, as part of a solution to roll over log files after x days. 
    I found that the new file had the 'created time' of the original file, which messed up the logic badly. I tried to unpick this by creating the new file with a new name, then renaming it. The new file got the correct created time initially,
    but as soon as I renamed it to the original name, the created time reverted to the created time of the earlier file.
    I even tried simply deleting the old file altogether, but every attempt to get a new file with the original name resulted in the created time being that of the old file.
    I have used different filesystemobject instantiations for the old and new files, and I even tried creating the new file in a different run of the script, and in a different cmd session. The only thing that worked was logging out and in again before
    creating the new file!
    Since the created time attribute is not writeable, I'm struggling to get round this.
    Here is a stripped out version that demonstrates it. I have put 5 second waits in, so you can watch the created time get reset in front of your eyes when the new file gets renamed to the old name (might need to add a column for 'created time' to Windows
    Explorer)
    (OS is 2008 server R2 Enterprise)
    $logdir = ".\"
    $logfname = "roll.log"
    $RollAtDays = 0 # for testing - so it always creates a new file
    If ( -not ( test-path $logdir) ){ $newdir = New-Item $logdir -type directory } 
    $logfile = $logdir+$logfname
    $newlog = $logdir+$logfname+".new"
    $fso = New-Object -comobject Scripting.FileSystemObject
    $date = Get-Date
    # if file exists, test whether it requires rolling over
    If ( test-path $logfile ){
     $fo = $fso.GetFile( $logfile ) 
     $dc = $fo.DateCreated
     $RollDate = $dc.AddDays( $RollAtDays )
     # write-host "$dc $RollDate"
     If( $RollDate.CompareTo( $date ) -lt 0 ){
      write-host "Roll"
      $newPath = "$logdir$date-$logfname"
      $newPath = $newPath.Replace("/", "")
      $newPath = $newPath.Replace(" ", "-")
      $newPath = $newPath.Replace(":", "")
      $fo.Move( $newPath )
      #$fo.Delete( ) #tried both renaming and deleting the original file
      start-sleep -s 5
    # some code to create a file if one doesn't exist
    If ( -not ( test-path $logfile) ){
     $header = "Date"
     $fso1 = New-Object -comobject Scripting.FileSystemObject
     $ts1 = $fso1.CreateTextFile( $newlog, $True )
     $ts1.close()
     start-sleep -s 5
     $fo1 = $fso1.GetFile( $newlog ) 
     $fo1.Move( $logfile )  # this is where the created date gets changed back
     #add-content $logfile $header
    # some code to add a line to the log
    [string]$logline = "$date"
    #add-content $logfile $logline

    I have to disagree with the assessment that creation time is not writable:
    Get-Item test1.txt | select creationtime
    (Get-Item test1.txt).CreationTime = '07/03/2014'
    Get-Item test1.txt | select creationtime
    CreationTime
    3/20/2014 1:15:43 PM
    7/3/2014 12:00:00 AM
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Button view changes when form is rendered by some users

    The Delete button on this form is set to "Visible Screen Only", but changes to "Visible" (and therefore prints) for some users.  The other buttons do not have this issue. 
    For those same users, when they open the form, they get the yellow bar across the top saying that Javascript is not enabled.  Each of them have several times chosen to "enable always", but will get the same message the next time they open the form.
    I requested that each of them update their Reader, but they are still having the same issue.
    While this is fairly minor, it is very annoying and I am out of ideas.
    The form is attached.  Can anyone help?

    Hello there,
    I'm sorry to hear that you've been having trouble; this sounds like an Acrobat issue (not an Acrobat.com issue), so it's not likely to get a satisfactory answer from this forum, which is for questions pertaining to Acrobat.com (www.acrobat.com). I recommend re-posting it to the forums at the Acrobat Users Community:
    http://www.acrobatusers.com/forums
    You'll have more of a chance of getting a comprehensive answer from the moderators there. Best of luck, and sorry not to be able to offer more specific advice.
    Kind regards,
    Rebecca

  • Page size changes when file is exported or saved to pdf

    I have an illustrator file that is 8.625 x 11.125, purposely made a bit larger than a standard letter sized paper for the bleed effect I am trying to achieve. When I save the file as a pdf or export it asa jpg or tiff itgets shrunk to letter size and the the edge I created with the extra .125 inches is now 'cut' to letter size not just shrunk. How do I save the file so it stays 8.625 x 11.125 inches.

    Milan,
    Make sure the paper/Crop Area size is the right one, and preferably state version. My guess is CS, or maybe CS3.

  • Volume Changes when File is Exported as aiff...

    Hello, I am aiming to export my audio files to aiff however, when I open the exported file with iTunes, the level of the volume is significantly lower than it was in the Logic playback. Can someone recommend how to correct this so that the volume stays consistent from one file type to another?
    Thanks!

    Turn off sound enhancer and sound check features in iTunes.
    and set iTunes volume to maximum - this iTunes slider is like the master slider in Logic, only 0 in iTunes is the maximum value:
    I found it helps to always adjust your actual listening level with hardware controls (interface, amp, etc) and keep all audio apps at unity gain - only mix in Logics' mixer. It keeps things that are already complicated just a bit easier.

  • Acrobat 9.4.2 hangs on name changes when "file as"

    Running Windows 7, 64 bit. If I accept the filename, all works well. If i click in the name to modify it, computer hangs. If I wait long enough (I think) it finally works, but takes MINUTES.

    Success:
    Working now for 7h (OK, for about 2h the PC could be left alone) the problem has been solved:
    Two more attempts to start with Acro 9.3 version from the CS5 DVD and then update to 9.4.2 in one step were not successful. Thw shortcut to bypass three minor levels (.0 to .3) turned out to become a lengthy detour!
    In addition, FrameMaker had no idea about Acrobat and hence Save As PDF did not work.
    Then decided not only to uninstall Acrobat, but also to remove the Acrobat folder (as Bil@VT suggest in the mean time - but I did not look at the e-mails yet now).
    Start with the installation of Acro 9.0 from the TCS2 DVD: everything OK, setup of the various preferences and the Adobe Acrobat printer settings. FrameMaker knows about Acrobat now.
    Update to 9.2 and check: still all OK.
    Update to 9.4.2 and check: the preferences were still OK, but the Adobe Acrobat printer settings had to be re-established.
    The only preference which is not persistant is Units & Guides > Page & Ruler Units: cm. This always falls back to inches, because I use the englisch UI. It sticks to mm when using the German UI. Adobe has never heard that metric units are common also in english speaking countries (well CH is not...)
    Well, this evening I will have a glass of wine or two.

  • Simple Button.Text not changing properly

    Hi all,
    The WPF learning curve is steep.
    I have pulled my hair over this simple Button.Text change and I can't get it to work.
    In WinForms this works:
    Public Class Form1
    Private Sub BTN_1_Click(sender As Object, e As EventArgs) Handles BTN_1.Click
    BTN_1.Text = "CLICKED BUTTON 1"
    BTN_2.Text = "CHANGED BY BUTTON 1"
    End Sub
    Private Sub BTN_2_Click(sender As Object, e As EventArgs) Handles BTN_2.Click
    BTN_2.Text = "CLICKED BUTTON 2"
    BTN_1.Text = "CHANGED BY BUTTON 2"
    End Sub
    End Class
    I want to do the same thing in WPF
    <Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <Grid.RowDefinitions>
    <RowDefinition/>
    <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition/>
    <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0" Grid.Row="0">
    <Button Name="BTN_1" Click="CLICK_BTN_1">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_1_LABEL_1" Text="Button 1 text" VerticalAlignment="Top" Foreground="#BF000000" >
    </TextBlock>
    <TextBlock Name="CLICK_BTN_1_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 1</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    <Grid Grid.Column="1" Grid.Row="0">
    <Button Name="BTN_2" Click="CLICK_BTN_1">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_2_LABEL_1" Text="Button 2 text" VerticalAlignment="Top" Foreground="#BF000000">
    </TextBlock>
    <TextBlock Name="CLICK_BTN_2_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 2</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    </Grid>
    </Window>
    Class MainWindow
    Private Sub CLICK_BTN_1(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles BTN_1.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CLICK_BTN_1_LABEL_1.Text = "CLICKED BUTTON 1"
    ' CHANGE LABEL 1 ON BUTTON 2
    CLICK_BTN_2_LABEL_1.Text = "CHANGED BY BUTTON 1"
    End Sub
    Private Sub CLICK_BTN_2(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles BTN_2.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CLICK_BTN_1_LABEL_1.Text = "CHANGED BY BUTTON 2"
    ' CHANGE LABEL 1 ON BUTTON 2
    CLICK_BTN_2_LABEL_1.Text = "CLICKED BUTTON 2"
    End Sub
    End Class
    This used to be so simple with WinForms, what am I doing wrong here?
    New to WPF

    Yeah, I saw that as well but now I am stuck again:
    Same project but I have put the buttons in a usercontrol
    <Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Component_Changes"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <Grid.RowDefinitions>
    <RowDefinition/>
    <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
    <ColumnDefinition/>
    <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0" Grid.Row="0">
    <Viewbox Stretch="Fill">
    <ContentControl Name="UC_BTN1">
    <ContentControl.Content>
    <local:btn1 Margin="20"/>
    </ContentControl.Content>
    </ContentControl>
    </Viewbox>
    </Grid>
    <Grid Grid.Column="1" Grid.Row="0">
    <Viewbox Stretch="Fill">
    <ContentControl Name="UC_BTN2">
    <ContentControl.Content>
    <local:btn2 Margin="20"/>
    </ContentControl.Content>
    </ContentControl>
    </Viewbox>
    </Grid>
    </Grid>
    </Window>
    btn1.xaml
    <UserControl x:Class="btn1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
    <Button Name="BTN_1" Click="CLICK_BTN_1">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_1_LABEL_1" Text="Button 1 text" VerticalAlignment="Top" Foreground="#BF000000" >
    </TextBlock>
    <TextBlock Name="CLICK_BTN_1_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 1</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    </UserControl>
    btn1.xaml.vb
    Public Class btn1
    Dim CL_BTN2 As btn2
    Private Sub CLICK_BTN_1(sender As Object, e As RoutedEventArgs) Handles BTN_1.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CLICK_BTN_1_LABEL_1.Text = "CLICKED BUTTON 1"
    ' CHANGE LABEL 1 ON BUTTON 2
    CL_BTN2.CLICK_BTN_2_LABEL_1.Text = "CHANGED BY BUTTON 1"
    End Sub
    End Class
    btn2.xaml
    <UserControl x:Class="btn2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
    <Button Name="BTN_2" Click="CLICK_BTN_2">
    <StackPanel>
    <TextBlock Name="CLICK_BTN_2_LABEL_1" Text="Button 2 text" VerticalAlignment="Top" Foreground="#BF000000">
    </TextBlock>
    <TextBlock Name="CLICK_BTN_2_LABEL_2" VerticalAlignment="Top" Foreground="#BF000000">
    <Run FontSize="25">Button 2</Run>
    <Run FontSize="12">Label 2</Run>
    </TextBlock>
    </StackPanel>
    </Button>
    </Grid>
    </UserControl>
    btn2.xaml.vb
    Public Class btn2
    Dim CL_BTN1 As btn1
    Private Sub CLICK_BTN_2(sender As Object, e As RoutedEventArgs) Handles BTN_2.Click
    ' CHANGE LABEL 1 ON BUTTON 1
    CL_BTN1.CLICK_BTN_1_LABEL_1.Text = "CHANGED BY BUTTON 2"
    ' CHANGE LABEL 1 ON BUTTON 2
    CLICK_BTN_2_LABEL_1.Text = "CLICKED BUTTON 2"
    End Sub
    End Class
    No warnings in the code but the error is: 'Object reference not set to an instance of an object' and I thought I did, obviously not in the right way.
    New to WPF

  • Saving changes on file close doesn't work

    I just upgraded from iLife 4 to 6, and cannot get iMovie 6 to save changes when I close the project and press the Save button in response to the question: "Do you want to save the changes you made in the document [name of file]?" If I hit command-S manually before closing the file, it WILL save changes, but I am worried that one day I will forget to manually save changes, approve the "save changes on file close" request, and my changes will be lost! I have tossed the preferences and run repair permissions, but neither one helped. I have never seen any Mac application (or Windows, for that matter) fail to save changes when you close a file and get asked to save changes. Does yours work? What am I doing wrong?
    G5   Mac OS X (10.3.9)  

    Welcome to the forum!
    The failure to save when you close a project very, very weird. That one is new to me.
    iMovie HD does require that the project disk uses the Mac OS Extended disk format. If it uses another format, there can be problems saving. So I'd start there.
    http://discussions.apple.com/message.jspa?messageID=1852869#1852869
    Be sure too to rule out third-party plug-ins and QuickTime add-ons that can cause weird problems. There probably aren't many iLife 6 user still using Mac OS 10.3.9. Although iMovie 6 is supposed to run okay, it may be that you'll see problems others don't see.
    Is the routine maintenance that Mac OS X does on its own getting done?
    http://docs.info.apple.com/article.html?artnum=107388
    Karl

  • Multiple flash files change when a button click using javascript function

    hi.. am new in flsh...
    i want to multiple flash files change when a button click using a javascript

    <script>
    var count=0;
    function mafunct(newSrc){
        alert("hi");
    var path="a"+count+".swf"; 
    flash+='<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" WIDTH="100%" HEIGHT="100%">';         
        flash+='<PARAM NAME=movie VALUE="'+path+'">';         
        flash+='<PARAM NAME="PLAY" VALUE="false">'; 
        flash+='<PARAM NAME="LOOP" VALUE="false">';
        flash+='<PARAM NAME="QUALITY" VALUE="high">';
        flash+='<PARAM NAME="SCALE" VALUE="SHOWALL">';
        flash+='<EMBED NAME="testmovie" SRC="Menu.swf" WIDTH="100%" HEIGHT="100%"PLAY="false" LOOP="false" QUALITY="high" SCALE="SHOWALL"swLiveConnect="true"PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">';
        flash+='</EMBED>';
        flash+='</OBJECT>';    
    count++;
    alert(path+"aa");
    </script>
    <button onclick="mafunct()">next</button>

Maybe you are looking for