Solved

JBuilder Generated Code?  Easy

Posted on 2002-03-09
2
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
Igor Bazarny earned 50 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

636 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