[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I output GUI?

Posted on 2004-10-31
5
Medium Priority
?
179 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
[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
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 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