Add TexeArea in FileChoosers Dialog Frame

I would like to be able to add a text note to a file and to add a textarea in filechooser to type these notes in and read them from the text area. I am writing a program with complex actions and these notes would be handy for the viewer of the files to remember what is in the files. I had this ability in a operating system called GeoWorks it was a nice feature. I think others could use this as well. Please help me with this I will share the code with others and sun as well.
Someone sent me this code but I need the textarea in Filechooser as well, I see he named it (jTextAreaRep) but that is all. I appreciate all the help I have gotten and will be getting. If this can be done but is complex point me in the direction if you can.
void saveasfile() {
String currFileName;
jFileChooser1.setVisible(true);
jFileChooser1.setEnabled(true);
if (JFileChooser.APPROVE_OPTION == jFileChooser1.showSaveDialog(this)) {
currFileName = jFileChooser1.getSelectedFile().getPath();
if (currFileName.endsWith(".doc") == false &&
currFileName.endsWith(".rtf") == false) {
currFileName = currFileName + ".doc";
try { File file = new File(currFileName);
FileWriter out = new FileWriter(file);
String text = jTextAreaRep.getText(); // GET YOUR TEXT FROM TEXT AREA..
out.write(text);
out.close();
JOptionPane.showMessageDialog(null, "The report has been saved to the file..",
"Saved", 1);
catch (IOException e) {
//System.out.println("Error saving " + currFileName);
jFileChooser1.setVisible(false);
jFileChooser1.setEnabled(false);

public void saveAsFile() {
   String currFileName;
   // Here we go
   jFileChooser1.setAccessory(jTextAreaRep);
   // That's all folks!
   jFileChooser1.setVisible(true);
   jFileChooser1.setEnabled(true);
   if (JFileChooser.APPROVE_OPTION == jFileChooser1.showSaveDialog(this)) {
      currFileName = jFileChooser1.getSelectedFile().getPath();
      if (!currFileName.endsWith(".doc") && !currFileName.endsWith(".rtf")) {
         currFileName = currFileName + ".doc";
      try {
         File file = new File(currFileName);
         FileWriter out = new FileWriter(file);
         String text = jTextAreaRep.getText();    // GET YOUR TEXT FROM TEXT AREA..
         out.write(text);
         out.close();
         JOptionPane.showMessageDialog(null, "The report has been saved to the file..",
                                       "Saved", 1);
      catch (IOException e) {
         //System.out.println("Error saving " + currFileName);
  jFileChooser1.setVisible(false);
  jFileChooser1.setEnabled(false);
}  

Similar Messages

  • Dialog/Frame window not closing

    I have an instruction dialog that pops up in an application, but if the close (X) is pressed it doesn't close the dialog/Frame.
    Dimension dem = getSize();
                   Frame r = new Frame();                    
                   Dialog d = new Dialog(r);
                   TextArea t = new TextArea("",100,100,TextArea.SCROLLBARS_NONE);
                   t.setBackground(new Color(0,0,102));
                   t.setForeground(Color.white);
                   t.setFont(new Font("Helvetica",6,14));
                   t.append(
                        "Grammar Checking Instructions: "+"\n\n"+
                        " -Use the Lexicon provided to creates a sentence for grammatical"+"\n"+
                        " checking."+"\n"+
                        " -The sentence can be typed in the text field provided or the user can"+"\n"+
                        " load a sentence from a file. (*.txt format)"+"\n"+
                        " -Press the 'Check Sentence' button for the sentence to be analyzed"+"\n\n"+
                        "Grammar Rules: "+"\n\n"+
                        " S -> NP Pred"+"\n"+
                        " Pred -> v NP PP | v PP NP | v NP | v PP | v"+"\n"+
                        " PP -> p NP"+"\n"+
                        " NP -> det. NP* | NP*"+"\n"+
                        " NP* -> adj NP* | n");
                   d.add(t);
                   d.setTitle("Grammar Checking");
                   d.setSize(475,300);
                   d.setLocation(dem.height/2 -140,dem.width/2 -40);
                   d.setResizable(false);
                   d.show();
                   r.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});     
    thanks for the help,
    steve

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame {
      JDialog myDialog;
      public Test() {
        myDialog = new JDialog(this,"Sample Dialog");
        myDialog.setSize(50,50);
        myDialog.getContentPane().add(new JLabel("Hello"));
        JPanel content = (JPanel)getContentPane();
        JButton myButton = new JButton("Dialog");
        content.add(myButton);
        myButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
         myDialog.show();
        addWindowListener(new WindowAdapter() {
          public void windowClosed(WindowEvent e) { System.exit(0); }
      public static void main(String[] args) {
        Test test = new Test();
        test.setSize(100,100);
        test.show();
    }

  • How can i add new jcomponent to a frame?

    hi.
    how can we add new component to a frame? look at this code. Why when i click on button, nothing added to frame? event handled correctly and frame size changes but no button adds to frame.
    private void convertButtonMouseClicked(java.awt.event.MouseEvent evt) {
    // TODO add your handling code here:
    JButton newButton = new JButton("new");
    getContentPane().add(newButton , BorderLayout.CENTER);
    newButton.setVisible(true);
    setSize(500, 500);
    }

    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
    Well typically you wouldn't add a button to the Center of a BorderLayout. If you really want to do this you should be using a [Card Layout|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html].
    In general the code for adding/removing components should be:
    panel.add(...)
    panel.revalidate();
    panel.repaint();

  • How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking

    How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking. I have put the IIS setting X-Frame-Options:SAMEORIGIN  on my Internal CAS Server. However as the OWA page is published through
    Forefront TMG 2010, the iFrame tag is not blocked when the page is first opened. Only when you login with your credentials to the OWA page inside the frame and the page reaches IIS on the Internal CAS it gets blocked. I want to block it in the first
    instance when it is opened from TMG.

    Hi,
    Thank you for the post.
    To modify the http header, please refer to this blog:
    http://tmgblog.richardhicks.com/2009/03/27/using-the-isa-http-filter-to-modify-via-headers-and-prevent-information-disclosure/
    Regards,
    Nick Gu - MSFT

  • How Do I add new fields to Repeating Frames in existing Report

    Hi,
    How do I add new fields to Repeating Frames in existing Report. The Report has 2 GRPFR, 1 HDR and 2 Repeating Frames. I would like to add a new field(column) to inner most repeating frame. I added the new golumn to QUERY and GROUPs in Data Model. After adding the new column to inner most Repeating Frame in Layout Model, the Layout model is losing all other frame and it is showing only the modified one.
    How do I add new column to repeating frames without disturbeing other frames.
    Any hellp will be appreciated!!!!!!!!!!!.
    I am using Oracle Reports 6i.
    Thanks,
    Ravi.

    you must work in your layour editor
    expand your repeating frames do it more big
    for add your new items or field. after you inserted or add, can you put more little your repeating.
    too can you to do one copy of one field in your repeating frame and assign it in his source your new item in your data model.
    normally i begin with the principal frame and go one by one internally.

  • Urgent.. How to add a menubar to a frame by reading a file

    Hi All,
    I am involved in a project where in i need to add a menubar to the frame by reading a text file. The text file consists of all the Menu Items and subMenu items.This text file will be a editable file where-in the user can add his own menu-items.
    i.e when i run the java program i should read the menu items from a file and then display those menuitems in the Menubar.
    I am not getting the idea how i should proceed. Can any one help.
    Thanks in advance.
    Regards
    Ravi Kumar

    Sorry again - my use of i as an array index wasn't very clever. The post should have been as follows:
    Hi,
    You can read in the menu names from the file and add them fairly simply, with something like this:
    JMenuBar jmb = new JMenuBar();
    JMenu myMenu = new Jmenu("Custom");
    jmb.add(myMenu);
    in = new BufferedReader(new FileReader("file.txt"));
    JMenuItem [] menulist = new JMenuItem[MAXITEMS];
    for (int j=0; j < MAXITEMS; j++) {
    menulist[j] = new JMenuItem(in.readLine());
    myMenu.add(menulist);
    Then add the JMenuBar to the parent frame.
    However, for the menus to be of much use, you'd need to add actionlisteners to them as well.
    If you had a set of possible menu items, and it was just a question of which order the user's file defined them in, and which it used, you could then just test the name of each item in the file and assign an appropriate class of actionlistener to it, something like:
    if(menuitem.getText().equals("Open")) {
    menuitem[j].addActionListener(new OpenActionListener());
    where you'd defined the OpenActionListener class somewhere else.
    Hope this helps,
    Neil
    http://www.theBatCave.org.uk
    (Not having a very good day!)

  • Can I Add User Defined Tab Dialog From just like kTextFrameOptionsDialogBoss?

    Can I Add User Defined Tab Dialog At Build-In kTabSelectableDialogBoss, just like kTextFrameOptionsDialogBoss?
    If it is possible, How?
    Pls Help Me...

    Impliment IUnitOfMeasure with custom units.

  • NW2004s Java Add-in on a Dialog Instance

    Hello All,
    Is it possible to perform a Java Add-in on a dialog instance for NW2004s SR1? I don't see any option in the installation master. It only shows the option for Java Add-in in Central Service instance, Database instance and Central Instance.
    I already have both ABAP+JAVA on CI (NW2004s SR1). There is a dialog instance which is running only ABAP (NW2004s SR1). Can I add Java to this dialog instance?
    Can someone please help me on this?
    Thanks.
    Fahad

    Hi Fahad,
    You can only add Java-Addin to a Central instance.
    Regards,
    Siddhesh

  • How to add List Box in Dialog Screen

    Hi All,
    I need to add list box in Dialog screen.
    In Dialog screen I have 2 radio buttons "Yes" and 'NO'.
    If user selects radio button YES,  then under Yes I need to display values in list box and these values should be retrieved from one table.
    If user  selects Radio button NO then under NO  I need to display values in list box.
    Please give the solution for above requirement.
    Thanks
    Vijay

    Vijay Reddy ,
    To get Drop Drown Box on screen .
    Follow these steps.
    1.Go to T.Code SE51 and Select Laypout for the Screen.
    2.Double click on the field for which u want Dropdown box.
    3.Then U will see Name ,Text ,DROPDOWN.Click on that and select List Box or ListBox with key . Better to to select first one.
    4.Save and Activate ur screen .
    5.Enter the following piece of code in the PBO of the screen.(Change for ur
       requirement).
    The following logic needs to be written under PBO of the screen logic.
    TYPE-POOLS :vrm.
    DATA:
      i_natio TYPE vrm_values, "-->Table that is passed through FM vrm_set_values
      w_natio LIKE LINE OF i_natio.
    DATA:
    BEGIN OF i_t005t OCCURS 0,
        land1 TYPE t005t-land1,
        natio TYPE t005t-natio,
    END OF i_t005t.
    IF i_t005t[] IS INITIAL.
      SELECT land1 natio
         FROM t005t
           INTO TABLE i_t005t
       WHERE spras = sy-langu.
      IF sy-subrc = 0.
      LOOP AT i_t005t .
          w_natio-key = i_t005t-land1.
          w_natio-text = i_t005t-natio.
          APPEND w_natio TO i_natio.
          CLEAR w_natio.
      ENDLOOP.
      ENDIF.
    ENDIF.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
                           id = 'I_IT0002-NATIO' "-->Field for which dropdown is needed.
                    values = i_natio
    EXCEPTIONS
       id_illegal_name = 1
                OTHERS = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    6.Observe the above code and change as for ur requirement.
    I hope that it helps you .
    Regards,
    Venkat.O

  • Add panel to center in frame?

    Why am I not able to add the panel to the center of the frame?? Its put at north instead?
    import java.awt.*;
    import java.awt.event.*;
    class HovedMenu extends Frame
         Button afslut,lejer,lejemaal;
         Panel p;
         HovedMenu()
              p = new Panel(new FlowLayout());
              afslut = new Button("Afslut");
              p.add(afslut);
              lejer = new Button("Lejer");
              p.add(lejer);
              lejemaal = new Button("LejeM�l");
              p.add(lejemaal);
              add("Center",p);
              setSize(640,480);
              setVisible(true);
         public static void main(String[] aslan)
              new HovedMenu();
    }

    Hi ,
    try this:
    HovedMenu()
    p = new Panel(new FlowLayout());
    afslut = new Button("Afslut");
    p.add(afslut);
    lejer = new Button("Lejer");
    p.add(lejer);
    lejemaal = new Button("LejeM�l");
    p.add(lejemaal);
    getContentPane().setLayout(new java.awt.BorderLayout());// setLayout
    f.getContentPane().add(p,java.awt.BorderLayout.CENTER); // add p
    setSize(640,480);
    setVisible(true);
    }You didn't have a LayoutManager and you've tried to add the panel to the frame itself, instead of adding it to the contentPane.

  • Add picture in a Dialog or Frame??

    hello everybody,
    i ask about how add a picture in a pan of a dialoge a frame. and how change the icon placed in the top right of a dialog.
    thakx in advance

    Do a search on "coffee cup". That question has been answered in detail within the last few days.
    Try the same on "adding image" or "toolkit"
    Cheers
    DB

  • How Can I make A Dialog/Frame Transparent

    Hi
    I want to make a dialog or frame Transparent. Is it possible in java. Actually i want to add an gif image on the Frame container that image is in curve shape with transparency, and I want this transparency also on the Frame in the java application. I m using JFrame with setUndecorated(true). It will display image (just image) not any Frame behind it, I any one solves my problem to make a frame transparent.
    Thanks
    Khurram

    Check out this link:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=490146
    The program contained therein is really slick.
    My hat is off to the coder.
    Lance

  • Add or Edit Text Dialog Box Disappeared

    I am attempting to add text to my pdf using the add or edit text tool in Acrobat Pro X. However, the dialog box that allows me to change fonts, size, color, etc. has disappeared. Does anyone know how to make the dialog box come back?

    Hi,
    This is a new problem. It started about 2 days before I posted the question. I have not updated my Acrobat recently and I was previously able to use the dialog box with no problem. I have tried in several different documents and the dialog box is not showing up.
    Thanks for your assistance.

  • Open Add Item Form as Dialog

    Hi All - I have a custom button on the click of which I am trying to open a Add Item form. When the display form opens I want to hide all the masterpage items( viz. Quick Launch, header, foooter, etc). I tried below but it's not opening and giving error
    when the masterpage is Oslo. It works fine when masterpage is Seattle. 
    <asp:LinkButton OnClientClick ="javascript:SP.UI.ModalDialog.showModalDialog({ url: '../Lists/AddAccount/NewForm.aspx', title: 'Add Account' }); return false;" CausesValidation="false"   CssClass="orange-btn" Text="Post"
    runat="server" ID="btnPost"></asp:LinkButton>
    Does anything know why is it happening?
    Regards,
    Khushi
    Khushi

    You need to set the URL of SharePoint link button like this
    http://<Site Name>/Lists/AddAccount/NewForm.aspx?isDlg=1
    to open that in modal dialog use below jScript.
    <script type="text/javascript">
    function openDialog(listUrl, frmTitle) {
    var options = {
    url: listUrl,
    title: frmTitle,
    allowMaximize: false,
    height: 500,
    width: 600,
    showClose: true
    //SP.UI.ModalDialog.showModalDialog(options);
    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
    </script>
    And your anchor tag should be like
    <asp:LinkButton OnClientClick ="javascript:openDialog('/Lists/<List Name>/NewForm.aspx?IsDlg=1', 'Add Account')" CausesValidation="false" CssClass="orange-btn" Text="Post" runat="server" ID="btnPost"></asp:LinkButton>
    Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer.

  • How to Add Media to a Custom Frame That Preserves to Interactive PDF

    What I'm doing/trying to do:
    I have a custom object that I want to use as a frame in which the video would be placed. The object is a somewhat rectangular frame that I've custom made to fit over a portion of my background image.
    Adobe InDesign interactive pdf exports don't play any html embed codings I add (even after making sure the http:// is present) nor does the InDesign accept any of the video from URL links I put in from YouTube or Vimeo using the Add Media function. Therefore I tried using the actual media file and uploading it to my Adobe Indesign file. However, the video won't play or appear in my custom frame when I export it, but the video file will play when I plop it in without a frame. Before exporting I get the message: :
    So:
    A) What urls will Adobe Indesign ACTUALLY accept since all the ones I've used so far don't work?
    B) How do I add a video file to a custom frame that fits appropriately into the frame?
    C) How do I get URL based media to work in interactive pdfs?
    D) If I can't do what I'm trying to do as an interactive pdf what file should I be saving it as so that I can make it work?
    I hope that makes sense. Thanks in advance for the help!

    I have never yet heard of anyone who has successfully played a YouTube or Vimeo streaming video from an interactive PDF. You could search for some kind of a third party utility that claims to convert that to a video format. You should aim to create an MP4 file, preferably with H.264 encoding. I've also never read the description of someone who has done such a conversion, though it is theoretically possible.
    You will be unsuccessful in masking a video to play in a non-rectangular frame because in a PDF, the interactivity also is display above anything else on the page.

Maybe you are looking for

  • I can't save *new* documents back to SharePoint

    I can't save *new* documents back to SharePoint. We have a SharePoint 2013 development environment, running on Windows Server 2012 and a Windows 7 Client Computer with Office 2010. Every time I click „new document", SharePoint opens the corresponding

  • Windows 7 driver issue with graphics card

    Currently windows 7 will not let me play most games because my graphics card(s)will not officially show up in my computer and system properties. I have installed boot camp drivers on windows, and searched nvidias site for a driver, but it still wont

  • Just did security update and restated now monitor is not working correctly

    Just did the latest security update (didn't catch the specific number), restarted my 1.83 GHZ macbook white, intel chip. Running 10.4.11. Monitor from has what appears to be scan lines at the bottom and are slowly creeping up the screen! Any help wou

  • Left a proof of purchase in my country!?but want to update the Mountain Lion OSX

    Emporium, PWM Apple Shop Emporium, 622 Sukhumviit RD., 4TH FL., The Emporium Department Store 10110 Tel. +6881 352 6418 I bought from this retail apple shop in Thailand but now I'm living in UK i need that proof of purchase in order to Update to the

  • JVM for AMD64 unable to load 32-bits DLL on Win64

    Hi all, I get an java.lang.UnsatisfiedLinkError while doing a System.loadLibrary() on Windows x64 (AMD64) with following message: %1 is not a valid win32 application Note the same DLL is successfully loaded by standard JVM (32-bits) on same OS. Anyon