Javax.swing problem

Hi, I'm trying to use arrays with JTextField. First I tried
Object textField[] = new JTextField[6];
so that I could do operations like
for(int i=0;i<6;i++){
((JTextField)posTextField).setText("0.0000");
((JTextField)velTextField[i]).setText("0.0000");
((JTextField)acclTextField[i]).setText("0.0000");
Next I tried with
JTextFieldtextField[] = new JTextField[6];
All gave a java.lang.NullPointerException when I tried to run the program. Any ideas?
Thanks

This doesn't work:
JTextField textField[] = new JTextField[6];
textField[0] = new JTextField(); //compiler
expects ']' or an identifierPost more code. In [code] and [/code] tags, ur using the code button, so it's readable.
Copy and paste the exact error message and tell us which line it's complaining about.

Similar Messages

  • Import javax.swing problems

    hey
    I am new to java and have recently downloaded j2sdk1.4.2_04. I am trying to create a simple graphical application. However, It doesnt seem to import the javax.swing.* libraries. I understand that there is the src.zip in the directory, so I unzipped it but it still doesn't read the package. I read elsewhere on this forum that you should set the path to src.zip. I have tried that and it also doesnt work. My current path is:
    PATH=C:\j2sdk1.4.2_04\lib\src.zip;C:\j2sdk1.4.2_04\bin
    Is there an error in this, or what else should I try? All suggestions greatly appreciated.

    There's no need to set your classpath when importing any of the standard packages that are provided by the JDK. Perhaps you could post a (small) code sample and the compiler error you are getting.

  • Javax.swing.GroupLayout - problem

    Hi
    Puzzling problem has occurred when developing the same application on different PC�s and using the same IDE (Netbeans 5.5) on both.
    The problem is that the �javax.swing.GroupLayout� class is being used when inserting netbeans GUI components on one of the PC�s. However, the other PC uses �org.jdesktop.layout.GroupLayout� and generates an error when trying to compile the �javax.swing.GroupLayout� components. It cannot find the javax.swing.GroupLayout� class.
    The jdk is jdk 6 for both.
    Can anyone shed any light on this?
    Regards
    GB

    Did you check the project properties?
    Project properties | Categories: Libraries --> Java Platform: JDK 1.6
    (javax.swing.GroupLayout works only with 1.6)

  • Exception problems utilizing javax.swing.UIManager

    I am in the process of creating a simple console environment for a certain application that runs in windows mainly but programmed in Java. Am trying to set the LookAndFeel to windows but it keeps throwing a java.lang.ClassNotFoundException_.
    try {
            javax.swing.UIManager.setLookAndFeel("com.sun.java.plat.windows.WindowsClassicLookAndFeel");
    } catch (Exception e) { System.err.println("Error: "+e); }After thinking I just simply didn't have the package installed correctly I wrote a simple app to check...
    public static void main(String[] args) {
         javax.swing.UIManager.LookAndFeelInfo[] info = javax.swing.UIManager.getInstalledLookAndFeels();
         for(int i=0; i<info.length;i++){
              String LFname = info.getName();
              String className = info[i].getClassName();
              System.out.println(LFname+" : "+className);
    }This gave me the output...Metal : javax.swing.plaf.metal.MetalLookAndFeel
    CDE/Motif : com.sun.java.swing.plaf.motif.MotifLookAndFeel
    Windows : com.sun.java.swing.plaf.windows.WindowsLookAndFeel
    Windows Classic : com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeelSo I can only assume that I have the the necessary resources installed correctly. Any thoughts on what might be causing my problem?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    So I can only assume that I have the the necessary resources installed correctly. Any thoughts on what might be causing my problem?
    com.sun.java.plat.windows.WindowsClassicLookAndFeel // the class you're trying to set
    com.sun.java.plaf.windows.WindowsClassicLookAndFeel // the class that is actually availableSee the difference?
    ~

  • Javax.swing.JTextPane - COLOR Problem

    Hi
    I am using javax.swing.JTextPane object to display text recieved from two servers.
    How can I make messages recieved from Server 1 to be in RED and while from Server 2
    to be in Green? i.e. the window should look...
    (red) Server 1 says ta ta
    (green) Server 2 says Hello
    My code looks....
    javax.swing.JTextPane WINDOW;
    String message1 = connection1.getMessage();
    ..........// What code should I put here??? to make this message look RED??
    ..........// Color of previous text should remain as it is...
    WINDOW.setText(WINDOW.getText() + message1);An Example would be highly appreciated.
    Regards
    Fahad

    Hi,
    that is the wrong way - try this method in your JTextPane subclass
    public void appendText(String s,Color col) {
    StyledDocument sd = getStyledDocument();
    SimpleAttributeSet attr = new SimpleAttributeSet();
    StyleConstants.setForground(attr,col);
    try { sd.insertString(sd.getLength(),s,attr); }
    catch (BadLocationException e) {}
    } // end of methodand use it in your code like that
    WINDOW.appendText(message1,Color.red);
    hope that helps
    greetings Marsian

  • Problem Loading an Image with javax Swing from a JApplet

    First of all, i use JCreator as java creater and have the newest version of java sdk version.
    Now i need to load an image from the harddrive on which the JApplet is located. I need to do this from inside the JApplet. I have put my pictures in a map 'images' which is located in the same directory as the classes + htm file. It works from inside JCreator, but as soon as i open the normal htm it just WON'T load that image (grmbl).
    Here is my code for loading the image:
    public BufferedImage loadImage (String filename, int transparency)
         Image image;
         if (app)
              image = Toolkit.getDefaultToolkit().getImage(("./images/"+filename));
         else
              String location = "";
              location = "./images/"+filename;
              image = Toolkit.getDefaultToolkit().getImage(location);
         MediaTracker mediaTracker = new MediaTracker(new Container());
         mediaTracker.addImage(image, 0);
         try
              mediaTracker.waitForID(0);
         catch (Exception e)
    Could anybody help me out here??
    I tried a url already using getCodeBase() or getDocumentBase() but that gives an error because it cannot find those if using a JApplet.

    Why don't you use javax.swing.ImageIcon? If you already have a flag telling if it's an application or applet, use the getDocumentBase() to base the URL in the applet part only.

  • 1.4.2 Java Swing problems

    I have a swing application with 2 JComboBox 's, 1 JPanel (for pictures), 1 JButton and a scroll pane. Basicall the JComboBoxes have an action listener that changes the pictures when I cahnge the names. However, I would like the Jbutton when pressed to display the name chosen (from the JComboBox) and display it in the textArea. See code below.
    import javax.swing.*;
    import javax.swing.Action;
    import java.awt.event.ActionEvent;
    import  java.awt.event.ItemListener;
    import java.awt.*;
    import java.awt.event.*;
    * @author Administrator
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class choice_in2 extends JPanel implements ActionListener{
         private JLabel contender1FieldLabel;
         private JLabel contender2FieldLabel;
         private JButton runButton;
         JLabel picture1;
         JLabel picture2;
         //Text area which shows the result
         private JTextArea textArea;
         private JLabel textAreaLabel;
         public choice_in2(){
              //          Create a ChoiceField for the input of first contender
              contender1FieldLabel = new JLabel("Contender1 ",4);
              String[] contender1Strings = { "Bill", "Bob", "Don", "Michael", "John" };
              JComboBox contender1List = new JComboBox(contender1Strings);
              contender1List.setSelectedIndex(1);
              contender1List.addActionListener(new Eavesdropper1(picture1));
              //          Create a ChoiceField for the input of second contender
              contender2FieldLabel = new JLabel("Contender2 ",4);
              String[] contender2Strings = { "Philip", "Timothy", "Tom", "Kenneth", "Stone" };
              JComboBox contender2List = new JComboBox(contender2Strings);
              contender2List.setSelectedIndex(2);
              contender2List.addActionListener(new Eavesdropper2(picture2));
            //Set up the first picture.
            picture1 = new JLabel();
            picture1.setFont(picture1.getFont().deriveFont(Font.ITALIC));
            picture1.setHorizontalAlignment(JLabel.CENTER);
            updateLabel1(contender1Strings[contender1List.getSelectedIndex()]);
            picture1.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
            //Set up the second picture.
            picture2 = new JLabel();
            picture2.setFont(picture1.getFont().deriveFont(Font.ITALIC));
            picture2.setHorizontalAlignment(JLabel.CENTER);
            updateLabel2(contender2Strings[contender2List.getSelectedIndex()]);
            picture2.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
            //The preferred size is hard-coded to be the width of the
            //widest image and the height of the tallest image + the border.
            //A real program would compute this.
            picture1.setPreferredSize(new Dimension(200, 220+10));
            picture2.setPreferredSize(new Dimension(200, 220+10));
              // Create a JButton that will compute
              runButton = new JButton("Compute");
              runButton.addActionListener(new Eavesdropper3(textArea));
              // Create a JTextArea that will display the results
              textAreaLabel = new JLabel("Results");       
              textArea = new JTextArea(10,70);
              textArea.setFont(new Font("Courier",Font.PLAIN,12));
              JScrollPane scrollPane =  new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
              textArea.setEditable(false);
            //Lay out the demo.
            add(contender1List, BorderLayout.WEST);
            add(picture1, BorderLayout.WEST);
            add(contender2List, BorderLayout.EAST);       
            add(picture2, BorderLayout.EAST);
            add(runButton, BorderLayout.EAST);
            add(textAreaLabel, BorderLayout.SOUTH);
            add(scrollPane, BorderLayout.SOUTH);
            setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
        /** Listens to the combo box. */
        public void actionPerformed(ActionEvent e) {
        public void updateLabel1(String name1) {
            ImageIcon icon1 = createImageIcon( name1 + ".jpg");
            picture1.setIcon(icon1);
            picture1.setToolTipText("A drawing of a " + name1.toLowerCase());
            if (icon1 != null) {
                picture1.setText(null);
            } else {
                picture1.setText("Image not found");
        public void updateLabel2(String name2) {
             ImageIcon icon2 = createImageIcon( name2 + ".jpg");
            picture2.setIcon(icon2);
            picture2.setToolTipText("A drawing of a " + name2.toLowerCase());
            if (icon2 != null) {
               picture2.setText(null);
            } else {
                picture2.setText("Image not found");
        /** Returns an ImageIcon, or null if the path was invalid. */
        public ImageIcon createImageIcon(String path) {
            java.net.URL imgURL = choice_in2.class.getResource(path);
            if (imgURL != null) {
                return new ImageIcon(imgURL);
            } else {
                System.err.println("Couldn't find file: " + path);
                return null;
        class Eavesdropper2 implements ActionListener {
            JLabel myTextArea;
            public Eavesdropper2(JLabel ta) {
                 myTextArea = ta;
            public void actionPerformed(ActionEvent e) {
                JComboBox contender2List = (JComboBox)e.getSource();
                String contender2ListName = (String)contender2List.getSelectedItem();
                updateLabel2(contender2ListName);
                Eavesdropper3 code;
                code = new Eavesdropper3(contender2ListName);
        class Eavesdropper1 implements ActionListener {
            JLabel myTextArea;
            public Eavesdropper1(JLabel tt) {
                 myTextArea = tt;
            public void actionPerformed(ActionEvent e) {
                JComboBox contender1List = (JComboBox)e.getSource();
                String contender1ListName = (String)contender1List.getSelectedItem();
                updateLabel1(contender1ListName);
        class Eavesdropper3  implements ActionListener  {
             String contender22;
            JTextArea myTextArea;
            public Eavesdropper3(JTextArea bb) {
                 myTextArea = bb;
            public Eavesdropper3(String contender2ListName){
                 contender22 = contender2ListName;
               * @return Returns the contender22.
              public String getContender22() {
                   return contender22;
            public void actionPerformed(ActionEvent e) {
                 textArea.setText("Wild Test");
                 textArea.append("\n      OUTCOME    \n\n " +getContender22());
    }

    weebib
    We are using Windows XP , Nvidia graphics card, with Multiview. I hope the problem is not specific to the platform.
    It is reproducible with 1.4.2 and absent in 1.4.1
    camickr
    I am new to this forum. didn't know about code blocks.

  • Urgent help need on swing problem

    Dear friends,
    I met a problem and need urgent help from guru here, I am Swing newbie,
    I have following code and hope to draw lines between any two components at RUN-TIME, not at design time
    Please throw some skeleton code, Thanks so much!!
    code:
    package com.swing.test;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class LongguConnectLineCommponent
        public static void main(String[] args)
            JFrame f = new JFrame("Connecting Lines");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new ConnectionPanel());
            f.setSize(400,300);
            f.setLocation(200,200);
            f.setVisible(true);
    class ConnectionPanel extends JPanel
        JLabel label1, label2, label3, label4;
        JLabel[] labels;
        JLabel selectedLabel;
        int cx, cy;
        public ConnectionPanel()
            setLayout(null);
            addLabels();
            label1.setBounds( 25,  50, 125, 25);
            label2.setBounds(225,  50, 125, 25);
            label3.setBounds( 25, 175, 125, 25);
            label4.setBounds(225, 175, 125, 25);
            determineCenterOfComponents();
            ComponentMover mover = new ComponentMover();
            addMouseListener(mover);
            addMouseMotionListener(mover);
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Point[] p;
            for(int i = 0; i < labels.length; i++)
                for(int j = i + 1; j < labels.length; j++)
                    p = getEndPoints(labels, labels[j]);
    //g2.draw(new Line2D.Double(p[0], p[1]));
    private Point[] getEndPoints(Component c1, Component c2)
    Point
    p1 = new Point(),
    p2 = new Point();
    Rectangle
    r1 = c1.getBounds(),
    r2 = c2.getBounds();
    int direction = r1.outcode(r2.x, r2.y);
    switch(direction) // r2 located < direction > of r1
    case (Rectangle.OUT_LEFT): // West
    p1.x = r1.x;
    p1.y = r1.y;
    p2.x = r2.x + r2.width;
    p2.y = r2.y;
    if(r1.y > cy)
    p1.y = r1.y + r1.height;
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_TOP): // North
    p1.x = r1.x;
    p1.y = r1.y;
    p2.x = r2.x;
    p2.y = r2.y + r2.height;
    if(r1.x > cx && r2.x > cx)
    p1.x = r1.x + r1.width;
    p2.x = r2.x + r2.width;
    break;
    case (Rectangle.OUT_LEFT + Rectangle.OUT_TOP): // NW
    p1.x = r1.x;
    p1.y = r1.y;
    p2.x = r2.x + r2.width;
    p2.y = r2.y;
    if(r1.y > r2.y + r2.height)
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_RIGHT): // East
    p1.x = r1.x + r1.width;
    p1.y = r1.y;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.y > cy)
    p1.y = r1.y + r1.height;
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_TOP + Rectangle.OUT_RIGHT): // NE
    p1.x = r1.x + r1.width;
    p1.y = r1.y;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.y > cy)
    p1.y = r1.y + r1.height;
    p2.y = r2.y + r2.height;
    if(r1.y > r2.y + r2.height)
    p1.y = r1.y;
    else
    if(r1.y > r2.y + r2.height)
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_BOTTOM): // South
    p1.x = r1.x;
    p1.y = r1.y + r1.height;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.x > cx && r2.x > cx)
    p1.x = r1.x + r1.width;
    p2.x = r2.x + r2.width;
    break;
    case (Rectangle.OUT_RIGHT + Rectangle.OUT_BOTTOM): // SE
    p1.x = r1.x + r1.width;
    p1.y = r1.y + r1.height;
    p2.x = r2.x;
    p2.y = r2.y;
    break;
    case (Rectangle.OUT_BOTTOM + Rectangle.OUT_LEFT): // SW
    p1.x = r1.x;
    p1.y = r1.y + r1.height;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.x > r2.x + r2.width)
    p2.x = r2.x + r2.width;
    if(r1.x > cx && r2.x > cx)
    p1.x = r1.x + r1.width;
    p2.x = r2.x + r2.width;
    return new Point[] {p1, p2};
    private void determineCenterOfComponents()
    int
    xMin = Integer.MAX_VALUE,
    yMin = Integer.MAX_VALUE,
    xMax = 0,
    yMax = 0;
    for(int i = 0; i < labels.length; i++)
    Rectangle r = labels[i].getBounds();
    if(r.x < xMin)
    xMin = r.x;
    if(r.y < yMin)
    yMin = r.y;
    if(r.x + r.width > xMax)
    xMax = r.x + r.width;
    if(r.y + r.height > yMax)
    yMax = r.y + r.height;
    cx = xMin + (xMax - xMin)/2;
    cy = yMin + (yMax - yMin)/2;
    private class ComponentMover extends MouseInputAdapter
    Point offsetP = new Point();
    boolean dragging;
    public void mousePressed(MouseEvent e)
    Point p = e.getPoint();
    for(int i = 0; i < labels.length; i++)
    Rectangle r = labels[i].getBounds();
    if(r.contains(p))
    selectedLabel = labels[i];
    offsetP.x = p.x - r.x;
    offsetP.y = p.y - r.y;
    dragging = true;
    break;
    public void mouseReleased(MouseEvent e)
    dragging = false;
    public void mouseDragged(MouseEvent e)
    if(dragging)
    Rectangle r = selectedLabel.getBounds();
    r.x = e.getX() - offsetP.x;
    r.y = e.getY() - offsetP.y;
    selectedLabel.setBounds(r.x, r.y, r.width, r.height);
    determineCenterOfComponents();
    repaint();
    private void addLabels()
    label1 = new JLabel("Label 1");
    label2 = new JLabel("Label 2");
    label3 = new JLabel("Label 3");
    label4 = new JLabel("Label 4");
    labels = new JLabel[] {
    label1, label2, label3, label4
    for(int i = 0; i < labels.length; i++)
    labels[i].setHorizontalAlignment(SwingConstants.CENTER);
    labels[i].setBorder(BorderFactory.createEtchedBorder());
    add(labels[i]);

    If you need some help, be respectful of the forum rules and people will help. By using "urgent" in the title and bumping your message every 2 hours you're just asking to be ignored (which is what you ended up with).

  • Import javax.swing.*;

    I start my programm with:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import rechenwerk.Rechenwerk; import rechenwerk.RechenwerkFassade;
    import zahl.Zahl; import zahl.ZahlFassade;
    import oberflaeche.Oberflaeche;
    At "import javax.swing.*" i get the failure message from the compiler:
    Oktalrechner.java:8: Package javax.swing not found in import.
    import javax.swing.*;
    What is wrong? I don't know-please help me.
    I'm using JDK1.2BETA4

    Tell me when you execute java -version, what you are getting?
    Looks like you are suing old JDK.
    Download the latest public release JDK1.4 from http://java.sun.com
    /Sreenivasa Kumar Majji.
    Did somebody help you? I have a similar problem with
    javax.resource... :(
    I start my programm with:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import rechenwerk.Rechenwerk; import
    rechenwerk.RechenwerkFassade;
    import zahl.Zahl; import zahl.ZahlFassade;
    import oberflaeche.Oberflaeche;
    At "import javax.swing.*" i get the failure message
    from the compiler:
    Oktalrechner.java:8: Package javax.swing not foundin
    import.
    import javax.swing.*;
    What is wrong? I don't know-please help me.
    I'm using JDK1.2BETA4

  • Javax.swing.tree.DefaultMutableTreeNode

    I have a tree with some nodes in it.
    I am using setAllowsChildren(boolean x) method of javax.swing.tree.DefaultMutableTreeNode on the nodes.
    But the problem i m facing is
    1....if setAllowsChildren() method returns true ,i m getting tree icon displayed on side of node(irrespective of whether the node has children or not )
    I m facing with a challenge of allowing node to have children by using
    setAllowsChildren(true) and at the same time display tree icon only when children are present.
    Some of my friends say it is a java bug.
    If not how do i go about solving this one.
    Thanks in advance

    Ok i will put it in another way.
    Is there any other way by which the tree icon can be made to display
    without the usage of[b] setAllowsChildren() method

  • Import javax.swing.JOptionPane

    hello
    i just installed j2sdk1.3.1 into my redhat linux7.3, during installation, everything's fine...
    but when i start to compile a program with some import classes...i face the problem :
    cannot find type "javax/swing/JOptionPane
    this is my program :
    import javax.swing.JOptionPane;
    public class Welcome{
    public static void main(String args[])
         JOptionPane.showMessageDialog(null,"Hello");
         System.exit(0);
    can anybody help me with this problem......?...thanks

    type
    java -versionto see which version of the JVM you are running
    you could also try
    which javato see the actuall executable that you are running.

  • Javax.swing.text.TableView bug in 1.4 beta 2 ?

    Hi,
    I derived a class from TableView, which worked fine with 1.3, but now causes the following exception as soon as being layouted:
    java.lang.Error: should not happen: class com.lexetius.swing.text.LexTableView
    at javax.swing.text.BoxView.baselineLayout(Unknown Source)
    at javax.swing.text.ParagraphView$Row.layoutMinorAxis(Unknown Source)
    at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
    at javax.swing.text.BoxView.layout(Unknown Source)
    at javax.swing.text.BoxView.setSize(Unknown Source)
    at javax.swing.text.BoxView.updateChildSizes(Unknown Source)
    at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
    at javax.swing.text.BoxView.layout(Unknown Source)
    at javax.swing.text.FlowView.layout(Unknown Source)
    at javax.swing.text.BoxView.setSize(Unknown Source)
    at javax.swing.text.BoxView.updateChildSizes(Unknown Source)
    at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
    at javax.swing.text.BoxView.layout(Unknown Source)
    at javax.swing.text.BoxView.setSize(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at javax.swing.JEditorPane.getPreferredSize(Unknown Source)
    at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source)
    at java.awt.Container.layout(Unknown Source)
    at java.awt.Container.doLayout(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validate(Unknown Source)
    at javax.swing.RepaintManager.validateInvalidComponents(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknow
    n Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    any ideas???

    I wrote the com.lexetius.swing.text.LexTableView component myself. It is derived directly from javax.swing.text.TableView and it adds virtually no functionality. I'm quite sure, the problem comes from the TableView class, but I can't verify that directly, since this class is abstract (why is that, anyway??).
    It would certainly help me very much, if anybody had a component, which is also derived from javax.swing.text.TableView and works with the 1.4 beta.

  • Cannot Import javax.swing.JOptionPane   Please HELP!!!

    import javax.swing.JOptionPane;
    this line of code returns the error:
    C:\Java Files\BankAccount\BankAccount_Test.java:1: Class javax.swing.JOptionPane not found in import.
    import javax.swing.JOptionPane;
    ^
    1 error
    Process completed.
    Please help, I don't know what the problem could be....

    Swing was not part of any JDK's earlier than 1.2. Swing (or anything with a J in front of it, ie. JFrame, JOptionPane, etc...) was probably the most dramatic (if not largest) modification/addition to the Java language, that's why versions later than, and including, 1.2 are known as "Java 2".

  • Swing problems...

    Hello all... am having problems while compiling a GUI application.
    The compiler says that the package org.jdesktop.layout does not exist :-/
    i've read that this is happens when you align or move buttons, labels, etc..
    if anyone has a solution pls let me know, and thaks!
    Here is the code:
    * Binomial.java
    * Created on March 21, 2006, 8:38 PM
    package programas;
    * @author  Dionis
    public class Binomial extends javax.swing.JApplet {
        /** Initializes the applet Binomial */
        public void init() {
            try {
                java.awt.EventQueue.invokeAndWait(new Runnable() {
                    public void run() {
                        initComponents();
            } catch (Exception ex) {
                ex.printStackTrace();
        /** This method is called from within the init() method to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            ValorN = new javax.swing.JTextField();
            ValorP = new javax.swing.JTextField();
            jLabel3 = new javax.swing.JLabel();
            JTextField3 = new javax.swing.JTextField();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jLabel1.setText("Digite a N:");
            jLabel2.setText("Digite a P:");
            jLabel3.setText("Coeficiente B:");
            JTextField3.setEditable(false);
            jButton1.setText("Calcular");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jButton2.setText("Limpiar");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton2ActionPerformed(evt);
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jLabel1)
                        .add(jLabel2)
                        .add(jLabel3))
                    .add(24, 24, 24)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(layout.createSequentialGroup()
                            .add(JTextField3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 123, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap())
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createSequentialGroup()
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(ValorP, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
                                    .add(ValorN, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE))
                                .addContainerGap(113, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(layout.createSequentialGroup()
                                .add(jButton1)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jButton2)
                                .addContainerGap()))))
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(26, 26, 26)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel1)
                        .add(ValorN, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel2)
                        .add(ValorP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(22, 22, 22)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel3)
                        .add(JTextField3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 78, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(65, 65, 65)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton2)
                        .add(jButton1))
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        }// </editor-fold>                       
        private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
                    ValorN.setText("");
                    ValorP.setText("");
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
           int N = Integer.parseInt(ValorN.getText());
           int P = Integer.parseInt(ValorP.getText());
           int DNP = 0;
           long FN = 0;
           long FP = 0;
           long FD = 0;
           long CB =  0;
           String texto = "";
           final int repetidor = 1;
          DNP = (N - P);
            // Calcula Factorial de N
            if (N < 2){
              JTextField3.setText("Menores que 2 no tienen factorial");
            else{
            for (int factorial = 1; factorial <= N; N++){
               FN = FN * factorial;
           //Calcular Factorial de P
          if (P < 2){
           JTextField3.setText("Menores que 2 no tienen factorial");
          else{
              for(int factorial =1; factorial <= P; P++){
                  FP = FP * factorial;
          //Calcular Factorial de  (N-P)
          if (DNP < 2){
              JTextField3.setText("Menores que 2 no tienen factorial");
          else {
              for (int factorial =1; factorial <= DNP; DNP++){
                  FD = FD * factorial;
          //Calculo de Coeficiente Binomial
          CB = N/FP * FD;
           texto = texto+Long.toString(CB);
           JTextField3.setText("texto");
        // Variables declaration - do not modify                    
        private javax.swing.JTextField JTextField3;
        private javax.swing.JTextField ValorN;
        private javax.swing.JTextField ValorP;
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        // End of variables declaration                  
    }

    The way for solve this problem is, step by step:
    1. In your preject, over "libraries", right clik and add libraries
    2. Selcet "Swing Layout Extensions" and push "Manage Libraries..."
    3. "Add Jar/Folder..."
    4. Select "c:/Program files/netbeams-5.0/modules/ext/swing-layout-1.0.jar" (in spanish c:/archivos de programa/....)
    5. Build your project (If you have more than 1 project, be careful that you are compiling this project and no other)
    Be happy my friend...

  • Swing problem with mac os 9 and 10

    Hi,
    I've finished my first "big" application, a little french-lemmatisation tool. It works well on my PC but some people who have tried it with mac os 9 and X tell me it doesn't work at all ?!
    I've built my soft with InstallAnywhere 5 (is that the bad idea ?). On mac OS9, it reports java.lang.NoClassDEfFoundError : javax/swing/UIManager (which is the first Swing element that is called). So it seems that the path is not correct. On mac OSX, it stops too (no message)... I've spent my day to try to understand what I should change. Without success.
    Where do you think I should watch to correct the paths ?
    The installer (in French) can be found at this adress : http://wwwpeople.unil.ch/Benoit.Curdy/install.htm
    (I don't think there is a problem in the code but if someone wants to have a look : http://wwwpeople.unil.ch/Benoit.Curdy) it's free ;)
    Thanks

    I developed a application for MAC os/x and win plateforms.
    To distribute my appplication on wins , i use installAnywhere but for the mac I use MRJAppBuilder to create a application.
    Then the user has just to drag the directory from the CD to his desktop or anywhere else, and make an alias to the app on his desktop to lauuch the app.
    MRAppBuilder is on every MAC OS/X, I think.
    Hope it helps

Maybe you are looking for

  • I can't get on to facebook at all

    when I go to facebook this is the message I get, "XML Parsing Error: unexpected parser state Location: jar:file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/omni.ja!/chrome/toolkit/content/global/netError.xhtml Line Number 308, Column 50: <div id=

  • Can't capture due to a lack of disk space...except the disk is empty!

    Using 5.1.4, I'm attempting to capture some DV footage to an external hard drive with about 60gb free. For some reason, once FCP has captured 2 gigs worth of footage, it stops and claims there isn't enough space on the disk. My system settings show t

  • How hard to switch out a motherboard?

    My beloved, trustworthy, amazing Powerbook Ti just died on me after five years of uncomparable service. I only had to purchase one replacement battery, the screen was still perfection, and so on... (Can you tell I'm in complete mourning?) It has been

  • JAEHYLEE  (R11i AOL)  Adpatch fails with Pre-req check

    Goal 이미 적용한 patch를 Adpatch가 다시또 Pre-req로 재차 확인을 요청하는 경우가 발생할 경우 Cause adpatch는 AD_SNAPSHOT_BUGFIXES table의 bugfix_id에 record를 가지고 있어여 하나 여기에 데이타가 없는 경우에 prereq check를 잘못할수 있다 fix: adadmin을 사용하여 Maintain snapshot information을 수행을 권고 드립니다. Perform the

  • How to deploy webservices in weblogic 90

    I am tryiong to find a way to deploy a set of web service endpoints represented by stateless session beans in WL9.0. I know that 9.0 best practice recommendation is using JSR181 and jwsc tool, but for various reasons I cannot use that approach. So, w