[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How do I output GUI?

Posted on 2004-10-31
5
Medium Priority
?
180 Views
Last Modified: 2010-03-31
I'm wondering how do I get the output to show on the screen?  I run this in JBuilder and nothing happens.  Please help!  Thanks!


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;

public class Program4  {
  public static void main(String[] args) {

    JLabel JLString1, JLString2, JLResults;
    JTextField JTFString1, JTFString2, JTFResults;
    JButton JBCompare, JBClear;
    JPanel Panel;
    String output = "";

    JLString1 = new JLabel("First String: ");
    JLString2 = new JLabel("Second String: ");
    JLResults = new JLabel("Results: ");
    JBCompare = new JButton("Compare Strings");
    JBClear = new JButton("Clear");
    JTFString1 = new JTextField(20);
    JTFString2 = new JTextField(20);
    JTFResults = new JTextField(30);
    Panel = new JPanel();

    JTFResults.setEditable(false);
    JTFString1.requestFocus();

    Panel.add(JLString1);
    Panel.add(JTFString1);
    Panel.add(JLString2);
    Panel.add(JTFString2);
    Panel.add(JBCompare);
    Panel.add(JBClear);
    Panel.add(JLResults);
    Panel.add(JTFResults);

    String String1 = JTFString1.getText();
    String String2 = JTFString2.getText();

  }
}
0
Comment
Question by:Job4Suprmn
  • 4
5 Comments
 
LVL 6

Expert Comment

by:expertmb
ID: 12460734
put the panel in jduailo or jframe then call setVisible(true)
0
 
LVL 6

Expert Comment

by:expertmb
ID: 12460739
jduailo should be jdialog.
0
 
LVL 6

Accepted Solution

by:
expertmb earned 100 total points
ID: 12460745
   JFrame frame = new JFrame();
    frame.getContentPane().add(Panel);
    frame.setSize(400,400);
    frame.setVisible(true);
0
 

Author Comment

by:Job4Suprmn
ID: 12460771
That worked, thanks!  Here are your points.
0
 
LVL 6

Expert Comment

by:expertmb
ID: 12460775
:)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

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

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 …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

591 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