HelloWorld Swing Error -JFrame

Not sure why this happened. I've made no change to my computer, yet today I am unable to
compile the following code, when I was able to do it the day before. For some rease JFrame is
not understood:
My Code:
import javax.swing.*;
import java.awt.*;
public class HelloWorld extends JApplet {
SwingHelloWorldPanel m_Panel;
Create the panel and pass init to it
public void init() {
m_Panel = new SwingHelloWorldPanel();
// NOTE the call to getContentPane - this is important
getContentPane().add("Center", m_Panel);
m_Panel.init();
public void start() {
m_Panel.start();
Inner class representing a panel which does all the work
static class SwingHelloWorldPanel extends JPanel {
public void paint(Graphics g) {
super.paint(g);
Dimension size = getSize();
g.setColor(Color.lightGray);
g.fillRect(0,0,size.width,size.height);
g.setColor(Color.red);
g.drawString("Hello World",50,50);
// Override to do more interesting work
public void init() {
public void start() { }
// end inner class SwingHelloWorldPanel
Standard main for Applet/Application projects
Note that an inner class is created to to the
real work. The use of a light weight inner class
prevents inclusion of a heavyweight JApplet inside
a heavyweight container
public static void main(String args[]) {
     JFrame f = new JFrame("SwingHelloWorld");
     // Create the panel and pass init and start to it
     SwingHelloWorldPanel     hello = new SwingHelloWorldPanel();
// NOTE the call to getContentPane - this is important
     f.getContentPane().add(hello);
     hello.init();
     hello.start();
     f.setSize(300, 300);
     f.show();
The error:
C:\java_dev>javac HelloWorld.java
HelloWorld.java:71: cannot resolve symbol
symbol : constructor JFrame (java.lang.String)
location: class JFrame
JFrame f = new JFrame("SwingHelloWorld");
^
1 error
Thanks in advance

EXIT_ON_CLOSE has been in the API since v 1.3. Are you using an earlier version?

Similar Messages

  • New to swing: Error while using getText() in ActionPerformed

    Hi there!
    I'm fairly new to java and swing, and this problem I'm having drives me nuts!
    // Imports //
    public class Generator extends JFrame {
         // Graphical components
         private JTextField nr1;
         private JTextField nr2;
         // Constructor
         public Generator() {
              // Call superclass
                    // Init variables
              JTextField nr1 = new JTextField(2);
              JTextField nr2 = new JTextField(2);
              nr1.setVisible(true);
              nr2.setVisible(true);
              // Layout stuff..
              // Create listner-object for event handeling
              Lyssnare minLyssnare = new Lyssnare();
              playerName.addActionListener(minLyssnare);
              clear.addActionListener(minLyssnare);
              shuffle.addActionListener(minLyssnare);
              // closing of window
              // Pack
              // Visible
         // Action Listener
         class Lyssnare implements ActionListener {
              public void actionPerformed(ActionEvent ae) {
                   // Some other actions...
                            // Shuffle
                   else if(ae.getSource() == shuffle) {
                        String teams = nr1.getText();
                        String players = nr2.getText();
                        Shuffle.shuffle(name);
                        playerArea.setVisible(false);
                        int teamsint = Integer.parseInt(teams);
                        int playersint = Integer.parseInt(players);
                        error1.setVisible(true);
         }The error I get is after "else if(ae.getSource() == shuffle) {"
    something on the next line (and the line after that) is the one who gives the error...
    I Get this (during running, compile works fine..):
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    AFAIK that means I'm reffering to something that is null... but how can that be when all the textfields are initialised? do I have to make does fields global in some way?
    Grateful for any help!

    Your inner class does not have access to nr1 and nr2 because they are not final variables.
    Instead of creating an inner class Lyssnare, you can have your Generator class implement the ActionListener and add the actionPerformed method inside Generator class as follows:
    public class Generator extends JFrame implements ActionListener {
         // Graphical components
         private JTextField nr1;
         private JTextField nr2;
         // Constructor
         public Generator() {
              // Call superclass
                    // Init variables
              JTextField nr1 = new JTextField(2);
              JTextField nr2 = new JTextField(2);
              nr1.setVisible(true);
              nr2.setVisible(true);
              // Layout stuff..
              // Create listner-object for event handeling
              //Lyssnare minLyssnare = new Lyssnare();
              playerName.addActionListener(this);
              clear.addActionListener(this);
              shuffle.addActionListener(this);
              // closing of window
              // Pack
              // Visible
    public void actionPerformed(ActionEvent ae) {
                   // Some other actions...
                            // Shuffle
                   else if(ae.getSource() == shuffle) {
                        String teams = nr1.getText();
                        String players = nr2.getText();
                        Shuffle.shuffle(name);
                        playerArea.setVisible(false);
                        int teamsint = Integer.parseInt(teams);
                        int playersint = Integer.parseInt(players);
                        error1.setVisible(true);
              }

  • Swing Error

    Get the following error:
    package javax.swing not found in import
    I am using jdk1.3.1
    Here is my code
    import java.awt.*;
    import javax.swing.*;
    public class Notepad1 extends JFrame {
         public Notepad1() {
              setSize(300, 400);
              show();
         public static void main(String[] args) {
              Notepad1 npad = new Notepad1();

    Your JDK installation is probably broken, try reinstalling.

  • Swing error messages

    I have written the follwing code and to the best on my understanding it's correct but for some reason the JButton object fails to show up on the JPanel(i'm not even 100% sure the panel is attached the JFrame). The error message i get is as follows:
    Exception in thread "main" java.lang.Error: Do not use Mouse.add() use Mouse.get
    ContentPane().add() instead
    at javax.swing.JFrame.createRootPaneException(JFrame.java:465)
    at javax.swing.JFrame.addImpl(JFrame.java:491)
    at java.awt.Container.add(Container.java:307)
    at Mouse.main(Mouse.java:31)
    and here is the code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Mouse extends JFrame
         public static void main(String[] args)
              JFrame jf = new Mouse();
              jf.setSize(300, 300);
              jf.setVisible(true);
              JPanel jp = new JPanel(new FlowLayout());
              JButton jb = new JButton("GO!");
              jb.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        System.out.println("hello");
              jp.add(jb);
              jf.add(jp);
         // constructor
         public Mouse()
              super("MouseListener");
    can anyone see anything wrong with it?

    Hello,
    Exception in thread "main" java.lang.Error: Do not use Mouse.add()
    use Mouse.getContentPane().add() insteadAs clearly stated by the exception message, you should add the JPanel this way:
    jf.getContentPane().setLayout(new BorderLayout());
    jf.getContentPane().add(jp, BorderLayout.NORTH);I hope it helps.

  • Java1.3.1 + (Jframe + Timer(swing) + Jmenu) = jframe quits!!

    Hi,
    I have a program swing which draws polygons (nope, not 3d) on a JPanel in a JFrame.
    I am not sure why, but my Timer (swing, not java.util) and Jmenu component somehow don't like each other.
    My program works fine without the JMenu, or without the Timer, but as soon as I use both, the program fires up and closes immediately without any errors! (running jdb revealed nothing)
    This only happens in java 1.3.1, <b>not 1.4</b>, but before I label this as a bug (which one shouldn't do too quickly!) perhaps someone round here can try this out and perhaps find my (silly) mistake, if it exists.
    Thank you in advance,
    Vilnis
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Scene
    public static void main(String[] args){
    JFrame frame = new Display();
    frame.addWindowListener(new Closer());
    frame.setSize(640,480);
    frame.show();
    class Closer extends WindowAdapter
    public void windowClosing(WindowEvent e){
    //this is the only exiting command in the whole code
    System.out.println("Exited properly");
    System.exit(0);
    class Display extends JFrame
    Drawing graphics;
    JPopupMenu sceneMenu;
    MouseListener popupListener;
    Display(){
    graphics = new Drawing();
    sceneMenu = popMenu();
    popupListener = new PopupListener();
    graphics.addMouseListener(popupListener);
    getContentPane().add(graphics);
    public JPopupMenu popMenu(){
    JPopupMenu menu;
    menu = new JPopupMenu();
    /* one way to stop the problem is to comment out the next three
    * lines, i.e. remove the JMenu component.
    * the other 'solution' is to comment out line 127 (timer)
    JMenu subMenu = new JMenu("subMenu");
    subMenu.add(new JMenuItem("subButton1"));
    menu.add(subMenu);
    menu.add(new JMenuItem("button1"));
    menu.addSeparator();
    menu.add(new JMenuItem("button2"));
    return menu;
    /*this class has nothing to do with the problem -
    I tried commenting it out. */
    class PopupListener extends MouseAdapter
    public void mousePressed(MouseEvent e){
    maybeShowPopup(e);
    public void mouseReleased(MouseEvent e){
    maybeShowPopup(e);
    private void maybeShowPopup(MouseEvent e){
    if (e.isPopupTrigger()){
    sceneMenu.show(e.getComponent(),
    e.getX(), e.getY());
    class Drawing extends JPanel implements ActionListener
    private Polygon drawPoly[];
    private BouncyPolygon bPoly[];
    private Timer reDraw;
    Drawing(){
    //define 2 polygons
    int axs[] = {0,320,30, 50, 145};
    int ays[] = {0, 60, 100, 90, 200};
    int bxs[] = {50,370,80, 80, 220};
    int bys[] = {50, 110, 150, 56, 78};
    drawPoly = new Polygon[2];
    bPoly = new BouncyPolygon[2];
    drawPoly[0] = new Polygon(axs, ays, 5);
    drawPoly[1] = new Polygon(bxs, bys, 5);
    /* the bouncyPolygon class was originally supposed to have
    * it's own timer, but I took it out to see whether this
    * was something to do with the problem.
    * The 'this' (Drawing) class gets passed so getWidth and
    * getHeight can be used to bounce the individual points of
    * the polygons of walls even if the window is resized.
    * the first two params specify x and y coordinates, the third
    * specifies the number of points the polygon has,
    * the forth param is the drawing jPanel
    * and the last one is the speed of movement.
    bPoly[0] = new BouncyPolygon(axs, ays, 5, this, 4);
    bPoly[1] = new BouncyPolygon(bxs, bys, 5, this, 7);
    /* set timer to redraw screen every 30ms
    * (the only timer in the whole program)
    reDraw = new Timer(30,this);
    reDraw.start();
    public void actionPerformed(ActionEvent e)
    for (int i = 0; i <bPoly.length; i++){
    //move polygons
    bPoly.move();
    //update coordinates
    drawPoly[i].xpoints = bPoly[i].getXs();
    drawPoly[i].ypoints = bPoly[i].getYs();
    repaint();
    public void paintComponent(Graphics g){ 
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setPaint(
    new GradientPaint(0,0,Color.red, 320, 240, Color.green, true));
    g2.draw(drawPoly[0]);
    g2.setPaint(
    new GradientPaint(0,0,Color.blue, 320, 240, Color.yellow, true));
    g2.draw(drawPoly[1]);
    class BouncyPolygon
    private int pointCount;
    //coordinates
    private int xs[], ys[];
    //direction flags for each point
    private int dirX[], dirY[];
    //speed
    private int moveSize;
    private JPanel j;
    BouncyPolygon(int xpoints[], int ypoints[], int npoints, JPanel jp,
    int moveAmount){
    if (xpoints.length == npoints && ypoints.length == npoints){
    j = jp;
    pointCount = npoints;
    xs = xpoints;
    ys = ypoints;
    moveSize = moveAmount;
    dirX = new int[npoints];
    dirY = new int[npoints];
    //initialize direction array
    for (int i = 0; i < npoints; i++){
    dirX[i] = 1;
    dirY[i] = 1;
    } else{
    System.out.println(
    "Array size does no equal polygon point count!\n");
    System.exit(1);
    //move the polygons (and bounce of Walls)
    public void move(){
    for (int i = 0; i < pointCount; i++){
    if (dirX[i] == 1 && xs[i] >= j.getWidth() - (moveSize - 1)||
    dirX[i] == -1 && xs[i] <= (moveSize - 1)){
    dirX[i] *= -1;
    xs[i] += (int) (dirX[i] * moveSize);
    if (dirY[i] == 1 && ys[i] >= j.getHeight() - (moveSize - 1) ||
    dirY[i] == -1 && ys[i] <= (moveSize - 1)){
    dirY[i] *= -1;
    ys[i] += (int) (dirY[i] * moveSize);
    public int[] getXs(){
    return xs;
    public int[] getYs(){
    return ys;

    This code should work now ;)
    As I said before, the problem only comes up with java 1.3.1 and not 1.4.
    Ok, I don't know about other versions.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Scene
    public static void main(String[] args){
    JFrame frame = new Display();
    frame.addWindowListener(new Closer());
    frame.setSize(640,480);
    frame.show();
    class Closer extends WindowAdapter
    public void windowClosing(WindowEvent e){
    //this is the only exiting command in the whole code
    System.out.println("Exited properly");
    System.exit(0);
    class Display extends JFrame
    Drawing graphics;
    JPopupMenu sceneMenu;
    MouseListener popupListener;
    Display(){
    graphics = new Drawing();
    sceneMenu = popMenu();
    popupListener = new PopupListener();
    graphics.addMouseListener(popupListener);
    getContentPane().add(graphics);
    public JPopupMenu popMenu(){
    JPopupMenu menu;
    menu = new JPopupMenu();
    /* one way to stop the problem is to comment out the next three
    * lines, i.e. remove the JMenu component.
    * the other 'solution' is to comment out line 127 (timer)
    JMenu subMenu = new JMenu("subMenu");
    subMenu.add(new JMenuItem("subButton1"));
    menu.add(subMenu);
    menu.add(new JMenuItem("button1"));
    menu.addSeparator();
    menu.add(new JMenuItem("button2"));
    return menu;
    /*this class has nothing to do with the problem -
    I tried commenting it out. */
    class PopupListener extends MouseAdapter
    public void mousePressed(MouseEvent e){
    maybeShowPopup(e);
    public void mouseReleased(MouseEvent e){
    maybeShowPopup(e);
    private void maybeShowPopup(MouseEvent e){
    if (e.isPopupTrigger()){
    sceneMenu.show(e.getComponent(),
    e.getX(), e.getY());
    class Drawing extends JPanel implements ActionListener
    private Polygon drawPoly[];
    private BouncyPolygon bPoly[];
    private Timer reDraw;
    Drawing(){
    //define 2 polygons
    int axs[] = {0,320,30, 50, 145};
    int ays[] = {0, 60, 100, 90, 200};
    int bxs[] = {50,370,80, 80, 220};
    int bys[] = {50, 110, 150, 56, 78};
    drawPoly = new Polygon[2];
    bPoly = new BouncyPolygon[2];
    drawPoly[0] = new Polygon(axs, ays, 5);
    drawPoly[1] = new Polygon(bxs, bys, 5);
    /* the bouncyPolygon class was originally supposed to have
    * it's own timer, but I took it out to see whether this
    * was something to do with the problem.
    * The 'this' (Drawing) class gets passed so getWidth and
    * getHeight can be used to bounce the individual points of
    * the polygons of walls even if the window is resized.
    * the first two params specify x and y coordinates, the third
    * specifies the number of points the polygon has,
    * the forth param is the drawing jPanel
    * and the last one is the speed of movement.
    bPoly[0] = new BouncyPolygon(axs, ays, 5, this, 4);
    bPoly[1] = new BouncyPolygon(bxs, bys, 5, this, 7);
    /* set timer to redraw screen every 30ms
    * (the only timer in the whole program)
    reDraw = new Timer(30,this);
    reDraw.start();
    public void actionPerformed(ActionEvent e)
    for (int i = 0; i <bPoly.length; i++){
    //move polygons
    bPoly.move();
    //update coordinates
    drawPoly[i].xpoints = bPoly[i].getXs();
    drawPoly[i].ypoints = bPoly[i].getYs();
    repaint();
    public void paintComponent(Graphics g){
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setPaint(
    new GradientPaint(0,0,Color.red, 320, 240, Color.green, true));
    g2.draw(drawPoly[0]);
    g2.setPaint(
    new GradientPaint(0,0,Color.blue, 320, 240, Color.yellow, true));
    g2.draw(drawPoly[1]);
    class BouncyPolygon
    private int pointCount;
    //coordinates
    private int xs[], ys[];
    //direction flags for each point
    private int dirX[], dirY[];
    //speed
    private int moveSize;
    private JPanel j;
    BouncyPolygon(int xpoints[], int ypoints[], int npoints, JPanel jp,
    int moveAmount){
    if (xpoints.length == npoints && ypoints.length == npoints){
    j = jp;
    pointCount = npoints;
    xs = xpoints;
    ys = ypoints;
    moveSize = moveAmount;
    dirX = new int[npoints];
    dirY = new int[npoints];
    //initialize direction array
    for (int i = 0; i < npoints; i++){
    dirX[i] = 1;
    dirY[i] = 1;
    } else{
    System.out.println(
    "Array size does no equal polygon point count!\n");
    System.exit(1);
    //move the polygons (and bounce of Walls)
    public void move(){
    for (int i = 0; i < pointCount; i++){
    if (dirX[i] == 1 && xs[i] >= j.getWidth() - (moveSize - 1)||
    dirX[i] == -1 && xs[i] <= (moveSize - 1)){
    dirX[i] *= -1;
    xs[i] += (int) (dirX[i] * moveSize);
    if (dirY[i] == 1 && ys[i] >= j.getHeight() - (moveSize - 1) ||
    dirY[i] == -1 && ys[i] <= (moveSize - 1)){
    dirY[i] *= -1;
    ys[i] += (int) (dirY[i] * moveSize);
    public int[] getXs(){
    return xs;
    public int[] getYs(){
    return ys;

  • Swing Error while trying to set libraries on a new Project.

    I am running JDeveloper Version 10.1.2.1.0 (Build 1913) -- on a machine running Windows XP SP2
    Initially I tried with the basic version (without JDK) and configured by local install of j2sdk1.4.2_05.
    Then later I tried downloading the full version and used the java.version 1.4.2_06 which comes with it. In both cases I get a NPE while performing the following steps.
    Created a WorkSpace
    Created an Empty Project in it
    Go to Project Properties
    Click on "libraries"
    I get the following Error
    java.lang.NullPointerException
         at oracle.jdevimpl.config.JProjectLibrariesPanel.loadFrom(JProjectLibrariesPanel.java:134)
         at oracle.jdevimpl.config.JProjectLibrariesPanel.onEntry(JProjectLibrariesPanel.java:95)
         at oracle.ide.panels.MDDPanel.enterTraversableImpl(MDDPanel.java:841)
         at oracle.ide.panels.MDDPanel.enterTraversable(MDDPanel.java:815)
         at oracle.ide.panels.MDDPanel.access$7000871(MDDPanel.java:90)
         at oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(MDDPanel.java:1206)
         at oracle.ide.panels.MDDPanel$Tsl.updateSelection(MDDPanel.java:1074)
         at oracle.ide.panels.MDDPanel$Tsl.actionPerformed(MDDPanel.java:1068)
         at javax.swing.Timer.fireActionPerformed(Timer.java:271)
         at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
         at java.awt.Dialog$1.run(Dialog.java:540)
         at java.awt.Dialog.show(Dialog.java:561)
         at java.awt.Component.show(Component.java:1133)
         at java.awt.Component.setVisible(Component.java:1088)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
         at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:276)
         at oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(JProjectSettingsPanel.java:185)
         at oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(JProjectSettingsPanel.java:110)
         at oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(JProjectSettingsPanel.java:101)
         at oracle.jdeveloper.model.JProjectStructureController.handleEvent(JProjectStructureController.java:342)
         at oracle.ide.IdeAction.performAction(IdeAction.java:649)
         at oracle.ide.IdeAction$1.run(IdeAction.java:857)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Beyond this the JDev becomes practically unusable, as if I try clicking on any thing else I get the error, "The J2SE version must be specified"
    Only way to recover from the error is to close Jdev and re open the same. But even then I am not able to change any library setting for the project.
    Any suggestions on how to get around the problem?

    I believe I figured it out .. thanks

  • 8i EE, corba helloworld demo error

    Hi
    Machine: PII 300, 128Mb, Red Hat 6.0, 8.1.5 + patch 81501, KDE,
    user: oracle
    I'm trying to make the corba helloworld demo in
    javavm/demo/examples/corba/basic but i can't seem to compile the
    idl file.
    (I have installed patch 81501, and corrected the typo in
    idl2java (TMP=))
    It seems that the idl2java is going around in circles...
    Question:
    How can i resolve this.
    Question:
    If i want to write some java application, what jdk do i have to
    install? (or is it already installed?)
    Thanks in advance
    Bart De Lathouwer
    Aigis, Belgium
    null

    Hi,
    This error usually shoots up due to the incompatibility with the dependecies. Can you please summarise how you went on compiling the application. Meanwhile, I'm trying to simulate same scenario with the GreeterEJB and the Converter examples.
    Regards
    Raj

  • Weird Swing Error!

    With J2SE 1.4.2 (PREVIOUS VERSIONS DID NOT DO THIS) JDK i RANDOMLY get :
    java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI$ShortCutPanel.<init>(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(Unknown Source)
    at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknown Source)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.swing.JFileChooser.updateUI(Unknown Source)
    at javax.swing.JFileChooser.setup(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at MMCDCatalog.openDB(MMCDCatalog.java:570)
    at MMCDCatalog.access$200(MMCDCatalog.java:77)
    at MMCDCatalog$OpenFileAction.actionPerformed(MMCDCatalog.java:1023)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(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)
    with code
    JFileChooser fc;
    MMCDFileFilter ff;
    int dialogReturnVal;
    String nameChosen;
    //Create a file chooserfc = new JFileChooser();
    fc.setMultiSelectionEnabled(false);
    fc.setDragEnabled(false);
    //Create a new FileFilter
    ff = new MMCDFileFilter();
    //Add this filter to our File chooser.
    fc.addChoosableFileFilter(ff);
    fc.setFileFilter(ff);
    dialogReturnVal = fc.showOpenDialog(mainFrame);
    if (dialogReturnVal == JFileChooser.APPROVE_OPTION) {  
       nameChosen = fc.getSelectedFile().getAbsolutePath();
    }which is in my openDB() method, which is called from an actionPerformed() somewhere else that does nothing except calling openDB()
    IS THIS A BUG IN SWING 1.4.2??????????????
    AH! thought this would be relevant. I also execute the code (when building my GUI) :
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception ex) {
        JOptionPane.showMessageDialog(mainFrame, "Could not load the look and feel", "Error", JOptionPane.ERROR_MESSAGE);
    } and i'm running Windows XP Pro SP1... since 1.4.2 added the new "Windows XP" look, is it a new introduced bug???? that's why i'm asking :P

    1) cross posts are annoying
    2) have you tried the same code built on the same Java SDK on a system running Win2000 or Solaris
    3) with the honorific "Mastermind" I'm sure you can figure it out.
    4) is the line new
    //Create a file chooserfc = new JFileChooser(); one line or two? Should it be
    //Create a file chooser
    fc = new JFileChooser();

  • I have this strange error JFrame ..

    Hellow,
    normally i have this output when i do an output of my JFrame,
    if i refresh it, i there is an invalid parameter, do you know
    what it stands for? what is invalid?
    Greetz and tx !
    -tbd-
    NORMAL output >be.tbd.client.mainFrame[frame0,372,289,280x190,layout=java.awt.BorderLayout,title= E.D.,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,22,274x165,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=1411,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
    INVALID parameter >be.tbd.client.mainFrame[frame0,372,289,280x190 >>>>> invalid,layout=java.awt.BorderLayout,title= E.D.,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,3,22,274x165,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=1409,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

    I think it "invalid" means "requires validation" (see isValid())

  • Run javah -jni HelloWorld gives error...

    hi all i am new to JNI. i wanted to compiled my HelloWorld.java to header file. in which directory shld i run? i am using jdk1.3.
    this is my error:
    D:\jdk1.3.1\bin>javah -jni HelloWorld
    Error: Class HelloWorld could not be found.
    i hav installed JNI1.2 but not using it yet. what are the settings i shld do?
    thanks to everyone.
    seiw77

    Check your CLASSPATH. Your HelloWorld class should come under the directories listed in the CLASSPATH. Also make sure you include the current working directory "." in the CLASSPATH

  • [Qt 4][Testing] Helloworld build errors [solved]

    Hello!
    I tried to build a simple qt 4 hello world and it did not work.
    I took trolltech example, used qmake -project, qmake and make.
    I got this errors:
    shaika-dzari:$ make
    g++ -c -pipe -march=i686 -mtune=generic -O2 -pipe -Wall -W -D_REENTRANT -DQT_NO_DEBUG -I/opt/qt/mkspecs/linux-g++ -I. -I/opt/qt/include -I. -I. -I. -o main.o main.cpp
    main.cpp:37:25: erreur: QApplication : Aucun fichier ou répertoire de ce type
    main.cpp:38:24: erreur: QPushButton : Aucun fichier ou répertoire de ce type
    main.cpp:49:3: attention : pas de retour chariot à la fin du fichier
    main.cpp: In function 'int main(int, char**)':
    main.cpp:42: erreur: 'QApplication' was not declared in this scope
    main.cpp:42: erreur: expected `;' before 'app'
    main.cpp:44: erreur: 'QPushButton' was not declared in this scope
    main.cpp:44: erreur: expected `;' before 'hello'
    main.cpp:45: erreur: 'hello' was not declared in this scope
    main.cpp:48: erreur: 'app' was not declared in this scope
    main.cpp: At global scope:
    main.cpp:40: attention : unused parameter 'argc'
    main.cpp:40: attention : unused parameter 'argv'
    make: *** [main.o] Erreur 1
    Make seem to use /opt/qt/mkspecs/ but I think it should use /usr/share/qt/mkspecs for qt 4 ( I use qt 4 package from testing ).
    If I unset $QTDIR, qmake seem to load it again.
    I found in /usr/share/qt/mkspecs/linux-g++/qmake.conf this line:
    load(qt_config)
    I have 2 qtconfig on my system and both are in my path:
    shaika-dzari:$ whereis qtconfig
    qtconfig: /usr/bin/qtconfig /opt/qt/bin/qtconfig
    shaika-dzari:$ echo $PATH
    /bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin:/opt/java/bin:/opt/java/jre/bin:/opt/kde/bin:/opt/mozilla/bin:/usr/share/netbeans/bin/:/opt/qt/bin:/usr/local/bin:/opt/openoffice2/program:/opt/realplayer:/opt/skype:/usr/local/bin:/opt/openoffice2/program:/opt/realplayer:/opt/skype:/opt/qt/bin
    My qt package:
    local/qt 4.3.3-2
    The QT gui toolkit.
    local/qt-enhanced 3.3.8-15 (kdemod)
    The Qt GUI toolkit (KDEmod)
    I want to be sure before making a bug report. Is it because i use qt-enhanced from kdemod?
    When i used qt4 package from community, I did not have any problem.
    Any suggestions?
    Thank you.
    Last edited by Shaika-Dzari (2008-01-04 23:11:26)

    Up!
    Sorry to double post...
    I tried to build monkeystudio ( Qt4 ide ) and it did not work too.
    I looked in /etc/profile.d and I found qt.sh:
    shaika-dzari:$ cat /etc/profile.d/qt.sh
    export QTDIR=/opt/qt
    export QT_XFT=true
    export QMAKESPEC=$QTDIR/mkspecs/linux-g++
    export PATH=$PATH:$QTDIR/bin
    export MANPATH=$MANPATH:$QTDIR/man
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/qt/lib/pkgconfig
    This is wrong for qt4...
    I wrote this script and execute it with my user.
    After that, I was able to build my example:
    export QTDIR=/usr
    export QMAKESPEC=$QTDIR/share/qt/mkspecs/linux-g++
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/qt4/lib/pkgconfig
    Any explaination?
    @+

  • Running Extension Points sample  Helloworld gives  Error: unable to load...

    Hi....
    It looks like I don't have cez_inproc in my library path?  I am just wondering is there anything I am missing?  I followed all the directions correctly as mentioned in the webi extension doc.
    Thanks,
    -gandhams
    java.lang.UnsatisfiedLinkError: no cdz_inproc in java.library.path
         at java.lang.ClassLoader.loadLibrary(Unknown Source)
         at java.lang.Runtime.loadLibrary0(Unknown Source)
         at java.lang.System.loadLibrary(Unknown Source)
         at com.businessobjects.cdz_inproc.client.JniFacade.<clinit>(Unknown Source)
         at com.businessobjects.cdz_inproc.client.CollocatedContainer.init(Unknown Source)
         at com.businessobjects.cdz_inproc.client.CollocatedContainer.init(Unknown Source)
         at com.businessobjects.webi.richclient.ConnectionAdapter.initContainer(Unknown Source)
         at com.businessobjects.webi.richclient.ConnectionAdapter.<init>(Unknown Source)
         at com.businessobjects.webi.richclient.Startup.main(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.businessobjects.webi.richclient.SplashWindow.invokeMain(Unknown Source)
         at com.businessobjects.webi.richclient.Main.main(Unknown Source)
    ERROR : unable to load the cdz_inproc library
    com.businessobjects.cdz_inproc.client.ContainerException: stopContainer failed : java.lang.UnsatisfiedLinkError: com.businessobjects.cdz_inproc.client.JniFacade.stopContainer(Lcom/businessobjects/cdz_inproc/client/InvocationStatus;)V
         at com.businessobjects.cdz_inproc.client.CollocatedContainer.stop(Unknown Source)
         at com.businessobjects.webi.richclient.ConnectionAdapter.die(Unknown Source)
         at com.businessobjects.webi.richclient.Startup.main(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.businessobjects.webi.richclient.SplashWindow.invokeMain(Unknown Source)
         at com.businessobjects.webi.richclient.Main.main(Unknown Source)

    Srinivas,
    I am getting the same error message with "cdz_inproc".
    Can you please let me know what was the "classpath" when you were getting that error and what did you change it to later to resolve the issue?
    Thanks
    Krishna.

  • Errors: can't find symbol, libraries Jung

    Hi, I was trying some graph libraries (Jung) when I got the following errors:
    line 43: cannot find symbol
    symbol : method setPreferredSize(java.awt.Dimension)
    location: class edu.uci.ics.jung.visualization.BasicVisualizationServer<java.lang.Integer,java.lang.String>
    vv.setPreferredSize(new Dimension(350,350)); //Sets the viewing area size
    line 47: cannot find symbol
    symbol : method add(edu.uci.ics.jung.visualization.BasicVisualizationServer<java.lang.Integer,java.lang.String>)
    location: class java.awt.Container
    frame.getContentPane().add(vv);
    I have all the packages that I need, and I copied the code from the official tutorial. How can I solve these problems?
    The code is the following:
    import edu.uci.ics.jung.algorithms.layout.CircleLayout;
    import edu.uci.ics.jung.algorithms.layout.Layout;
    import edu.uci.ics.jung.graph.Graph;
    import edu.uci.ics.jung.graph.SparseMultigraph;
    import edu.uci.ics.jung.visualization.BasicVisualizationServer;
    import java.awt.Dimension;
    import javax.swing.JFrame;
    public class SimpleGraphView {
        Graph<Integer, String> g;
        /** Creates a new instance of SimpleGraphView */
        public SimpleGraphView() {
            // Graph<V, E> where V is the type of the vertices and E is the type of the edges
            g = new SparseMultigraph<Integer, String>();
            // Add some vertices. From above we defined these to be type Integer.
            g.addVertex((Integer)1);
            g.addVertex((Integer)2);
            g.addVertex((Integer)3);
            // Note that the default is for undirected edges, our Edges are Strings.
            g.addEdge("Edge-A", 1, 2); // Note that Java 1.5 auto-boxes primitives
            g.addEdge("Edge-B", 2, 3); 
        public static void main(String[] args) {
            SimpleGraphView sgv = new SimpleGraphView(); //We create our graph in here
            // The Layout<V, E> is parameterized by the vertex and edge types
            Layout<Integer, String> layout = new CircleLayout(sgv.g);
            layout.setSize(new Dimension(300,300)); // sets the initial size of the layout space
            // The BasicVisualizationServer<V,E> is parameterized by the vertex and edge types
            BasicVisualizationServer<Integer,String> vv = new BasicVisualizationServer<Integer,String>(layout);      
            vv.setPreferredSize(new Dimension(350,350)); // <-- First Error
            JFrame frame = new JFrame("Simple Graph View");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(vv); // <-- Second Error
            frame.pack();
            frame.setVisible(true);      
    }

    There are a couple of things I would like to comment on,
    Firstly,
    LukeR. wrote:
    You said that this method is available since 1.5 for class Component, but isn't it called on class BasicVisualizationServer (variable vv)?Ya, you are right, setPreferredSize(Dimension preferredSize) is the method of class Component,
    LukeR. wrote:
    Also
    frame.getContentPane().add(vv), how can it work if the add method wants a Component but gets a BasicVisualizationServer object?If you look at the [JUNG 2.0 API|http://leda.science.uoit.ca/java-libraries/jung-2.0/apidocs/edu/uci/ics/jung/visualization/BasicVisualizationServer.html] BasicVisualizationServer class is inherited from java.awt.Component class, as a result BasicVisualizationServer inherits the properties/methods of its parent Component class!
    Second and more importantly,
    LukeR. wrote:
    I take a look on Jung API and this method doesn't exist.I get a feeling that you are using libraries of the [JUNG 2.0 API|http://leda.science.uoit.ca/java-libraries/jung-2.0/apidocs/overview-summary.html] while looking for the method in [JUNG 1.7.6|http://leda.science.uoit.ca/java-libraries/jung-1.7.6/doc/index.html] or lower API
    Edited by: anamupota on Jan 26, 2009 9:51 PM

  • Linking errors when using ibsta

    Hello,
    I have been trying to write C code to automate a Keithley 2410 through GPIB.  I am using Windows XP 32-bit, and VC++.
    I believe I was successful in getting a handle to the gpib-32.dll. However, I am getting a linking error when I try to use ibsta:  1>helloworld.obj : error LNK2001: unresolved external symbol _ibsta
    1>C:\Documents and Settings\Prober\My Documents\C Programs\helloworld\Debug\helloworld.exe : fatal error LNK1120: 1 unresolved externals
    However, when I look through the ni488.h, I see that ibsta is a global variable.  Therefore I am confused as to why I am getting a linking error
    I am following this guide: http://na.tm.agilent.com/pna/help/latest/Programming/GPIB_Example_Programs/GPIB_using_Visual_C++.htm
    My code is attached
    Attachments:
    code.c ‏3 KB

    Check out the 4882query.c example located on your computer at National Instruments > NI-488.2 > Examples > Standard C > 4882query.  The National Instruments folder might be in a sub-folder of Public or Public Documents.  Look at the ReadMe.txt file first.  It contains a C++ section.  Then try compiling the example and see what happens.
    Jeff Munn
    Applications Engineer
    National Instruments

  • Problem with compilation of HelloWorld.java

    hi,
    getting problem with compilation of HelloWorld.java
    CLASSPATH--- C:\java
    PATH--- C:\j2sdk1.4.2_04\bin
    HelloWorld.java source code in: C:\java
    On cmd prompt:
    C:\java>javac HelloWorld.java
    error: cannot read: HelloWorld.java
    1 error
    pls help me with this
    rgds,
    sanlearns

    What does this command yield?
    dir HelloWorld.java

Maybe you are looking for

  • Is Java what i need?

    Hi, I am not a programmer or IT person. Recently, in a director meeting at my company there was interest in creating some sort of "New Business" messaging system that's better than a mass e-mail. Basically, the directors thought, "Wouldn't it be cool

  • Asset purchase on Lease

    Hi , Is there any specific way to purchase an asset on lease mode . Regards Nandini

  • PC PDF users of mac PDFs

    Hi PC users, Have any of you run into problems with mac produced PDFs with embedded links to other PDFs, word docs, PP, etc not opening or working correcty? Thanks!

  • LibreOffice 4.2.2 (and 4.1.5) help doesn't show various images

    Have upgraded to the libreoffice-xxxx-4.2.2-1-x86_64 packages, and found that various images in Help are missing, showing just a box with the text 'vnd.sun.st' (or is it 'wnd.sun.st' - poor definition) within. For example, look in the Index for Forma

  • Aperture slow import

    I have a strange problem that has just appeared in Aperture V3. Everything works fine until i try to import pictures from my Memory card. The program just goes very slow and import takes ages, its a full min before i can even see the card etc. I get