Adding JTextFields and JLabels on a window/panel

Hi everyone,
i am creating a program that reads information from an XML, it can read the XML without any problem. my problem is i have got an Element viz: serviceOrderElement, and i store its values inside a Combobox. that serviceOrderElement has parameters
E.g:
<ServiceOrder name="MPABX_LIST_VPN_MEMBER" description="List enterprise members">
     <parameter>GRPID</parameter>
     <parameter>DEPT</parameter>
     <parameter>POVERDUE</parameter>
     <parameter>STARTDATE</parameter>
     <parameter>ENDDATE</parameter>
     <parameter>ORDER1</parameter>
     <parameter>ORDERTYPE1</parameter>
     <parameter>ORDER2</parameter>
     <parameter>ORDERTYPE2</parameter>
     </ServiceOrder>
     <ServiceOrder name="MPABX_LIST_VPN_HUNTINGNO">
     <parameter>GRPID</parameter>
     <parameter>MAINNUMBER</parameter>
     </ServiceOrder>
so now what i want to do is, when i select a serviceOrder e.g: MPABX_LIST_VPN_MEMBER, i what the program to automatically create Labels and TextFields on an InternalJFrame, meaning because MPABX_LIST_VPN_MEMBER has 9 parameters 9 Labels("Parameter names") and TextField must be created on an internalJFrame, or because MPABX_LIST_VPN_HUNTINGNO has 2parameters 2 Labels("Parameter names") and TextField must be created on an internalJFrame

The question is how can i create Labels and TextField Depending on the number of parameters that exist in a serviceOderElement.
This is my code:
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse (new File("ServiceOrderGUIConfig.xml"));
NodeList serviceOrder = doc.getElementsByTagName("ServiceOrder");
int totalServiceOrder = serviceOrder.getLength();
for(int s=0; s<serviceOrder.getLength() ; s++){
Node anAttributeNode = serviceOrder.item(s);
if(anAttributeNode.getNodeType() == Node.ELEMENT_NODE){
Element anAttributeElement = (Element)anAttributeNode;
NodeList para = anAttributeElement.getElementsByTagName("parameter");
test=anAttributeElement.getAttribute("name");
test2=anAttributeElement.getAttribute("description");
if(menu1.getSelectedItem().equals(test))
for(int paramCounter = 0; paramCounter <para.getLength();++paramCounter)
Element parameterElement =(Element)para.item(paramCounter);
NodeList parameterTextList =parameterElement.getChildNodes();
String parameterValue =parameterTextList.item(0).getNodeValue().trim();
System.out.println("\n"+parameterValue);
}//end of if clause
}//end of for loop with s var
for(int counter = 0; counter < serviceOrder.getLength(); ++counter)
Node anAttributeNode = serviceOrder.item(counter);
if(menu1.getSelectedItem().equals(test))
if(anAttributeNode.getNodeType()==Node.ELEMENT_NODE)
Element anAttributeElement = (Element)anAttributeNode;
NodeList para =anAttributeElement.getElementsByTagName("parameter");
for(int paramCounter = 0; paramCounter <para.getLength();++paramCounter)
Element parameterElement =(Element)para.item(paramCounter);
NodeList parameterTextList =parameterElement.getChildNodes();
String parameterValue =parameterTextList.item(0).getNodeValue().trim();
System.out.println("\n"+parameterValue);
System.out.println("=============================================");
//For separating the values
}catch (SAXParseException err) {
String msg = "Error on line " + err.getLineNumber () + "\n, URL " + err.getSystemId ()+"\nMessage"+err.getMessage ();
JOptionPane.showMessageDialog(null,msg,"ERROR!",JOptionPane.ERROR_MESSAGE);
}catch (SAXException e) {
Exception x = e.getException ();
((x == null) ? e : x).printStackTrace ();
}catch (Throwable t) {
t.printStackTrace ();
}

