[nbusers] Re: No interface is opening with my program??

  • From: "Bayless Kirtley" < >
  • To: < >
  • Subject: [nbusers] Re: No interface is opening with my program??
  • Date: Wed, 9 Jan 2013 09:01:59 -0600
  • Authentication-results: cox.net; none
  • Importance: Normal

This forum is not the place to learn Java but I'll help once more.

First learn and use the java standards. Notice how I have cleaned up
your code to make it much more readable and recognizable at a glance.
In particular, pay attention to your indenting and braces locations.
Netbeans generates code thus and its editor indents similarly.

Finally, I don't believe it even compiles and it certainly can't run at all.
My inline comments explain why you get nothing.

Bayless

markiewb wrote:
Your method which creates the window is never called.
A) Rename your "void testnew" to "testNew", so you create a constructor.



I did this, because I was not sure of the Or underneath it, and I got this code:

Code:
import java.awt.event.*;

public class Testnew {
   JComboBox c = new JComboBox();

// The presence of void makes this method not a constructor.
// Also it must be named Testnew to match the class name.
// It must be public Testnew() { in order to work.
   public void TestNew() {
       frame();
   }

   public void frame() {
       JFrame f = new JFrame();
       f.setVisible(true);
       f.setSize(400, 400);
       f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       JPanel p = new JPanel();
       p.add(c);
       f.add(p);
       p.setVisible(true);
   }

   public static void main(String[] args) {
// Here you are calling a Testnew constructor which does not exist. See above comments.
      new Testnew();
   }
}



Which still does not show anything when run?? It compiles and runs just fine, with no errors, but nothing is showing still???? [Crying or Very sad]






-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.2805 / Virus Database: 2637/6014 - Release Date: 01/06/13


[nbusers] No interface is opening with my program??

zlloyd1 01/08/2013

[nbusers] Re: No interface is opening with my program??

Benno Markiewicz 01/09/2013

[nbusers] Re: No interface is opening with my program??

Scott 01/09/2013

[nbusers] Re: No interface is opening with my program??

Benno Markiewicz 01/09/2013

[nbusers] No interface is opening with my program??

zlloyd1 01/09/2013

[nbusers] No interface is opening with my program??

bolsover 01/09/2013

[nbusers] Re: No interface is opening with my program??

Bayless Kirtley 01/09/2013

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close