Working with forms, buttons and text files

please am new to java am working on the project. please see sample below, can anyone tell me how i can get the button in form1 to open form2 and also how the information entered in the textfield can be written to a text file. THANKS
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Form1 extends JFrame
     static JFrame frame;
     static JPanel panel;
JLabel label;
     JTextField text;
     JButton btn;
     GridBagLayout g;
GridBagConstraints gbc;
     public Form1()
          label = new JLabel ("Label");
          gbc.gridx = 0;
gbc.gridy = 1;
g.setConstraints(label, gbc);
panel.add(label);
          text = new JTextField();
gbc.gridx= 1;
gbc.gridy = 1;
g.setConstraints(text, gbc);
panel.add(text);
          btn = new JButton ("CONTINUE");
          gbc.gridx = 0;
          gbc.gridy = 2;
          g.setConstraints(btn, gbc);
          panel.add(btn);
import java.awt.event.*;
public class Form2 extends JFrame
     static JFrame frame;
     static JPanel panel;
JLabel label;
     JTextField text;
     JButton btn;
     GridBagLayout g;
GridBagConstraints gbc;
     public Form2()
          label = new JLabel ("Label2");
          gbc.gridx = 0;
gbc.gridy = 1;
g.setConstraints(label2, gbc);
panel.add(label2);
          text2 = new JTextField();
gbc.gridx= 1;
gbc.gridy = 1;
g.setConstraints(text2, gbc);
panel.add(text2);
}

please am new to java am working on the project.
please see sample below, can anyone tell me how i can
get the button in form1 to open form2 For opening form2 from form1 you can add a actionListener to the button.When the button is pressed instantiate the other class and render it visible which i leave it to you to implement.
and also how
the information entered in the textfield can be
written to a text file. THANKSUse getText ( ) method of JTextField to retrieve the text from it and then it's ordinary file io operations for which i guide you to the tutorials here
http://java.sun.com/docs/books/tutorial/essential/io/index.html

