Solved

JBuilder Generated Code?  Easy

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
hibernate example using maven 12 113
spring jars download 1 68
Java 8 to Java 6 8 44
Strange router problem - can't access hotmail.com 14 109
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

710 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