Menus and textboxes- shakey and tearing

Hi All,

Im having some problems “shakey” textboxs etc.
I’ve just put a transparent textbox and text area on
my canvas and all appears fine until i move the camera around - the text box start to shake and tear (not alot but enough to be noticed) -
Any ideas why this is so and how I could resolve the issue.
Some of this code i picked up on the Xith forum.
see the class:

import javax.swing.;
import javax.swing.BorderFactory;
import javax.swing.border.TitledBorder;
import com.xith3d.userinterface.UIWindow;
import java.awt.
;
import java.awt.event.*;

class chatPanel extends UIWindow {

  JPanel chatPane;
  JTextField textField;
  JTextField nameField1;
  JTextField nameField2;
  JTextArea textArea;
JTextArea textArea2;
     

        public chatPanel(int width, int height) {
              super(width, height, false, true );
              setRoot(buildGUI(width,height));
                          }

  private JComponent buildGUI (int width, int height) {
              chatPane = new JPanel();
              chatPane.setDoubleBuffered(true);
              chatPane.setSize(new Dimension(width,height));
              chatPane.setBackground(Color.darkGray);
              
        textField = new JTextField("",35);
        textField.setBackground(new Color(0.0f,0.5f,0.7f,0.3f));
        textField.setForeground(Color.WHITE);
        textField.setBorder(BorderFactory.createLineBorder(Color.black));
        textField.setPreferredSize(new Dimension(30,30));
                      
        nameField1 = new JTextField("Chat Feed",35);
        nameField1.setBackground(new Color(0.7f,0.5f,0.7f,0.0f));
        nameField1.setForeground(Color.WHITE);
        //nameField1.setBorder(BorderFactory.createLineBorder(Color.black));
        nameField1.setPreferredSize(new Dimension(30,20));

        nameField2 = new JTextField("Action Events",35);
        nameField2.setBackground(new Color(0.7f,0.5f,0.7f,0.0f));
        nameField2.setForeground(Color.WHITE);
        //nameField2.setBorder(BorderFactory.createLineBorder(Color.black));
        nameField2.setPreferredSize(new Dimension(30,20));
                      
        textField.addKeyListener(new KeyListener(){  
        public void keyPressed(KeyEvent e) {}  
 
        public void keyReleased(KeyEvent e) {}  

        public void keyTyped(KeyEvent e) {  
        if(e.getKeyChar() == 10){  
         textArea.append("\n" + textField.getText()); 
         textField.setText(""); 
        }    
        }  
          });

        textArea = new JTextArea(8, 35);
        textArea.setEditable(false);
      textArea.setBorder(BorderFactory.createLineBorder(Color.black));
        textArea.setForeground(new Color(1.0f,1.0f,1.0f));
        textArea.setFont (javax.swing.UIManager.getFont ("Label.font"));
                   
        textArea.setBackground(new Color(0.0f,0.5f,0.7f,0.3f));
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);

        textArea2 = new JTextArea(8, 35);
        textArea2.setEditable(false);
        textArea2.setBorder(BorderFactory.createLineBorder(Color.black));
        textArea2.setForeground(new Color(1.0f,1.0f,1.0f));
        textArea2.setFont (javax.swing.UIManager.getFont ("Label.font"));
        
        textArea2.setBackground(new Color(0.0f,0.5f,0.7f,0.3f));
        textArea2.setLineWrap(true);
        textArea2.setWrapStyleWord(true);

                     /* JScrollPane scrollPane = new JScrollPane(textArea,
                                                                     JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                                                     JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                      scrollPane.setBorder(BorderFactory.createEmptyBorder(1,1,1,1));
                      //Add Components to the Applet.
                     GridBagLayout gridBag = new GridBagLayout();

                      chatPane.setLayout(gridBag);
                    
                      GridBagConstraints c = new GridBagConstraints();
                      c.gridwidth = GridBagConstraints.REMAINDER;
              c.gridheight= GridBagConstraints.REMAINDER;
              
                     c.fill = GridBagConstraints.HORIZONTAL;
                      gridBag.setConstraints(textField, c);

                      c.fill = GridBagConstraints.BOTH;
                      c.weightx = 1.0;
                      c.weighty = 1.0;
                      gridBag.setConstraints(scrollPane, c);

              chatPane.add(scrollPane);*/
              
        GridBagLayout gridBag = new GridBagLayout();
        chatPane.setLayout(gridBag);
        
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = 1;
        c.gridy = 1;
                    
        gridBag.setConstraints(nameField1, c);
        chatPane.add(nameField1);

        
        c.gridx = 2;
        c.gridy = 1;
                    
        gridBag.setConstraints(nameField2, c);
        chatPane.add(nameField2);
        
        
        c.gridx = 1;
        c.gridy = 2;
                    
        gridBag.setConstraints(textArea, c);
        chatPane.add(textArea);
        
        c.gridx = 2;
        c.gridy = 2;

        
        gridBag.setConstraints(textArea2, c);
        chatPane.add(textArea2);
        
        c.gridx = 1;
        c.gridy = 3;
        
        
        gridBag.setConstraints(textField, c);
        chatPane.add(textField);
        
        
        chatPane.setOpaque(false);
              
        
              
        return chatPane;
        }
  /*public void actionPerformed(ActionEvent evt) {
              String text = textField.getText();
              textArea.append(text + newline);
              textField.setText("");
        }*/
  }

also - when I add in scroll bars the transparency is lost
any ideas why this happens?
Thanks for your help

rmdire

The com.xith3d.userinterface package isn’t supported any longer.

I suggest checking out a UI package which uses the new Foreground node. E.g. http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1097928552

Will.

Hi , I ve gone thru the link you suggested

does anyone have any simple examples of how build a simple GIU using the foreGround Node.

Cheers

rmdire