Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JBuilder Generated Code?  Easy

Posted on 2002-03-09
2
Medium Priority
?
242 Views
Last Modified: 2010-03-31
I am having problems getting Jbuilder 6 to display my project.  My project appears to run and generates no errors but displays nothing or at least displays it so fast I can't see it.  I have not used JBuilder or Java since version 3 so I am very rusty but if I can get started I will remember.  Here is the Borland generated Code.

import javax.swing.*;
import java.awt.event.*;
import com.borland.jbcl.layout.*;
import java.awt.*;
//import java.swing.text.*;

public class Bob {
  JPanel jPanel1 = new JPanel();
  XYLayout xYLayout1 = new XYLayout();
  JButton jButton1 = new JButton();
  JTextField jTextField1 = new JTextField();
  JButton jButton2 = new JButton();

  public Bob() {
    try {
      jbInit();

    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  public static void main(String[] args) {
    Bob bob1 = new Bob();
  }
  private void jbInit() throws Exception {
    jButton1.setText("jButton1");
    jPanel1.setLayout(xYLayout1);
    jTextField1.setText("jTextField1");
    jButton2.setText("jButton2");
    jPanel1.add(jButton1, new XYConstraints(242, 236, -1, -1));
    jPanel1.add(jTextField1,  new XYConstraints(34, 43, 121, 24));
    jPanel1.add(jButton2,  new XYConstraints(169, 43, 84, 25));
  }

}

I tried using none borland layout managers with no luck.
 
I have changed none of the computer generated code and I have not added any of my own code yet.  I just want it to display the panel and a few buttons to make sure it works.

Thank You
0
Comment
Question by:DwarfBaby
2 Comments
 
LVL 7

Accepted Solution

by:
Igor Bazarny earned 200 total points
ID: 6854458
Hi,

Try to add a few lines to constructor or jbInit code:
JFrame frame = new Frame("Frame Title");
frame.getContentPane().add(jPanel1);
frame.pack();
frame.setVisible(true);

Regards,
Igor Bazarny,
Brainbench MVP for Java 1
www.brainbench.com
0
 

Author Comment

by:DwarfBaby
ID: 6857664
Hey thanks,  It took a while for my brain to start working again.  It appears JBuilder 6 sets neither the SetVisable or the SetSize.  And the JFrame cannot be added as a component in the newer version it must explicitly be a class of type JFrame not added to a class.  Which is actually more reasonable now that I think about it.  It's comming back to me.  Thanks

Sorry it to so long to get back to you.  I have been unable to log on to Experts-Exchange.  I think the site was down for a day or so.  
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This video teaches viewers about errors in exception handling.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question