JTextField and append

hi,
i've got a question: I'm looking a method in JTextField class similar to the append() in JTextArea.
I need to add a new chars to the end of my text in TextField. The method setText() doesn't work - it always clear the field and set the text at the beginning of my TextField
thanks a lot in advance
thud
Message was edited by:
thud_Mike

In the future, you can always look at the source code to see what the JTextArea append() method does and then use the same concept on JTextField.
Document doc = textComponent.getDocument();
doc.insertString( doc.getLength(), "whatever", null );

Similar Messages

  • Report Generation tool kit for MS office (Opening an existing excel file and appending to the bottom)

    I don't have any problems creating and filling an excel sheet with data. I use the New Report.vi, Easy Title.vi, and Easy Text.vi to create the file. I then save and dispose properly.
    What I don't seem to be able to do is open the exsting file and append data to the end of the sheet.
    Thanks in advance for your help.
    todd

    Hi Todd,
    You can do this by creating a new Excel report with the existing excel file path wired to the "template" input. Then use "Excel Get Last Row.vi" (located under Report Generation\Excel Specific\Excel General) to obtain the location of the last row. Then use that location to input new data into the file.
    Hope this helps,
    Dan

  • What is diff b/w Include Structure and Append Structure at Database Level

    Hi Experts,
    Could you please let me know what is the main difference between .Include Structure and .Append Structure at SE11?
    Thanks in advance and for good answer will give good points.
    Sekhar

    Hi,
    1. Append Structures
    Append structures can only be assigned to a single table.
    Append structures are created in the custome rnamespace ( ZZ or YY)
    In case of new versions of the standard table during upgrade, the append structures are automatically appended to the new version of the standard table
    Append structures can not be used with cluster and pool tables
    Append structures are created in transaction SE11. Display the standard table fields and press the Append structure button.
    When you press the button, SAP sugests a name for the new append structure. After you has accepted the name,
    a screen will be shown where you can enter the new fields.
    Remember to activate.
    2. Customizing Includes
    Some of the SAP standard tables contains special include statements called Customizing includes. In contrast to Append structures,
    Note that customizing includes are created by SAP, but the customer supply the fields for the include.
    Customizing includes begin with CI_ and is part of the customer namespace
    One Customizing include can be inserted into more than one table.
    You can find Customizing includes in SE11 under structures.
    Try to take a look at table RKPF which uses the Customizing include CI_COBL (In an IDES system). Next try to add a field to CI_COBL, and activate it. If you go back to table RKPF you will se that your new field has been added.
    Regards,
    Ferry Lianto

  • Reading values from JTextField and using them?

    Hello,
    I am trying to make a login screen to connect to an oracle database. Im pretty new to creaing GUI. I need help with reading the values from the JTextField and to be able to use them for my connection. So do I need to apply a listener? How do I go about doing that in this project. Thanks for any code or advice.
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.sql.*;
    public class UserDialog
        String databaseURL;
        String driver;
        String database;
        String username;
        String password;
        String hostname;
        String port;
        UserDialog() {
            getInfo();
        static String[] ConnectOptionNames = { "Login", "Cancel" };
        static String   ConnectTitle = "Login screen";
        public void getInfo() {
            JPanel      connectionPanel;
            JLabel     databaseURLLabel = new JLabel("Database URL:   ", JLabel.LEFT);
         JTextField databaseURLField = new JTextField("");
         JLabel     driverLabel = new JLabel("Driver:   ", JLabel.LEFT);
         JTextField driverField = new JTextField("");
            JLabel     databaseLabel = new JLabel("Database:   ", JLabel.LEFT);
         JTextField databaseField = new JTextField("");
            JLabel     usernameLabel = new JLabel("User Name:   ", JLabel.LEFT);
         JTextField usernameField = new JTextField("");
            JLabel     passwordLabel = new JLabel("Password:   ", JLabel.LEFT);
         JTextField passwordField = new JPasswordField("");
            JLabel     hostnameLabel = new JLabel("Host Name:   ", JLabel.LEFT);
         JTextField hostnameField = new JTextField("");
            JLabel     portLabel = new JLabel("Port:   ", JLabel.LEFT);
         JTextField portField = new JTextField("");
         connectionPanel = new JPanel(false);
         connectionPanel.setLayout(new BoxLayout(connectionPanel,
                                  BoxLayout.X_AXIS));
         JPanel namePanel = new JPanel(false);
         namePanel.setLayout(new GridLayout(0, 1));
         namePanel.add(databaseURLLabel);
         namePanel.add(driverLabel);
            namePanel.add(databaseLabel);
            namePanel.add(usernameLabel);
            namePanel.add(passwordLabel);
            namePanel.add(hostnameLabel);
            namePanel.add(portLabel);
         JPanel fieldPanel = new JPanel(false);
         fieldPanel.setLayout(new GridLayout(0, 1));
         fieldPanel.add(databaseURLField);
            fieldPanel.add(driverField);
            fieldPanel.add(databaseField);
            fieldPanel.add(usernameField);
         fieldPanel.add(passwordField);
            fieldPanel.add(hostnameField);
            fieldPanel.add(portField);
         connectionPanel.add(namePanel);
         connectionPanel.add(fieldPanel);
            // Connect or quit
            databaseURL = databaseURLField.getText();
            driver = driverField.getText();
            database = databaseField.getText();
            username = usernameField.getText();
            password = passwordField.getText();
            hostname = hostnameField.getText();
            port = portField.getText();
            int n = JOptionPane.showOptionDialog(null, connectionPanel,
                                            ConnectTitle,
                                            JOptionPane.OK_CANCEL_OPTION,
                                            JOptionPane.PLAIN_MESSAGE,
                                            null, ConnectOptionNames,
                                            ConnectOptionNames[0]);
            if (n == 0) {
                System.out.println("Attempting login: " + username);
                String url = databaseURL+hostname+":"+port+":"+database;
             // load the JDBC driver for Oracle
             try{
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                   Connection con =  DriverManager.getConnection (url, username, password);
                System.out.println("Congratulations! You are connected successfully.");
                con.close();
                System.out.println("Connection is closed successfully.");
             catch(SQLException e){
                System.out.println("Error: "+e);
            else if (n == 1)
                    System.exit(0);
        public static void main (String args []) {
             UserDialog ud = new UserDialog();
    }thanks again,
    James

    the reason why you can't get the text is because you are reading the value before some actually inserts anything in any fields.
    Here is what you need to do:
    Create a JDialog/JFrame. Create a JPanel and set that panel as contentPane (dialog.setContentPane(panel)). Insert all the components, ie JLabels and JTextFields. Add two buttons, Login and Cancel to the panel as well. Now get the username and password field values using getText() inside the ActionListener of the Login.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class LoginDialog extends JDialog
    String username, password;
      public LoginDialog( ){
        setTitle( "Login" );
        JPanel content = new JPanel(new GridLayout(0, 2) ); // as many rows, but only 2 columns.
        content.add( new JLabel( "User Name" ) );
        final JTextField nameField = new JTextField( "" );
        content.add( nameField );
        content.add( new JLabel( "Password" ) );
        final JTextField passField = new JTextField( "" );
        content.add( passField );
        JButton login = new JButton( "Login" );
        login.addActionListener( new ActionListener(){
          public void actionPerformed( ActionEvent ae ){
            username = nameField.getText();
            password = passField.getText();
            // call a method or write the code to verify the username and login here...
        content.add( login );
        JButton cancel = new JButton( "Cancel" );
        cancel.addActionListener( new ActionListener( ){
          public void actionPerformed( ActionEvent ae ){
            dispose(); // close the window or write any code that you want here.
        content.add( cancel );
        pack( ); // pack everything in the dialog for display.
        show(); // show the dialog.

  • Logfile Generation utilizing "Excel" (Creating and Appending Report)

    All,
    As always, thanks for the help you have given me in the past....especially the Vets. I have tried to figure out a solution to my issue from the message board, but no solution seems to fit what I am doing.
    Here is my situation...... I am using Labview to test my product one unit at a time. I have always used Teststand and report generation from there, but this time it is strictly Labview. This is my first attempt to create a logfile with Excel that appends one xls file everytime one unit is tested.
    The way my test is set up now, I test and collect the data in an array for when I created the logfile generation VI. I took several stabs at it, looked at examples, but cant figure out the direction I need to go to create this. Here is the parameteres necessary for the logfile (spreadsheet).
    -All UUT's will go into one spreadsheet and the spreadsheet will be appended by adding new data in next available row.
    -Data is imported to spreadsheet in array format.
    -Test data that passes will be green, test data that fails will be red (I can figure this out, but this is why I need to use Excel)
    -I want to use Excel so I have more flexibility for graphs and things of that nature in the future.
    It seems rather simple, but not for me.....lol. If I go to the Report Generation Toolkit, i  see "Create Report" and "Append Report"....but Append Report still wants the "report input" node wired. What do I wire that to? For example, if I have an excel spreadsheet called hangover.xls, do I somehow wire hangover.xls to the input? I am having trouble finding answers. I would really appreciate a simple JPG or VI so I can understand the setup for what I want to do.
    Comments and links to threads/help appreciated!
    Ryan

    Hi Evan,
    Thanks for the other examples....I thought I was going to be able to manipulate them into what I want, but ended up spending about 6 hours playing with it and up to 2am. I am getting so frustrated with this. This is new ground for me, I never have experimented with logfile creation. I am sorry to keep bothering you with this but I am ready to pull my hair out. I attached a couple Vi's....Spreadsheet import is the main VI and report.vi is the sub.....i need to rename them better but haven't got there.
    First off, that VI you posted that I couldn't open, could you just take a JPG of the block diagram? That would really help.
    I need to create a spreadsheet with logfile data in rows. The spreadsheet is to be appended for each unit under test. Each unit under test gets one row and all data is written at the end of the test. If you look at the spreadsheet_import.vi, I am basically taking a bunch of 1D arrays of data to create one long 1D array for one row.
    Every month a new spreadsheet is created (so log file data is divided into months) , and that is what the report.vi does....it looks to see if the filename is already created and if not, sends a boolean to the write to spreadsheet file to append. I reverted to "write to spreadsheet" because for the life of me, I cannot figure out how to use the worksheet portion to do this. I would think this should be pretty simple, but I cannot figure out and its not for lack of trying.
     If I use "write to spreadsheet", I am going to run into problems because I ultimately want to use a excel template with formulas but if I can figure it out, this will have to do.
    All I really want to do is to create a spreadsheet if one doesnt exist or append if it does, combine all my 1d array data, and create one row with this data. The other issue I ran into before is I cant figure out how to tell Excel where the next row is.......UUGHHHH! This is definitely stressing me out as I have a deadline and I will gladly sent a case of beer to Norway for the help received.
    Dying Here,
    Ryan
    Attachments:
    Spreadsheet_import.vi ‏14 KB
    report.vi ‏33 KB

  • Target Stage and append iframe from inside symbol????

    Having trouble again. I am SLOWLY getting use to the CC 2014 thing =).
    Now I need to be able to target a Symbol on the stage from within an element inside a symbol and append it with an <iframe> and pass attributes to the iframe.
    I have a file -- please refer to the  videoui symbol and whitewater1.click and whiteawater2.click actions in that symbol (link below (Drop Box)
    Here's what I have so far...
    // insert code for mouse click here
    // Go to a label or specific time and stop. For example:
    // sym.stop(500); or sym.stop("myLabel");
    sym.stop("videotwo");
    // Change the text in an element
    sym.$("video-text").html("Video by: TheNigglesbear");
    var youtubevidtwo = $("<iframe/>");
    sym.getComposition().getStage().getSymbol("vcontainer").append(youtubevidtwo);
    youtubevidtwo.attr('type','text/html');
    youtubevidtwo.attr('width','616');
    youtubevidtwo.attr('height','347');
    youtubevidtwo.attr('src','http://www.youtube.com/embed/eqzwoIQseyA?rel=0');  // url/Video_Id
    youtubevidtwo.attr('frameborder','0');       // 1 | 0
    youtubevidtwo.attr('allowfullscreen','0');   // 1 | 0
    This same code -with different path to symbol of course- works fine on the stage document.compositionReady, but not sure how to target the videoui and append the iframe and its attributes to it from inside another symbol.
    Help please -- there really needs to be more ADVANCED examples of possible methods of targeting. I find a lot about targeting symbols inside of symbols,or Stage to symbols, but not much on symbols to stage to another symbol also on the stage.
    Thanks in advance.
    Dropbox - videoPhotoUI.zip

    dharmk
    Thanks for the input. Just what I needed, I had to adjust my thinking, but got it to work because you took the time to look at my file and offer the help. Really appreciate it!! Here's how I made it work (for all three) video buttons:
    var container = sym.getComposition().getStage().$("vcontainer");
    container.find("iframe").remove();
    var youtubevidtwo = sym.getComposition().getStage().$("<iframe/>");
    sym.getComposition().getStage().$("vcontainer").append(youtubevidtwo);
    youtubevidtwo.attr('type','text/html');
    youtubevidtwo.attr('width','616');
    youtubevidtwo.attr('height','347');
    youtubevidtwo.attr('src','http://www.youtube.com/embed/eqzwoIQseyA?rel=0');  // url/Video_Id
    youtubevidtwo.attr('frameborder','0');       // 1 | 0
    youtubevidtwo.attr('allowfullscreen','0');   // 1 | 0

  • File conversion and append file in receiver file adapter

    Hi
    I have a batch IDoc -> XI(3.0) -> file scenario with file conversion to create a flat CSV-like file. The problem is that because of the amount of data sent from R/3 (~20000 employees), the idoc is split into several idocs. In my receiver file adapter I want to append all the idocs contained in this data transfer to one flat file, before transmitting to FTP server.
    For the next batch transfer (the next day) XI should start all over and create a new file and append all idocs contained in that transfer before transmitting the flat file to FTP server.
    Can this be done using the 'Use Temporary File' and 'Append' options in the FTP connection Parameters in the comm-channel?
    It is not an option to append the file in the FTP-server, because the files in the destination folder are moved immediately after arrival, so the file will be moved before file adapter can append all the files.
    Does anyone have any suggestions to how to solve this?
    Br
    Kenneth

    Hi Kenneth
    Did you ever get a solution to this problem?
    Regards
    Russel Irvine
    [email protected]

  • PO line item details from BAPI_PO_GETDETAIL1 and append to BAPI_PO_CHANGE

    Hi,
    The requirement is to get PO line item details from BAPI_PO_GETDETAIL1 and save it in the internal table and append that internal table into  the BAPI_PO_CHANGE.
    But i am getting dump in this program.
    TABLES: ekpo.
    DATA: BEGIN OF po_details.
            INCLUDE STRUCTURE BAPIMEPOITEM. "Include the structure of Dictionary Reference.
    DATA: END OF po_details.
    DATA: BEGIN OF po_details1.
            INCLUDE STRUCTURE BAPIMEPOITEM. "Include the structure of Dictionary Reference.
    data: END OF po_details1.
    DATA: it_po_details LIKE STANDARD TABLE OF po_details,
    wa_po_details like line of it_po_details.
    data: it_po_details1 like standard table of po_details,
    wa_po_details1 like line of it_po_details1.
    PARAMETERS: p_ebeln LIKE ekpo-ebeln DEFAULT '4500000016'.
    CALL FUNCTION 'BAPI_PO_GETDETAIL1'
      EXPORTING
        PURCHASEORDER = p_ebeln
      TABLES
        POITEM        = it_po_details.
    loop at it_po_details into po_details.
      read table it_po_details into wa_po_details with key PO_item = p_ebeln.
      move-corresponding po_details to po_details1.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          PURCHASEORDER = p_ebeln
        TABLES
          POITEM        = it_po_details.
      append po_details to it_po_details1.
      LOOP AT it_po_details1 INTO wa_po_details1.
        WRITE:/ wa_po_details1-PO_item,
           wa_po_details1-MATERIAL,
           wa_po_details1-SHORT_TEXT,
           wa_po_details1-PLANT.
      ENDLOOP.
    endloop.

    HI,
    1st you check for the following following  authorization objects are checked:                                                                               
    M_BEST_BSA (document type in PO)                                                                               
    M_BEST_EKG (purchasing group in PO)                                                                               
    M_BEST_EKO (purchasing organization in PO)                                                                               
    M_BEST_WRK (plant in PO)          
    and to change the PO below is the eg for changing the short text:-
    TABLES: ekpo.
    DATA: BEGIN OF po_details.
            INCLUDE STRUCTURE bapimepoitem. "Include the structure of Dictionary Reference.
    DATA: END OF po_details.
    DATA: BEGIN OF po_details1.
            INCLUDE STRUCTURE bapimepoitem. "Include the structure of Dictionary Reference.
    DATA: END OF po_details1.
    DATA: it_po_details LIKE STANDARD TABLE OF po_details,
    wa_po_details LIKE LINE OF it_po_details.
    DATA: it_po_details1 LIKE STANDARD TABLE OF po_details,
    wa_po_details1 LIKE LINE OF it_po_details1,
    poheader  LIKE  bapimepoheader,
    return  LIKE STANDARD TABLE OF  bapiret2 WITH HEADER LINE,
    poitemx LIKE STANDARD TABLE OF  bapimepoitemx WITH HEADER LINE.
    PARAMETERS: p_ebeln LIKE ekpo-ebeln DEFAULT '5600010646'.
    CALL FUNCTION 'BAPI_PO_GETDETAIL1'
      EXPORTING
        purchaseorder = p_ebeln
      IMPORTING
        poheader      = poheader
      TABLES
        poitem        = it_po_details.
    LOOP AT it_po_details INTO po_details.
      READ TABLE it_po_details INTO wa_po_details INDEX 1.
      MOVE-CORRESPONDING po_details TO po_details1.
      MOVE: po_details-po_item TO poitemx-po_item,
            'X' TO poitemx-short_text.
      APPEND poitemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = p_ebeln
          poheader      = poheader
        TABLES
          return        = return[]
          poitem        = it_po_details[]
          poitemx     =
          poitemx[].
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      APPEND po_details TO it_po_details1.
      LOOP AT it_po_details1 INTO wa_po_details1.
        WRITE:/ wa_po_details1-po_item,
        wa_po_details1-material,
        wa_po_details1-short_text,
        wa_po_details1-plant.
      ENDLOOP.
    ENDLOOP.

  • JTextfield and JButton

    Hi all
    My problem is that i have a JTextfield that is connected to a Oracle database that allow the user to enter data in the database. I want to have a button that will allow the user to test to see whether the data entered in the textfield is valid.
    I'm not sure if i need to use sqlj or not. Any help would be gladly received.
    Thanks
    null

    Hmmm... lots and lots of ways to handle this, depending on your particular need for the particular type of 'validation'. ( More info? )
    "JTextField" is not connected to a database in the same way that the infoswing "TextFieldControl" is.. .therefore one could trap the event ActionPerformed off the JTextField and do the checks ( or use the jbutton like you suggest..but it would seem like you'd always want it checked and corrected before continuing towards the inevitable commit attempt??? ).
    You can use sqlj, or you can not use it... depends upon the way you've architected your application/environment and your needs and desires.
    Note (if you haven't already ) that you can also do a heck of a lot of validation at the entity/view object level.
    In my case ( an application ) I have a jdbc connection up at the front end for all my miscellaneous stuff, and a validate PL/SQL stored function. The nice things about using stored procedures/functions are that the validate routines can be nested for quick and easy use by triggers and stored procedures. If you put it outside the database it gets more fun should you want to get at the common validation routines from all approaches.
    Curious as to how other folk are architecting their validations....

  • JTextField and JButtons not appearing until clicked.

    I'm writing a program to refresh my CS1 java skills. For some reason when I try to add a JTextField and two JButtons to my container they don't appear until Ive clicked them.
    Actually more specifically, this only happens after a 100ms wait after setting the frame visible. Any less and the components wind up visible, but scrunched up in the top middle of my frame.
    Ive found that if I add the components before and after the wait they are visible and in the correct place, but this makes a noticeable flicker.
    I'm running windows vista if that matters.
    If someone could help me I would appreciate it.
    snippet of code:
    public scrollText()
         drawingThread.start();
         mainFrame.setSize(640,160);
         mainFrame.setContentPane(draw);
         mainPane = mainFrame.getContentPane();
         mainPane.setBackground(Color.white);
         mainFrame.setResizable(false);
         mainFrame.setVisible(true);
         try
              Thread.sleep(100);
              addInterface();
         catch(InterruptedException e){}
    public void addInterface()
         textInput.setBounds(1,103,501,31);
         play.setBounds(502,103,65,30);
         play.addActionListener(this);
         stop.setBounds(568,103,65,30);
         stop.addActionListener(this);
         mainPane.add(textInput);
         mainPane.add(play);
         mainPane.add(stop);
    }

    Postings can't be moved between forums. Now you know for the next time.
    The general form for building a GUI is
    frame.getContentPane().add( yourComponentsHere );
    frame.pack();
    frame.setVisible( true );Then all the compnoent will show up according to the rules of the layout managers used.
    However is you add components to the GUI "after" the GUI is visible then the components are not automatically painted. You need to tell the GUI to invoke the layout manager again so your code would be:
    frame.getContentPane().add( componentsToVisibleGUI );
    frame.getContentPane().validate();

  • JtextField and list of data

    Hi everyone (and sorry for my english language....).
    I've this problem:
    I've a Frame with a JtextField and a button. When I click on this button, I want to show a list of data from a database and then I must choose a value that must go to the JtextField.
    Have you an idea how I can implement this? Sorry for this generic question, but I don't know how to do..
    Thank you!

    >
    As to your question.
    I've a Frame with a JtextField and a button. When I click on this button, I want to show a list of data from a database and then I must choose a value that must go to the JtextField.
    Have you an idea how I can implement this? ..Sure, plenty of people. But they will want to know exactly what you are having trouble with. E.G.
    - Getting data from a DB.
    - Putting data into a JList.
    - Adding listeners to that JList so that choices are acted on, rather than simply high-lighted as the selection.
    - Using the event provided to the listener, to update the JTextField.
    - Adding a JTextField and JList to a JFrame using layout managers.
    If your answer is 'all of that', then I suspect they would be tempted to:
    a) Advise you to put this project aside until you have considerably more experience.
    b) Refer you to the [Java Tutorial|http://java.sun.com/docs/books/tutorial/].

  • JTextField and JTextArea don't get focus occuasionally

    I am developing a Java Swing Applet. At edit mode, JComboBox, JCheckBox, JRadioBox, and JButton work fine, but JTextField and JTextArea can't get focus occuasionally while I click them.
    Anyone has idea?
    Thanks

    Thank you Himanshu,
    but that's not exactly what my issue is. This link describes the undesired effect of ending up outisde of the player window and in the browser.
    My problem is kind of the opposite. When I launch the page in the html file I cannot use the tab key to get to any of the controls in the captivate window. I'm stuck in the browser unless I click on the captivate window. That is not acceptable if we want it accessible without using a mouse. I found a way to make it work for chrome like I stated above, but not in FF. Do you have any ideas for this?
    Thanks!
    Monique

  • JTextField and JPasswordField

    Hi!
    How do I limit the character number that can be inserted into a JtextField and JPasswordField.
    For examen is the Password can be mam 6 characters, how do I do from limit the input?
    Thanks

    The most common way to limit what is entered in a JTextField is to create your own document. See the following thread:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=414464
    Graeme

  • JTextField and TextListener

    I am using an JTextField and I want to be notified when the text there have been changed. But there is no TextListener accessible in JTextField. Do I have to modify a CaretListener ?
    many Thanks/ Sam

    I am using an JTextField and I want to be notified
    when the text there have been changed. But there is no
    TextListener accessible in JTextField. Do I have to
    modify a CaretListener ?DocumentListener.

  • JTextField and transparency

    I have a JTextField and I am trying to set it up so it is somewhat transparent.
    mTextField.setBackground(new Color(255,255,255,50));
    But what happens when i do that is this: the textfield as a text value gets the text that i have set up for one of the neighbouring components.
    I am not sure why this happens.
    Has anyone experienced this problem before? Is there a fix to it?
    I tried setting up the text using setText to an empty string but it happens agian. I dont have this problem when the transparency is Not set.
    Cheers
    Dan

    I am not sure why this happens. An opaque component is responsible for painting the entire area of the component, which basically means that the RepaintManager doesnt' have to worry about the garbage that may exist where the component is about to be repainted.
    Since you background is somewhat transparent, you can see the garbage left behind. (Don't ask me what its left behind from, thats in the details of the Swing repaint manager which I know nothing about).
    Michaels suggestion makes the component transparent which means Swing will paint the background of the components parent. However when you do this, the background of your component isn't painted.
    So heres a solution that paints the background of the parent and the child:
    JTextField textField = new JTextField("Some Text")
         protected void paintComponent(Graphics g)
              g.setColor( getBackground() );
              g.fillRect(0, 0, getSize().width, getSize().height);
              super.paintComponent( g );
    textField.setBackground(new Color(0, 255, 255, 50));
    textField.setOpaque( false );

Maybe you are looking for

  • Keynote freezes when using smart builds.

    I've got an issue using smart builds. Any time I click on the smart build button on the tool bar or the actions tab in the inspector window, I get the spinning beach ball of death. I'm not sure if it's an issue with hardware or software. I've tried d

  • Is it possible to have 2 chase freedoms?

    searched but didn't come up with anything that said this so i am just curious. i highly doubt it, but it's worth asking. i am sure someone has at least tried it...

  • OBIEE 11g installation errors

    Hi Folks, I have downloaded OBIEE 11g and Oracle 11g form Oracle downloads link successfully. When i am trying to extract iam getting error no 0x80004005 i skipped that error and extracted files and then i installed on my laptop, but it was not insta

  • Why won't my MacBook Pro switch to Intel integrated graphics?

    My early 2011 MacBook Pro seems to be incapable of using it's integrated Intel graphics card, obviouslly affecting battery life when unplugged.  I've verified the computer is using the discrete graphics card at all times and in all situations.  Is th

  • Cartesian Or NOT

    Hello All, When I run following query, I got 24 row.SELECT * FROM CLASSES, COURSES, REGISTRATIONS, USERS WHERE ( (CLASSES.COURSE_ID = COURSES.COURSE_ID) AND (REGISTRATIONS.CLASS_ID = CLASSES.CLASS_ID) AND (REGISTRATIONS.USER_ID = USERS.USER_ID) When