Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: appletviewer not display ,no compile andr run time error. appletviewer not working?

  1. #1
    Junior Member
    Join Date
    Feb 2023
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default appletviewer not display ,no compile andr run time error. appletviewer not working?

    import java.awt.*;
    import javax.swing.*;
     
    public class DrawATriangle extends JPanel {
        public void paintComponent(Graphics g) {
            int [] x = {50,100,0};
            int [] y = {0,100,100};
            g.drawPolygon(x, y, 3);
        }
     
        public static void main(String[] args) {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("Draw a Polygon");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setBackground(Color.white);
            frame.setSize(300, 200);
     
            DrawATriangle panel = new DrawATriangle();
            frame.add(panel);
            frame.setVisible(true);
        }
    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: appletviewer not display ,no compile andr run time error. appletviewer not working?

    What does the appletviewer program have to do with this java class?
    Appletviewer should be used to open an html file containing a java applet.

    The class looks like it should be executed with the java program.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. compile time error
    By Elio.alsayah in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 5th, 2018, 01:48 AM
  2. Replies: 6
    Last Post: September 24th, 2014, 11:04 AM
  3. Issues With Layout And Time Being Display
    By digitalsystems in forum AWT / Java Swing
    Replies: 16
    Last Post: April 21st, 2014, 08:23 AM
  4. Appletviewer printing issue
    By joshiprasad2 in forum AWT / Java Swing
    Replies: 1
    Last Post: February 18th, 2014, 06:23 AM
  5. display time
    By kalees in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: January 1st, 2010, 07:40 AM

Tags for this Thread