Solved

JBuilder Generated Code?  Easy

Posted on 2002-03-09
2
192 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 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 62
countX 22 70
solarwind tftp server 2 32
Non-recursive backtracking, using a stack 1 52
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now