Similar Messages

  • Adding JTextField to JLabel

    Hi All,
    I already have a JButton and JLabel on the Frame.So when i press the button JTextField need to be added to JLabel.
    JLabel.setLabelFor(JComponent c).Does this method work or is there any other way in doing this.??
    Thanks in advance for all.
    regards,
    Viswanadh

    Hi Cam,
    I am posting now.Is it correct then its ok or else tell me how to do it,because i was not 100% sure of posting SSCCE.
    public class VNVGenerator extends JFrame {
    static public Hashtable<String, Integer> buffer_no_of_input_params = new Hashtable<String, Integer>();
    static public Hashtable<String, Integer> buffer_return_type = new Hashtable<String, Integer>();
    static public JComboBox functionbox=new JComboBox();
    static Font style=new Font("Palatino Linotype", Font.BOLD | Font.PLAIN,14);
    public JPanel settingsPanel;
    public JLabel typeLabel,inparam,outparam,returnparam;
    public JFrame vnvframe;
    static{
               try{
                                   File file = null;
                                     FileReader freader = null;
                                     LineNumberReader lnreader = null;
                          String parttoken[]=new String[4];                    
                                   String nameidentitiy;
                             StringTokenizer tokenizer;
                                   JFileChooser filetypechooser = new JFileChooser();
                                    String currentdir = System.getProperty("user.dir");               
                                File dir = new File(currentdir);
                if (dir.isDirectory()) {
                                        File[] files = dir.listFiles();
                            for(int i = 0; i < files.length; i++)
                               nameidentitiy=filetypechooser.getTypeDescription(files);
              if((files[i].getName().toUpperCase().endsWith("TXT"))&&(files[i].getName().toLowerCase().startsWith("tmtv")))
                                  freader = new FileReader(files[i].getName());
    lnreader = new LineNumberReader(freader);
    String line = "";
    while ((line = lnreader.readLine()) != null)
    tokenizer=new StringTokenizer(line);
                                                 int tokens=tokenizer.countTokens();                    
                                                 int nooftokens=0;
    while ((nooftokens<tokens)&&(tokenizer.hasMoreTokens()))
                                                      parttoken[nooftokens]=tokenizer.nextToken();                                   
                                                           nooftokens++;
                   functionbox.addItem(parttoken[1].toString());
                   buffer_no_of_input_params.put(parttoken[1],new Integer(parttoken[2]));
                   buffer_return_type.put(parttoken[1],new Integer(parttoken[3]));
                   Integer value = (Integer) buffer_no_of_input_params.get(parttoken[1]);
                   Integer returnvalue = (Integer) buffer_return_type.get(parttoken[1]);
                                  catch(Exception e){
         e.getMessage();
    public VNVGenerator(){
    vnvframe=new JFrame("VNVAPI Test Window");
    Border apiborder = BorderFactory.createLineBorder(Color.RED,1);               
              settingsPanel= new JPanel();
              settingsPanel.setBorder(
              BorderFactory.createTitledBorder(apiborder,"VNVAPI Manual Test Settings",TitledBorder.LEFT,TitledBorder.TOP,style,new Color(142,142,56)));
    functionbox.addActionListener(new OnCallingRequiredFunction());               
    inparam=new JLabel("In Param:");
    settingsPanel.add(inparam);
    vnvframe.getContentPane().add(settingsPanel, BorderLayout.CENTER);
    class OnCallingRequiredFunction implements ActionListener{
         final JSeparator separator = new JSeparator();
    public void actionPerformed(ActionEvent selectEvent){
              JComboBox source = (JComboBox) selectEvent.getSource();
                             Object item= source.getSelectedItem();
                             item=item.toString().trim();
    OnFetchingValueFromHashTable(item);
         public void OnFetchingValueFromHashTable(Object key){
              OnCreatingInputParametersTextFieldComponent(buffer_no_of_input_params.get(key));
         public void OnCreatingInputParametersTextFieldComponents(int inputparameters)
         GridBagConstraints constraints=new GridBagConstraints();
    final int no = new Integer(inputparameters);
    System.out.println("No of Parameters are:"+no);
    for (int i = 0; i < no; i++) {
                   inparam.add(new JTextField(2),constraints.HORIZONTAL );
    settingsPanel.revalidate();// you may comment this out because next statement is pack()
    public static void main(String args[])
              try {
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
                   new VNVGenerator();
                   }catch(Exception e){
                   e.getMessage();
    regards,
    Viswanadh

  • Enabling / Disabling graphs and opening a new Front Panel Window

    Hi,
      I have a simple application of showing 12 analog signals on 12 different graphs placed vertically in aligned position. I have to develop a user interface so that if user wants to display signal no. 1, 4 and 6 out of total 12 signals, he should make selection using check boxes and click a re-draw button. It should result in opening a separate window with these three signals displayed as separate graphs aligned vertically and adjusted to fit window size. Similarly later user can change his selection of displaying signals (from same acquired data) say 1, 3, 5, 6, 8, 9, 11 & 12 and click Redraw button. It should result in opening a new Window showing all these signals as separate graphs which are aligned vertically and resized to fit the window. Now I have two major issues in this context.
    1) I have been searching LabView help to locate a way to open a new window for this purpose but I failed to locate any way for it. As per my limited knowledge, it seems that we cannot have multiple "Front Panel" windows in Labview.
    2) For the graph I could not locate a control to enable/disable a graph so that it appears or vanishes. Is there any way to achieve it?
    I shall appreciate your valuable advice. I shifted from "Lab View Signal Express"  to "Lab View" in order to achieve this user interface design but I am still not successful in finding a good solution for this application.
    Regards
    Mnuet

    Hi Mnuet,
    You can do what was said above. Here is a KB on dynamically loading VIs. It looks something like this.
    Dynamically loaded VIs are loaded at the point in code while running, as opposed to being loaded when the parent VI is loaded into memory like normal subVIs. You can make a reference to them and then control the front panel appearance, their run status, etc with property nodes and invoke nodes.
    Jeff | LabVIEW Software Engineer

  • Hi. I have set up the trial versions of Photoshop CC 2014 and Lightroom 5.6 (ie the Photography plan) on a desktop that I have added a new drive to with Windows 7. Everything works fine BUT it is an old computer and I'm thinking that it may pack up unexpe

    Hi. I have set up the trial versions of Photoshop CC 2014 and Lightroom 5.6 (ie the Photography plan) on a desktop that I have added a new drive to with Windows 7. Everything works fine BUT it is an old computer and I'm thinking that it may pack up unexpectedly. These things happen. I want to sign up for the Photography plan but I also have a Windows Vista laptop, and that is old too so I may want to put the apps on a new desktop and a new laptop, having already installed on my desktop. That makes three activations. Am I allowed to do this? Cheers. Paul

    You cannot have three activations. It's simply not technically possible. If and when the time comes, you simply deactivate/ sign out on one of the old systems and install on the new one. If the system goes belly up, you contact support to reset your account. No need to make it more complicated than that and overthink it.
    Mylenium

  • TS3989 My Photo Stream works and I have iCloud control panel installed. The photo stream sync is selected, but when I go to the my photo stream folder on my windows PC there are no photos in the file.

    My Photo Stream works and I have iCloud control panel installed. The photo stream sync is selected, but when I go to the my photo stream folder on my windows PC there are no photos in the file.

    mlvov,
    I did as you said and went to the icloud control panel on my Windows 8 Laptop to be sure I was looking at the correct folder for my photo stream.  All my "shared" albulms pushed to my Laptop and are up-to-date with the exception of the "photostream" album. If I create a "shared stream album" and place photo's in it on the phone; I can see the photos on my laptop. I dont get it. I had a iphone 4s and had zero isues and now with my new nifty iPhone 5s it doesent work.
    What am I not doing correctly.
    Thanks,
    iPhone, 5s, iOS 7.0.2

  • I've recently added the MacAir to my Microsoft /Windows network. The Mac sees my printers but all the printers are "paused" and I cannot print, even if directly attached. How do I fix this?

    I've recently added the MacAir to my Microsoft /Windows network. The Mac sees my printers but all the printers are "paused" and I cannot print, even if directly attached. How do I fix this?

    Yes, I've that and it didn't work. Today, I reinstalled printer software on one printer and the "paused" message changed to "offline". It's a three-in-one printer. I turned off and on again and it still says "offline"
    "

  • HT4759 I have a Windows 7 machine and cannot get Icloud control panel to work. Why can't I login and subscribe to someones photos

    I have a Windows 7 PC and have installed Icloud control panel the latest. I cannot sucessfully login and subscribe to me daughters photos, or my nieces photos. I really could use some help, as I am not an Apple user and I am lost here...................Thankx....

    Do you have an iCloud account?  If so, did you sign into your account on the iCloud control panel and check Photos, then click Options to confirm that Photo Sharing is turned on?

  • My grandson loaded music to my Ipod nano with his Mac computer.  Now I'm trying to add music and I have a windows based computer.  Itunes is asking me to reformat my Ipod for windows.  Will that erase my music already added?

    My grandson loaded music to my Ipod nano with his Mac computer.  Now I'm trying to add music and I have a windows based computer.  Itunes is asking me to reformat my Ipod for windows.  Will that erase my music already added?

    Downloading past purchases from the App Store, iBookstore, and iTunes Storehttp://support.apple.com/kb/HT2519
    Message was edited by: michael08081

  • 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.

  • Having some problems with ImageIcons and JLabels

    I'm making a checkers game, and so far it's going pretty well.
    I've got the basic game down, and you can move pieces, jump, your turn ends when you can't jump anymore, etc...
    However, I've had three problems:
    1.) I'm using JLabels to display my board (8 x 8.. well actually 9 x 9 for an outer row labelled A,B,C,D.. 1,2,3,4...) Anyway, I create the JLabels using something that looks like \:
    JLabel square = new JLabel(new ImageIcon("pic.png"));
    Now, the picture loads properly, but it seems like the picture is being cropped, and the top and bottom are getting chopped off, so my 36 x 36 pixel *.gif appears to be 36 x 30.
    You can see how there is a gap created in:
    http://img235.imageshack.us/img235/7765/prob13ky.jpg
    Now the problem may be with the GridLayout I am using, but I set the distance between the components in the container to be 0, 0 so I don't think that GridLayout is chopping my icons. I've also tried setPreferredSize(new Dimension(36,36))
    for both my ImageIcons and JLabels and for my container (which I set to size 2000,2000, just to make sure there was room). If anyone can help me, it's be appreciated.
    2.) I used to be able to view my outside row/column of squares that said A,B,C,D.... and 1,2,3,4... with the square in the corner having a random pic. For some reason now (have no clue why) I now see only the pic in the corner, and then a little gray smudge diagonally under it.
    Pic:
    http://img347.imageshack.us/img347/8308/prob24im.jpg
    I don't know what's wrong. I'm pretty sure it's none of the new methods I've written, as those are all in my static void main (String[] ar) ...... and if I comment all the methods in my main except where I first make the JFrame and set it visible, it still turns out like that. repaint() doesn't help.
    3.) For some reason, when I move another window (AIM, the console window, etc...) over my Swing window, it "erases" (turns gray, just wipes clean) the part where I have my squares that have pieces.
    What's weird is that:
    The border pieces (err.. my one visible corner piece from my second problem) don't get wiped, and some debugging text and JLabels (in a different JPanel) are fine. I don't think the JPanel matters though; the border pieces and the playing squares (which get wiped) are in the same JPanel and same array of squares.
    repaint(); also erases ALL of my playing squares, whereas moving a window over them would only erase the part that the window covered.
    Also, I added a mouseListener so that whenever I move the mouse over a square, it changes the image (to a tinted version, so you know the mouse is over it) and when you move the mouse away, it returns to normal. However, if I wildly swing the mouse around the area, it seems to lock up and freeze for a few seconds. Is there anything I can do to prevent this??
    Thanks in advance.

    It is hard to tell what your problems are without any code at all (I saw your images, but that doesn't make it easy to see what is wrong in your code). If you do post code, please use code tags (see button above posting box).
    I've seen your MouseListener problem before--we had the exact same issue in our code at work. It would freeze up while it processed all of the mouse events (unbearably slow). I'm not at work right now, so I don't recall how it was fixed. Essentially, you need to only process the event periodically. You need to only update the image if the mouse switches squares. Or, only update the image if the distance from the last mouse event is more than some specified amount. We might also have checked the time difference between mouse events before processing a new one. I could look at the code at work tomorrow, if you are still having trouble.

  • Unistalling labview 7.0 and 8.0 from windows vista

    how do i uninstall both labview 7.0 and 8.0 from windows vista? i run through conflicts of labview with other programs so i want to remove them. there were errors encountered when i tried to uninstall them from the control panel such as this:
    Attachments:
    uninstall error.doc ‏210 KB

    Can you stop the service manually? I would suggest stopping the service, setting it Manual or Disabled, rebooting, and then run the uninstaller again. Hopefully you won't have to resort to uninstalling the service manually.

  • I am adding new photos to my PC windows 7 desktop but they are not syncing to my ipad.  how can i get these photos to sync

    I am adding new photos to  my PC windows 7 desktop but they are not syncing to my ipad when I sync the Ipad.  How can I get these photos into my Ipad?

    Skydiver.
    you and I know that your answer works because that is how I sync my ipad.  I don't have a mac, just a PC with itunes. Now this guy might not even have itunes and is using Windows Media Player or something like that.
    Or maybe he just do not want his problem fixed.  I read these forums and too many of the questions are just way beyond basic computer knowledge, but it seems to happen that they can never resolve a very simple problem.  It makes me wonder if people just post bogus stuff.
    I would like to see registration to the forums attached to the product serial number of the forum you are posting to.  I bet you that the posts would drop dramatically.

  • I have CC and while attempting Light Effects, the Layer will appear in the layers panel, but the option bar will not appear and neither will the Properties panel. All my preferences are set correct, and my computer has a compatible video card and RAM. Ple

    I have CC and while attempting Light Effects, the Light Effects Layer will appear in the layers panel, but the option bar will not appear and neither will the Properties panel. All my preferences are set correct, and my computer has a compatible video card and RAM. Please help!
    I tried to delete the layer attempt again. I am in a Photoshop class, but the work is all online, so all my teacher is going to do is send me to this site. I am trying to edit a photo for this class, and without this working, i go to filter>render>light effects. the bar and panel will pop up for about 2 seconds, then disappear. How do i get the options bar and properties panel to display?

    I was about to suggest resetting LE from the Workspace drop-down top right corner, but if you can't see the Options Bar, I guess that is not going to happen.  The normal Tool reset is grey out for LE, so it might be a case of resetting Preferences.
    Reset Preferences
    Windows — Hold down Shift Ctrl Alt immediately after starting Photoshop
    Mac — Hold down Shift Cmd Opt immediately after starting Photoshop

  • JavaScript and "Open In New Window" not working.

    I've been using Safari 5 since it came out and there were no problems. But recently my JavaScript has stopped working. Whenever I click on a link that is supposed to run a script nothing happens. Similarly when I click a link that is supposed to open automatically in a new window, nothing happens. I've tried reseting Safari but that did not help. I had this same issue with Safari 4 and the update to 5 solved it, but now I do not know what to do.

    HI and welcome to Apple Discussions...
    From the Safari Menu Bar click Safari/Preferences then select the Security tab.
    Make sure Java is enabled.
    And, from a Finder window select your Home Folder in the Sidebar on the left. Then open the Library folder, then the Caches folder, then the com.apple.Safari folder. Move the cache.db file to the Trash.
    Relaunch Safari. If you still have problems, go to the Safari Menu Bar, click Safari/Preferences. Make note of all the preferences under each tab. Quit Safari. Now go to ~/Library/Preferences and move this file com.apple.safari.plist to the Desktop.
    Relaunch Safari and see if that makes a difference. If not, move the .plist file back to the Preferences folder. If Safari functions as it should, move that .plist file to the Trash.
    I had this same issue with Safari 4 and the update to 5 solved it, but now I do not know what to do.
    If nothing above helps, install the v10.6.4 Combo Update
    Then repair permissions.
    Launch Disk Utility. (Applications/Utilities) Select MacintoshHD in the panel on the left, select the FirstAid tab. Click: Repair Disk Permissions. When it's finished from the Menu Bar, Quit Disk Utility and restart your Mac. If you see a long list of "messages" in the permissions window, it's ok. That can be ignored. As long as you see, "Permissions Repair Complete" when it's finished... you're done. Quit Disk Utility and *restart your Mac*.
    Carolyn

  • 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();

Maybe you are looking for