Similar Messages

  • Working with multiplie Panels And C Files

    Hi !
    I have a general question...
    I'm workign with CVI 9.1 , and i have serveral C files .
    At the main.c file I'm loading all my panels for ex Panel Name - PREF, Panel Handle - panelPrefHandle
    At the service.c file I'm trying to use GetCtrlVal(panelPrefHandle,....,...);
                                                  OR  GetCtrlVal(PREF,....,...);
    At service.c i'm including #include "main.h"
    Still I'm getting the error :
    NON-FATAL RUN-TIME ERROR:   "Service.c", line 677, col 29, thread id 0x00000D30:   Library function error (return value == -42 [0xffffffd6]). The handle is not a panel handle
    so my question is how can i pass panel handel over serveral c files ?
    Kobi Kalif
    Software Engineer

    Hi,
    you need to include the include file of the panel: if you build and save a panel in the UIR editor, a corresponding *.h file is generated; you need to include this file in the *.c file which will access this panel, because the panel name etc. are defined in the panels' include file.
    Hth, Wolfgang

  • I am working with Acrobat XI and when I try to add text to geopdf file I get a popup screen that says this is a secured document and editing is not permitted. How do I fix this?

    I am working with Acrobat XI and when I try to add text to a geopdf file I get a popup screen that says this is a secured document and editing is not permitted. How do I fix this?

    I figured it out...needed to use comment tool set, not the editing tool set.

  • Looking to create editable PDF forms with drop downs and text boxes for use on a Mac computer and iPad. Which product do I need to purchase? Do not need anything fancy

    Looking to create editable PDF forms with drop downs and text boxes for use on a Mac computer and iPad. Which product do I need to purchase? Do not need anything fancy

    Basically you would need Acrobat. However, it is now also possible to create basic form fields using just the free Reader. In fact, I've been working on a tool that allows you to do it, so if you're interested in it please contact me privately.

  • I have just intalled PSElements 12 on a new PC with windows 8.1. It installed ok but when I open it up it displays different than on my windows 7 PC. The buttons and text are tiny and almosy impossible to see even when I drag it to full screen. How do I a

    I have just intalled PSElements 12 on a new PC with windows 8.1. It installed ok but when I open it up it displays different than on my windows 7 PC. The buttons and text are tiny and almosy impossible to see even when I drag it to full screen. How do I adjust it to look normal?

    Hi Paul ,
    It could be a compatibility issue as well as Acrobat 8 is an older version.
    Do you get any error message while registering for the product?
    Try repairing it and once and also check for updates as well.
    Is it happening with all the word files or any specific one'?
    Regards
    Sukrit Dhingra
    Acrobat 8 and Windows 7 Don't Work

  • How to convert a Form to a Text file and XML file?

    Hi:
    I want to convert a Form to a Text file and XML file,but I don't know how convert?
    Please help!
    Oracle Form Builder V10.1.2.0.2
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
    Thanks in advance!

    ..or follow the steps in Mtalink note; Doc ID: Note:196924.1
    Forms XML Conversion Feature ( Converting Forms To XML)

  • Problem with ASP "Create form wizard" or "Update form wizard" and "Upload file"

    Until now it used version 3,7 and dinamyc had never had problems with "Create form wizard" or "Update form wizard" and "Upload file" but now when I create the form and shipment a file leaves an error to me:
    Error:
    Error al borrar directorio. Error de seguridad.
    Developer Details:
    Error al borrar directorio. Error de seguridad. El directorio 'E:\web\eds\maqueta\' esta fuera del directorio base 'E:\web\eds\maqueta\fotosactivi2\'. (FOLDER_DEL_SECURITY_ERROR)
    tNG Execution Trace - VIEW
    * tNG_insert.executeTransaction
    o STARTER.Trigger_Default_Starter
    o tNG_insert.doTransaction
    + BEFORE.Trigger_Default_FormValidation
    + tNG_insert.prepareSQL
    + tNG_insert.executeTransaction - execute sql
    + tNG_insert.postExecuteSql
    + AFTER.Trigger_FileUpload*
    + ERROR.Trigger_Default_Insert_RollBack
    * tNG_insert.getRecordset
    * tNG_insert.getFakeRsArr
    * tNG_insert.getLocalRecordset
    * tNG_insert.getFakeRecordset
    * tNG_insert.getFakeRecordset

    Hello,
    Please see this thread http://www.adobeforums.com/cgi-bin/webx/.3bc3c678/2
    for the same problem.
    Regards,
    Razvan RACASANU

  • Buttons and text items on oracle forms 6i

    can i create dynamic buttons and text fields on oracle forms 6i.
    i mean when i insert record in database then automatically creat a button on form.
    Regards
    Munawer hussain

    Hi,
    One physical button is enough for a series of "functional buttons" per amount of simultanious visisble buttons. You can change the button prompt at run-time depending on a certain condition. That same condition can also be used when executing the when-button-pressed (wbp) trigger.
    Example:
    suppose you have 2 functions that you want to create buttons for: enter query and execute query. Only 1 button is visible at one time. In design time you create 1 button. In run-time, depending on :system.mode you set the button prompt to "enter query"or "execute query" and in the wbp trigger you write
    begin
    if :system.mode = 'QUERY'
    then
    execute_query;
    else
    enter_query;
    end if;
    end;
    Kind regards
    .

  • Can I share files from other programs or just Adobe apps files. I work with Final Cut and Premiere X

    Can I share files from other programs or just Adobe apps files. I work with Final Cut and Premiere X.? Need to share files up to 6GB.
    I need to know if the 20 gb limit is about all that I share, or if it's just about whatis in the clouds. If I take, recover my limit?
    The speed of upload e download is good?

    The Creative Cloud file storage could be used for video assets but speed and performance might vary based on location. I would suggest you testing it out yourself using your Adobe ID before subscribing. Performance would not change after you joined.
    -Dave

  • Since downloading Yosmite on my MAC I have not been able to download photos to LR 5. Error message: "the following files were not imported because they could not be read (335).I have been working with several forums and have dtried going into preference

    LR 5 - using it on a MAC-
    Error message: "the following files were not imported because they could not be read (335).
    I have been working with several forums and have tried all recommendations and none have worked.
    I have tried reloading new LR 5 - and it worked for a short time and then stopped.
    Very frustrated that I cannot talk with someone at Adobe.
    The folks that have made recommendations are great but once their suggestions dont work they drop the link,
    Is there someone or someplace I can take my computer to fix this issue.
    It seems to be a problem between LR and Yosemite.

    The permissions have been changed on the destination folder where the photos are to be copied into.
    You must make sure that the permissions are set to Read and Write.
    Or perhaps the destination folder has been changed accidentally to something else, and you need to change it back to whatever it used to be.

  • Ok.  I hope someone can answer my question.  I am new to photoshop.  I need version cs4 in order to work with a designer and printer on some logo work. I've tried to download it but it just gives me individual files with no installer and nothing - includi

    ok.  I hope someone can answer my question.  I am new to photoshop.  I need version cs4 in order to work with a designer and printer on some logo work. I've tried to download it but it just gives me individual files with no installer and nothing - including the adobe "instructions" seems to work.  How can i get this software in a downloadable format? is it actually free - I'm assuming it is...  Hope someone knows the answer to these questions...

    The download itself is free and is valid for 30 days only.  After that, the software ceases to work.
    CS4 is pretty old, no longer sold and no longer supported by Adobe.  It's also not compatible with many modern OSes.
    Why do you have to work with such an obsolete version of Photoshop?
    What kind of "designer" uses it?

  • I was online earlier this week and liked the forms with submit buttons and the Adobe site directed me to upgrade to Adobe PRO XI in order to use forms so I bought five licenses. Just had it installed today and it is now asking me to sign up for forms Cent

    I was online earlier this week and liked the forms with submit buttons and the Adobe site directed me to upgrade to Adobe PRO XI in order to use forms so I bought five licenses. Just had it installed today and it is now asking me to sign up for forms Central in order to use this feature. What gives? The Adobe site gave me the impression that I would have this feature after purchasing the new upgrade. I would not have purchased the upgrade, let alone five of them had I know this. Am I missing something?

    Acrobat XI comes with the Fromscentral AIR application and the ability to create PDF forms authored in Formscentral. To have more than the free (1 form with 50 responses) level account you need to sign up for a Formscentral subscription.
    Andrew

  • Hi, I have iPad 2 and iPhone 4S and I have a problem a camera problem it doesn't work when I try try to open it it reclose also I can't close my iPad with upper button and I can't restart

    Hi, I have iPad 2 and iPhone 4S and I have a problem a camera problem it doesn't work when I try try to open it it reclose also I can't close my iPad with upper button and I can't restart help me

    - Reset the iOS device. Nothing will be lost.
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                             
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar                       

  • Populating a form from a text file

    I have an Oracle form which schedules students into courses. The form collects the student id, name, school, and course code. A "RUN" button then does the scheduling. The form is not a table, meaning the data is not all stored together in an Oracle table. The user currently has to manually enter each piece of information before a student can be scheduled. I would like to be able to auto populate this form/screen with data from a text file. I cannot use SQL Loader since the data is not going into a table. Is there a way to take my text file and make it appear on the form/screen when the form opens? Then my user just has to click the RUN button in order to schedule the students instead of hand entering all the data.
    Any help on this would be greatly appreciated!
    -NTW

    hi
    USING THE TEXT_IO PACKAGE
    Abstract: This document describes the functionality of the TEXT_IO
    package and explains how to use it to access the file
    system effectively.
    Keywords: TEXT_IO;FILE;IO;PACKAGE
    Using the TEXT_IO Package
    =========================
    Oracle Procedure Builder, "an integrated, interactive environment for
    PL/SQL", is shipped with several built-in packages which, if used
    properly, can greatly boost development productivity. These built-in
    packages are not installed as extensions to the STANDARD package;
    hence, when you reference a construct from any of these packages, you
    must prefix the package name to the construct.
    TEXT_IO provides constructs that allow programmers to read information
    from and write information to a file system. The procedures and
    functions in TEXT_IO fall into the following three categories:
    Category 1: File Operations
    FILE_TYPE - Declares a file type variable as a handle to the file being
    processed.
    Syntax: TEXT_IO.FILE_TYPE;
    FOPEN - Opens a file and returns a handle to the specified file of
    type FILE_TYPE.
    Syntax: TEXT_IO.FOPEN(file_specs VARCHAR2, file_mode VARCHAR2);
    The file mode can be R(read), W(write) or A(append).
    FCLOSE - Closes an open file.
    Syntax: TEXT_IO.FCLOSE(file_specs VARCHAR2);
    IS_OPEN - Checks if the specified file is currently open and returns a
    boolean.
    Syntax: TEXT_IO.IS_OPEN(file_type FILE_TYPE);
    Category 2: Output Operations
    PUT - Concatenates the supplied data to the current line of an open file.
    Syntax: TEXT_IO.PUT(file FILE_TYPE, data DATA_TYPE)
    Valid data types are VARCHAR2, DATE, NUMBER, PLS_INTEGER.
    All data except VARCHAR2 is converted to a character string.
    PUTF - Formats and writes a character string to an open file,
    doing a C-like substitution.
    Syntax: TEXT_IO.PUTF(file FILE_TYPE, format VARCHAR2,
    arg1[,...,arg5] VARCHAR2);
    Format is an optional parameter. If it is omitted, only
    one argument value can be passed.
    You can embed up to 5 "%s" patterns within the format string,
    which can be replaced by the corresponding strings
    (arg1 ... arg5) at execution.
    PUT_LINE - Concatenates the given argument string to the file
    followed by a newline character.
    Syntax: TEXT_IO.PUT_LINE(file FILE_TYPE, data VARCHAR2);
    NEW_LINE - Concatenates n number of newline characters to the current line,
    where n is the second argument with a default value of 1.
    Syntax: TEXT_IO.NEW_LINE(file FILE_TYPE, n PLS_INTEGER := 1);
    Note: If the file name is not specified each of the above cases, the
    output is directed to the Interpreter.
    Category 3: Input Given Operations
    GET_LINE - Reads a line from an open file into the parameter.
    Syntax: TEXT_IO.GET_LINE(file FILE_TYPE, data_item OUT VARCHAR2);
    Note: After a GET_LINE call, the file pointer moves to the next
    line and subsequent lines are read in after each call. If the
    line to be read exceeds the size of data_item, the VALUE_ERROR
    exception is raised. If no more characters can be read from the
    file, the NO_DATA_FOUND exception is raised. You cannot move this
    pointer back to the previous line though this can be simulated
    using your own buffer scheme.
    If a file name is provided for any of the above routines, this file
    must be accessible to Oracle Forms. In addition, you must provide the
    complete path. If no path is given, Forms assumes the file is in the
    current working directory and does not search for the file in the file
    system. The accessibility is determined as follows:
    On Windows, a TEXT_IO package function call only accesses local
    drives. It does not recognize any Universal Naming Conventions like
    \\machine_name\drive_letter. To access files on remote machines using
    the TEXT_IO package, map a letter to the remote drive through the File
    Manager.
    On UNIX, the absolute path must be given for the location of the file.
    Forms does not recognize relative paths provided for the file. This is also
    the case for VMS and other platforms. When you do not specify a path, Forms
    assumes the file is in the current working directory.
    For more information, refer to the TEXT_IO Package section in the
    "Oracle Procedure Builder Packages" chapter of the Oracle
    Developer/2000 Procedure Builder Developer's Guide Manual.
    Sample Form
    The following sample form explains some of the concepts and the
    syntax. The form reads in lines from a specified text file one at a
    time and displays them in a text item. It enables the user to parse
    the file by getting the next or the previous line. In addition, the
    user can write any line currently displayed to a specified output
    file.
    Create a single non-base table block. Put the following items and
    buttons on it. Create the appropriate boilerplate text for each item.
    All items go on the same canvas. No database connection is required
    for this application.
    Create the following text items:
    1. Name INPUT_FILE_SPECS
    Item Type Text Item
    Data Type Char
    Maximum Length 30
    2. Name LINE_READ
    Item Type Text Item
    Data Type Char
    Maximum Length 300
    3. Name OUTPUT_FILE_SPECS
    Item Type Text Item
    Data Type Char
    Maximum Length 30
    4. Name LINE_NO
    Item Type Text Item
    Data Type Number
    Maximum Length 30
    Create the following buttons and associated triggers:
    1. Name OPEN_AND_READ_FROM_FILE
    Label Echo file using TEXT_IO package
    Associated Button Trigger:
    Name WHEN-BUTTON-PRESSED
    Trigger Text:
    IF :input_file_specs IS NOT NULL THEN
    :line_no := 1;
    ECHO_TEXT_IO;
    ELSE
    MESSAGE('You must enter a valid input file name
    with a complete path');
    END IF;
    2. Name NEXT
    Label NEXT LINE
    Associated Button Trigger:
    Name WHEN-BUTTON-PRESSED
    Trigger Text:
    :line_no := :line_no + 1;
    ECHO_TEXT_IO;
    3. Name PREVIOUS
    Label PREVIOUS LINE
    Associated Button Trigger:
    Name WHEN-BUTTON-PRESSED
    Trigger Text:
    IF :line_no = 1 THEN
    MESSAGE('You are on the first line of the file.');
    ELSE
    :line_no := :line_no - 1;
    TEXT_IO.FCLOSE(variable_declarations.infile);
    /* Close the file then reopen it with the
    ECHO_TEXT_IO package. This resets the
    file pointer. */
    ECHO_TEXT_IO;
    END IF;
    4. Name WRITE_LINE_TO_FILE
    Label WRITE CURRENT LINE TO Output FILE
    Associated button trigger:
    Name WHEN-BUTTON-PRESSED
    Trigger Text:
    IF :output_file_specs IS NOT NULL THEN
    write_to_file;
    ELSE
    MESSAGE('Must enter a valid output file name with
    complete path');
    END IF;
    Create the following program units and package specifications:
    1. ECHO_TEXT_IO* (Procedure Body)
    PROCEDURE echo_text_io IS
    -- infile TEXT_IO.FILE_TYPE; /* Not used in this program */
    linebuf VARCHAR2(300);
    line_counter INTEGER;
    BEGIN
    line_counter := 0;
    Note that the IF condition would be redundant if you use
    a local variable (commented out above) to save the file pointer.
    Infile is a local variable, so the binding would be lost each
    time you exited the program. The use of package variables
    to act as global file type handles resolves this problem.
    IF TEXT_IO.IS_OPEN(variable_declarations.infile) THEN
    If the file is open, read in the next line.
    TEXT_IO.GET_LINE(variable_declarations.infile, linebuf);
    line_counter := line_counter + 1;
    ELSE
    The file is closed for the application when you display the
    previous line; see the WHEN_BUTTON_PRESSED trigger on the
    PREVIOUS item. Since the file pointer cannot move
    backwards, you must reset the file pointer and loop to the
    specified line.
    variable_declarations.infile := TEXT_IO.FOPEN(:INPUT_FILE_SPECS, 'r')
    -- variable_declarations.infile := TEXT_IO.FOPEN('c:\autoexec.bat', 'r')
    /* You can also hard-code the value */
    WHILE line_counter < :line_no LOOP
    TEXT_IO.GET_LINE(variable_declarations.infile, linebuf);
    line_counter := line_counter + 1;
    END LOOP;
    END IF;
    :line_read := linebuf;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    MESSAGE('End Of File reached.');
    :line_no := :line_no - 1;
    WHEN OTHERS THEN
    MESSAGE('UNHANDLED EXCEPTION RAISED in ECHO_TEXT_IO
    procedure - Check the file name');
    MESSAGE('U. E. R.');
    END;
    2. VARIABLE_DECLARATIONS (Package Spec)
    PACKAGE variable_declarations IS
    The following declarations are public and, hence, visible
    to the Forms application.
    infile TEXT_IO.FILE_TYPE;
    outfile TEXT_IO.FILE_TYPE;
    line_number NUMBER;
    END;
    3. WRITE_TO_FILE* (Procedure Body)
    PROCEDURE write_to_file IS
    BEGIN
    IF NOT TEXT_IO.IS_OPEN(variable_declarations.outfile) THEN
    variable_declarations.outfile := TEXT_IO.FOPEN(:OUTPUT_FILE_SPECS, 'a');
    END IF;
    TEXT_IO.PUT_LINE(variable_declarations.outfile, :line_read);
    END;Sarah

  • Saving report as PDF and text file

    Currently, I saved my report as PDF. It opens in Acrobat reader automatically when the report is executed. Is there a way for me to save it as PDF and as a text file at the same time? (without having to open the file in Acrobat reader and saving it)

    You can add your PDF and TEXT file formats to a distribution list (Instead of GENERATE REPORT TO A FILE). To do this:
    1. Go to your Object Navigator and highlight your report.
    2. Right click on your report. Select Property Palette.
    3. Select Distribution
    4. You can add of of the formats that you want to print or save to the report to.
    5. You will have to add Distribution Id (any number starting with 1) where you want the file to be saved (c:\my_reports\inventory.pdf), the type of file: PDF and how many copies you want: 2
    6. Click OK after finishing...
    To make it work ... You would highlight your report from your Object Navigator and then choose FILE-DISTRIBUTE and this will save it to all the files your specified and/or printer.
    null

Maybe you are looking for

  • How to select LOV items from edit report / form?

    I'm new to ApEx 3 with very little web developer knowledge. I have a create record form (Page1) that uses single-select and multi-select LOVs and correctly inserts the data into a table. I have a basic report (tabular form) (Page2) that shows the rec

  • Control-C in SQL*Plus on Windows

    Hi, I use the "command-line-looking" sqlplus.exe (not sqplplusw.exe) Client version 10.2.0.1.0 on my Win-XP PC. An annoying "feature" of this SQL*Plus, is that it closes when I press ctrl-c. For example, when a multiple-lines output is running in the

  • I cannot create a destination...

    I am able to follow through on Week 6 Unit 2 until Ihave to create a destination... The issue is I cannot change the authentication from "no authentication" to anything else... I am trying to set it to "basic authentication"... I was able to find the

  • Help,  leopard killed my mail!

    I just installed 10.5 leopard on my Macbook. When I ran mail, I get the following warning in duplicate..and as I close the warning, mail crashes and I get a window asking if I want to relaunch it, which I do and then the same thing happens. Any sugge

  • Tell if it's bevore lunch or after by yes and no

    Hi there ! ok, I have a table: A=time (07:54 am) B=Value Now I want to pick out the values before 01:00 pm. THerefore I formatted these times as 24h values without any symbols: (07:54 am) -> 0754. I tried "=IF(A1>=1300 ;1;0)" but it returns an error.