Formatting using ItemListener

Hi, I am working on a program where the user clicks a radio button (one of the 4 available, the correct one is known using the if statement) and a picture at the bottom of the screen changes its location and overlaps the picture next to it. The problem is, that as i am writing the code for the clicking of the correct radio button in the 'public void itemStateChanged (ItemEvent e)' method, I am unable to define the new co-ordinates of the picture in that method. So basically, I want to be able to change the co-ordinates of a picture when the user clicks one of the radio buttons. Any help would be very appreciated, here is the code:
public void init ()
gr.drawImage (darkgreen, 888, 560, 74, 768, this);
gr.drawImage (red, 962, 560, 74, 768, this);
public void itemStateChanged (ItemEvent e)
Checkbox cb = (Checkbox) e.getSource ();
if (cb == oneA)
twoA.setEnabled(twoA.isEnabled()?true:true);
twoB.setEnabled(twoB.isEnabled()?true:true);
twoC.setEnabled(twoC.isEnabled()?true:true);
twoD.setEnabled(twoD.isEnabled()?true:true);
gr.drawImage (red, 888, 560, 74, 768, this);

Import java.awt.*;
Graphics g;
//     Create an action for each radio button
      Action action1 = new AbstractAction("RadioButton Label1") {
           // This method is called whenever the radio button is pressed
           public void actionPerformed(ActionEvent evt) {
               g.drawImage(image, x, y, this);
      Action action2 = new AbstractAction("RadioButton Label2") {
           // See above
           public void actionPerformed(ActionEvent evt) {
               g.drawImage(image, x, y, this);
      // Create the radio buttons using the actions
      JRadioButton b1 = new JRadioButton(action1);
      JRadioButton b2 = new JRadioButton(action2);
      // Associate the two buttons with a button group
      ButtonGroup group = new ButtonGroup();
     group.add(b2);
      group.add(b1);
   

Similar Messages

  • Help needed  while exporting crystal reports to HTML file format using java

    Help needed  while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
    html file of the report
    thanks

    the ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
    Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM

  • How can i convert oracle report in excel format using 8i

    hi,
    I want to convert oracle report in excel format using 6i reports. please give the solution with emp table.
    millons of thanks in advance.

    You'll have to use the destype DELIMITEDDATA to render your Report in CSV format. Then set the mime type to Excel. I don't know the exact syntax, so please do a search in metalink for "reports excel" for examples and more info.
    Regards,
    Martin Malmstrom

  • Formatting using JFormattedTextField

    Hi everyone , I'm trying to create a JFormattedTextField wich accepts only number and have a limited size and if the user didn't fill all field, I want this fields stillValid..
    JFormattedTextField fmtNumer = new JFormattedTextField(new MaskFormatter("###,###");
    Thanks.

    Set the format using a DecimalFormat. Set the document to be one that allows a limited size.
    public class DocumentSizeFilter extends DocumentFilter {
          * Allows unlimited text.
         public static final int UNLIMITED_TEXT = -1;
                   private int maxCharacters;
        private boolean DEBUG = false;
         * Default constructor. Does not limit size of document.
        public DocumentSizeFilter() {
           this(UNLIMITED_TEXT);
         * Constructor
         * @param maxChars the maximum number of characters to allow
        public DocumentSizeFilter(int maxChars) {
            maxCharacters = maxChars;
         //     ------------------------  Methods ---------------------------
         * Set the maximum number of characters allowed.
         * <B>UNLIMITED_TEXT<\B> specified unlimited text size.
         * @param maxChars the maximum number of characters to allow
        public void setMaxSize (int maxChars) {
            maxCharacters = maxChars;
        public void insertString(FilterBypass fb, int offs,
                                 String str, AttributeSet a)
            throws BadLocationException {
            if (DEBUG) {
                System.out.println("in DocumentSizeFilter's insertString method");
            //This rejects the entire insertion if it would make
            //the contents too long. Another option would be
            //to truncate the inserted string so the contents
            //would be exactly maxCharacters in length.
            if (maxCharacters == UNLIMITED_TEXT ||
                      (fb.getDocument().getLength() + str.length()) <= maxCharacters)
                super.insertString(fb, offs, str, a);
            else
                Toolkit.getDefaultToolkit().beep();
        public void replace(FilterBypass fb, int offs,
                            int length,
                            String str, AttributeSet a)
            throws BadLocationException {
            if (DEBUG) {
                System.out.println("in DocumentSizeFilter's replace method");
            //This rejects the entire replacement if it would make
            //the contents too long. Another option would be
            //to truncate the replacement string so the contents
            //would be exactly maxCharacters in length.
            if (maxCharacters == UNLIMITED_TEXT ||
                      (fb.getDocument().getLength() + str.length()
                 - length) <= maxCharacters)
                super.replace(fb, offs, length, str, a);
            else
                Toolkit.getDefaultToolkit().beep();
              textFilter = new DocumentSizeFilter(/*num characters to allow*/);
              AbstractDocument doc;
              Document doci = getDocument();
              if (doci instanceof AbstractDocument) {
                   doc = (AbstractDocument) doci;
                   doc.setDocumentFilter(textFilter);
              }

  • How to read from a xml file(in String format) using a java program

    hi friends
    i have a string , which is xml format. i want read the values and display it.can any one suggest how to read a xml file of string format using a javaprogram
    thanks

            final DocumentBuilder db =  DocumentBuilderFactory.newInstance().newDocumentBuilder();      
            final InputStream documentStream = new ByteArrayInputStream(documentXMLSourceString.getBytes("utf-8"));
            final Document document = db.parse(documentStream);

  • How to burst reports in text and XML format using API

    Hi there,
    I need to be able to burst PDF, Excel etc reports and at the same time, generate XML files containing metadata that will accompany the PDF files to their destination. The reason for this, is that the destination requires metadata to class the documents in the content management system.
    My issue is that I just cannot get bursting to XML, text or HTML format right. There is very little documentation available around creating reports in these formats using the API's and perhaps someone who has gotten this right can, once and for all, solve this issue where others can find the solution.
    Alright, here is some sample supporting documentation (For the sake of the question, I have removed the bursting to PDF, Excel etc. formats and I am just focusing on the XML output):
    In my code for bursting, I make use of the following constructor...
    DocumentProcessor dp =
    new DocumentProcessor("ControlFile.xml", "TestData.xml", "temp");
    The ControlFile.xml looks like this...
    <?xml version="1.0" encoding="UTF-8"?>
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
    _<xapi:request select="/DATA/LIST_BRANCH/BRANCH">
    ___<xapi:delivery>
    ______<xapi:filesystem id="dst" output="C:\${BRANCH_NAME}.xml"/>
    ___</xapi:delivery>
    ___<xapi:document output-type="text" delivery="dst">
    ______<xapi:template type="xsl-fo" location="Template.xsl"></xapi:template>
    ___</xapi:document>
    _</xapi:request>
    </xapi:requestset>
    The data in my TestData.xml looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <DATA>
    ___<LIST_BRANCH>
    ______<BRANCH>
    __________<BRANCH_NAME>BRANCH 1</BRANCH_NAME>
    ______________ OTHER IRRELEVANT DATA
    ______</BRANCH>
    ______<BRANCH>
    __________<BRANCH_NAME>BRANCH 2</BRANCH_NAME>
    ______________ OTHER IRRELEVANT DATA
    ______</BRANCH>
    ___</LIST_BRANCH>
    </DATA>
    In my ControlFile.xml, I reference my XSL file called Template.xsl which should do my transformations into XML. That file looks like:
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    __<xsl:output method="xml" indent="yes">
    __<xsl:template match="/">
    ____<METADATA>
    _______<BRANCH>
    ___________<xsl:value-of select="BRANCH_NAME"/>
    _______</BRANCH>
    ____</METADATA>
    __</xsl:template>
    </xsl:stylesheet>
    I have tried about forty variations of the ControlFile.xml and Template.xsl and have had no luck. Among the various error messages that the compiler has reported to me, these are the most common:
    [101507_055953158][][EXCEPTION] Error while generating the Document...
    [101507_055953158][][EXCEPTION] org.xml.sax.SAXException: element metadata is not supported yet.
    [101507_061037084][][EXCEPTION] Error while generating the Document...
    [101507_061037094][][EXCEPTION] oracle.xml.parser.v2.XMLParseException: Start of root element expected.
    I have managed in some cases to get the API code to compile, but the outputs are empty 0kb files.
    I have also exported an XSL-FO file from word, but the output is always PDF even with tweaking.
    I have wasted about 9 hours on this problem and it is driving me mad! If anyone has ideas, tips and/or solutions, they would be very welcome.
    Thanks in advance,
    Andrew

    For anyone interested... here it is!
    Format Setup:
    <TEMPLATE TYPE> DELIMITER_BASED
    <OUTPUT CHARACTER SET> iso-8859-1
    <NEW RECORD CHARACTER>     Carriage Return
    Sequences:
    <DEFINE SEQUENCE> MetaDataSeq
    <RESET AT LEVEL>     BRANCH
    <INCREMENT BASIS> LEVEL
    <END DEFINE SEQUENCE> MetaDataSeq
    Format Data Records:
    <LEVEL> BRANCH
    <MAXIMUM LENGTH><FORMAT><DATA>
    <NEW RECORD> FileHeaderRec
    16_________________Alpha_____‘<REPORT_SUMMARY>’
    22_________________Alpha_____‘<TYPE>1</TYPE>’
    255________________Alpha_____'<NAME>’ || BRANCH_NAME || ‘.pdf</NAME>’
    255________________Alpha_____'<DESC>NON-MOTOR VEHICLE CLAIMS</DESC>’
    10_________________Alpha_____‘<METADATA>’
    255________________Alpha_____‘<CONTROL_AREA>MAIN CONTROL AREA</CONTROL_AREA>’
    255________________Alpha_____‘<BRANCH_CODE>’ || BRANCH_CODE || ‘</BRANCH_CODE>’
    255________________Alpha_____‘<BRANCH_NAME>’ || BRANCH_NAME || ‘</BRANCH_NAME>’
    255________________Alpha_____'<DIVISION_CODE>1</DIVISION_CODE>’
    255________________Alpha_____‘<DIVISION_NAME>PERSONAL</DIVISION_NAME>’
    11_________________Alpha_____‘</METADATA>’
    17_________________Alpha_____‘</REPORT_SUMMARY>’
    <END LEVEL> BRANCH

  • How to convert Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2 ?

    Hi,
    I am getting the error "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."
    when converting date in format Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2.
    Please note that the date in column is Date(varchar(50), null).
    I used the following syntax:
    SELECT  CONVERT(VARCHAR(10), Date, 102) AS Day
    FROM   dbo.[RCap_2G MM/Operator]
    WHERE  (CONVERT(VARCHAR(10), Date, 102) > { fn NOW() } - 1)

    As noted above, either use ISDATE or TRY_CONVERT with the correct conversion style number:
    -- SQL Server 2012 code
    DECLARE @Date varchar(50) = '10/23/2006 10:20';
    SELECT TRY_CONVERT(DATE, @Date, 101) AS Day
    -- 2006-10-23
    Datetime conversion blog:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Raw files from the new Nikon D810 will not open with either Photoshop CS5.1 or Lightroom 4.  When will a real Adobe solution be available to work with Raw (NEF) files in their native format, using CS5.1 and LR4?

    Raw files from the new Nikon D810 will not open with either Photoshop CS5.1 or Lightroom 4.  When will a real Adobe solution be available to work with Raw (NEF) files in their native format, using CS5.1 and LR4?

    Clarification: this is a user forum; you are not addressing Adobe here.
    The answer to your question as phrased is: never.
    CS5 is history and it is not longer supported.  There will not be any updates or bug fixes for CS5.
    You need to convert the raw NEF files from your D810 to raw DNGs using the free, standalone Adobe DNG Converter 8.6 RC (beta), the first version ever to support that camera.. 

  • My iPod nano needs to be format, but it doesn't format using fat 32. And it says that it is corrupted. What should I do?

    My iPod nano needs to be format, but it doesn't format using fat 32. And it says that it is corrupted. What should I do?
    As I connect it to itunes, it shows that it needs to be format. When I try to format it (fat32) it doesn't finish. And it says, the ipod appears to be corrupted.

    similar to what is happening to me....the difference is, after restoring itunes detect ipod and ask to restore again and again....
    I know it may look kinda stupid but: just leave the ipod there for about 2 minutes, that's about the time my itunes is taking to detect my ipod...if it doesn't work, try connecting ur ipod to other computer with itunes (no need to sync, just to check if itunes will recognize) to check if the problem is with the ipod or with the itunes and/or computer.

  • When trying to open a PDF format using Adobe XI I get an error message that there's a problem opening the document (57)

    When trying to open a PDF format using Adobe XI I get an error message that there's a problem opening the document (57)

    Hi chasore,
    Are you still facing this issue?
    Is this issue happening with all the documents you have. If yes, i would suggest try uninstall and reinstall. Or if the documents are located on some shared drive try to copy them on local machine and test again.
    Regards,
    Ajlan Huda.

  • How to print form into pdf format using smart forms in abap

    please let me know how to print form into pdf format using smart forms in abap.
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 25, 2011 2:04 PM

    Hi ,
    refer this link
    <removed by moderator>
    Regards,
    Dhina..
    Moderator message: please do not reply to questions that violate forum rules.
    Edited by: Thomas Zloch on Mar 25, 2011 2:04 PM

  • Used to convert all my videos into iPhone mp4 format using Any Video Converter - then add it to my iPhone 3GS. But last few days, I cant add video files to iTunes. and the iTunes doesnt even specify the reason except for that "files are not supported"

    Everyting was perfect earlier. Used to convert all my videos into iPhone mp4 format using Any Video Converter - then add it to my iPhone 3GS. But last few days, I cant add video files to iTunes. and the iTunes doesnt even specify the reason except for that "files are not supported"
    Everything is fine.
    -They are the right format
    -Quicktime is updated
    -I have tried simply dragging them into the 'movie' library
    -I have tried going to file<add file to library
    Nothing works, has anyone else had this problem and found a way around it?
    Any and all help appreciated.

    In addition to Mike's suggestions,  you only have 4GB of RAM and Mavericks does use more RAM than other versions. You may also want to look at the apps that startup on login and the possiblity of upgrading RAM.

  • Issue with character formats using duplex printing in smartform

    Hi all,
    I am getting a problem with character formats using duplex printing in smartform. I am using a text module with a bold character to display text in a window. The problem is that on the first back page,the text is being printed normally (without bold), but on the next pages, the back pages are being printed with the bold character format.
    Can anyone know where is the problem..please.
    Points to be rewarded..
    Thanks.
    Regards,
    Zaheed.

    Hi Zaheed,
    Normally this should not happen.. and also there is no internal formatting done by SAP.. it will show based on what fomatting option we have specified..
    If you are saying it is happening in ur case then
         1. Recheck whether whether you have same text module getting printed on the
             two page. If they are different then then individual check formatting option for
             each..
          2. If above point does'nt work for you ..then instead of bold char use normal
              format for text element and see if it is printing same on both page..
    Try this out and let us know your findings...
    Enjoy SAP.
    Pankaj Singh

  • Can firefox support "file:///" format to access local files (note 3 fw slashes) this works for IE but not firefox and is the format used in the "afghan war diary" from wikileaks

    can firefox support "file:///" format to access local files (note 3 fw slashes) this works for IE but not firefox and is the format used in the "afghan war diary" from wikileaks

    See http://kb.mozillazine.org/Links_to_local_pages_do_not_work

  • Writing to an Excel(xlsx,2007 format) using PL/SQL

    Hi,
    I have a new requirement in which I have to write to an excel ,.xlsx(2007 format). I am using Oracle 9i.
    When I try to write it to .xlsx it is writing but when i try to open the file it says "excel 2007 excel cannot open the file because the file format or file extension is not valid".
    I am using the following Stored Procedure:
    create or replace
    procedure myfilewrite( p_location IN varchar2,
    p_filename IN varchar2)
    IS
    v_disk_file utl_file.file_type;
    BEGIN
    v_disk_file := utl_file.fopen( location => p_location,
    filename =>p_filename,
    open_mode=>'W');
    utl_file.put_line(v_disk_file,'abc'||chr(13));
    utl_file.fclose(v_disk_file);
    EXCEPTION
    when utl_file.invalid_path then
    utl_file.fclose(v_disk_file);
    raise_application_error(-2001,'path error');
    when utl_file.invalid_operation then
    utl_file.fclose(v_disk_file);
    raise_application_error(-2002,'invalid operation error');
    when utl_file.write_error then
    utl_file.fclose(v_disk_file);
    raise_application_error(-2003,'write error');
    when utl_file.invalid_filehandle then
    utl_file.fclose(v_disk_file);
    raise_application_error(-2004,'filehandler error');
    when others then
    raise_application_error(-2005,'could not write to file');
    END;
    Please help me regarding this issue.
    Regards,
    RAJ

    user13529315 wrote:
    In the existing application we have been writing into .xls format using utl_file package.No you haven't. You have been writing a file in CSV format that is named with an XLS extension. File name does not equal file format, XLS is a binary format, UTL_FILE cannot write binary files.
    CSV - http://en.wikipedia.org/wiki/Comma-separated_values
    >
    A comma-separated values or character-separated values (CSV) file is a simple text format
    >
    XLS - http://en.wikipedia.org/wiki/Microsoft_Excel_file_format#File_formats
    >
    Microsoft Excel up until 2007 version used a proprietary binary file format called Binary Interchange File Format (BIFF) as its primary format.

Maybe you are looking for

  • A way of detecting the current Scene in a document class

    I just want to know if there is a way to this. Thanks,

  • Key Figures not showing in BEx Workbooks

    Hi, Recently we migrated the BW3.5 workbooks to BI7. After the migration and transportation of the workbooks to Quality system, in some of the workbooks the Key figures are not showing up and in some workbooks the key figures which are set as 'Hide"

  • JDBC locking access db

    i can create the table from jframe. i can open the program and instantly insert records, but if i insert a table, then try and insert records i get sqlexception error saying database is locked by othe process and I DON'T have Access open or another i

  • How to pass a complex type as input for a Java class in Oracle 11g?

    Hi All, This is my Parent Class.. package ADFapplnPackage.model; public class ParentClass { String Name; int age; public ParentClass() { super(); This is my ChildClass : package ADFapplnPackage.model; public class ChildClass { public ChildClass() { s

  • PNG files are grainy when opened in Illustrator.

    Files that I create in Photoshop and save as PNG files are grainy and colored incorrectly when opened in Illustrator. The files are fine when opened in other programs. Please see the pictures below to illustrate my point. These are the same file, how