Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JBuilder Generated Code?  Easy

Posted on 2002-03-09
2
Medium Priority
?
238 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 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

722 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