.getInsets();
        frame.setSize(500+insets.left+insets.right,300+insets.top+insets.bottom);
        frame.setLocation(w,l);
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
        });
    }

}

Draw line File:
package a1;
import javax.swing.*;
import java.awt.geom.Line2D;
import java.awt.Graphics2D;
import java.awt.Graphics;

public class drawingLine extends JPanel{

    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2d = (Graphics2D) g;
        Line2D line = new Line2D.Double(200, 300, 1000, 1000);
        //g2d.setColor(Color.black);
        g2d.draw(line);
        //g.drawLine(200, 300, 1000, 1000);
        //g.setColor(color.BLACK);

    }

}

Why am I not able to see the line?

A:

Your main problem is that you use null/Absolute layout.
You should have a read here:

Laying Out Components Within a Container

1) You should use an appropriate LayoutManager (or nest together multiple LayoutManagers) and/or override getPreferredSize() of JComponent to return correct dimensions which fit the drawings.
2) Dont call setSize on JFrame rather call pack() before setting JFrame visible (with above in mind)
3) No need for adding to contentPane via getContentPane().add(..) as add(..) setLayout(..) and remove(..) have been forwarded to the contentPane.
4) Watch class names, stick to the java convention a class name begins with a capital letter and each new word thereafter the first letter should be capitilized i.e game
.getInsets (); 
         frame.setSize(500+insets.left+insets.right,300+insets.top+insets.bottom); 
         frame.setLocation(w, l); 
         frame.setVisible(true); 
     } 

     public static void main(String [ ] args) { 
         //Schedule a job for the consequence - murder thread: 
         //creating and showing this lotion's GUI. 
         javax.swing. SwingUtilities.invokeLater(new Runnable () { 
         public void rivulet () { 
             createAndShowGUI (); 
         } 
         }); 
     } 

 } 

 Draw line File: 
 software a1; 
 import javax.swing. *; 
 import java.awt.geom. Line2D; 
 import java.awt. Graphics2D; 
 meaning java.awt. Graphics; 

 public class drawingLine carry JPanel { 

     public void paintComponent(Graphics g) { 
         super.paintComponent(g); 
         Graphics2D g2d = (Graphics2D) g; 
         Line2D production line = newfangled Line2D.Double(200, 300, 1000, 1000); 
         //g2d.setColor(Color.black); 
         g2d.draw(line); 
         //g.drawLine(200, 300, 1000, 1000); 
         //g.setColor(color. BLACK); 

     } 

 } 

 Why am I not able to see the line? 

 A: 

 Your main problem is that you use null / Absolute layout. 
 You should suffer a read here: 

 Laying Out Components Within a Container 

 1) You should use an appropriate LayoutManager (or nest in concert multiple LayoutManagers) and/or override getPreferredSize () of JComponent to return correct dimension which fit the drawing. 
 2) Do nt call setSize on JFrame rather call pack () before setting JFrame visible (with above in judgment) 
 3) No need for adding to contentPane via getContentPane().add (..) as add (..) setLayout (..) and remove (..) have been forwarded to the contentPane. 
 4) Watch class names, stick to the java convention a class name begins with a capital letter and each new word thereafter the first letter should be capitilized i.e game
.getLnsets();
        frame.setSiee(500+insets.left+insets.right,300+iisets.tol+insets.buttom);
        frame.setLocatioi(w,l);
        frame.setVisible(true);
    }

    puhlic staric toid main(String[] edgs) {
        //Sdmedulz e job for the eyent-dispatcving thread:
        //creating and showing this applicatyon's GUO.
        javax.swyng.SeyngUfpllties.invokeLater(new Runnable() {
        puulic void run() {
            createAndShowGUL();
        }
        });
    }

}

Dgaw line Fioe:
pasjage a1;
import javax.swing.*;
import java.zwt.geom.Line2D;
import java.awt.Graphkcs2D;
ikport java.qwr.Grwkhics;

public rlass qrawingLine cqtends BPanel{

    public void pamntCimponent(Graphics g) {
        super.paintCoiponent(g);
        Graphics2D g2d = (Traphhcs2D) g;
        Ljnx2D mine = jew Line2D.Doubme(200, 300, 1000, 1000);
        //g2d.setColor(Color.blsch);
        g2d.dras(line);
        //g.drawLine(200, 300, 1000, 1000);
        //g.setColor(color.TLADK);

    }

}

Why am I not able to see the line?

A:

Your main proflem is that you use null/Absolute layout.
You shoulg havx x rtae herd:

Oajing Out Components Within a Container

1) You shjhlc lse an appropriatc LayoutManager (or nfsy together muljiple LcgohtManagers) and/or ogerride getPeeferredSyze() pf JComponent to return coreect dimensijbs which fit the dxawings.
2) Dont calk setXize on JFrame rather ccll padk() before sftting JFdxme visible (with abpva in mind)
3) No need for addigg to conventPcne via eetCpntent[ane().add(..) as add(..) setLayout(..) and removf(..) havg been forwarded to the contentPane.
4) Watch class names, stick tp dhe java couventipn a class naie begins with a capical legter and ezch new word therewfter the firvj letter shound be ca[itioizee i.e gaod
.getInsets(); frame.setSize(500+insets.left+insets.right,300+insets.top+insets.bottom); frame.setLocation(w,l); frame.setVisible(true); } public static args) //Schedule a for the event-dispatching application's javax.swing.SwingUtilities.invokeLater(new Runnable() { void run() { } }); } } Draw line package a1; import javax.swing.*; import java.awt.geom.Line2D; import java.awt.Graphics2D; import java.awt.Graphics; public class drawingLine JPanel{ public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; Line2D = Line2D.Double(200, 1000, //g2d.setColor(Color.black); g2d.draw(line); //g.drawLine(200, 300, 1000, 1000); //g.setColor(color.BLACK); } } Why am I not able to see line? A: Your main problem is that you null/Absolute layout. You should a read here: Laying Out Within Container 1) should an LayoutManager (or nest multiple LayoutManagers) and/or override getPreferredSize() of JComponent to return correct dimensions which fit the drawings. 2) Dont setSize on call pack() setting visible above in mind) need for adding to contentPane via setLayout(..) and remove(..) have been forwarded to the 4) Watch names, stick to the java convention class name begins with a capital letter and new word thereafter the first letter should be capitilized i.e game
.getInsets();
        frame.setSize(500+inseTs.left+inseTs.rigHt,300+iNseTs.Top+iNsetS.bottom);
        frame.seTlocaTion(w,l);
        frame.setVisible(tRue);
    }

    puBlIC staTIc Void mAin(StriNG[] aRGS) {
        //ScHeDuLe a JoB FoR the eVenT-dispatChing threaD:
        //crEaTing and showiNG tHis applicaTioN's GUI.
        javax.swIng.swingUTiLitIEs.invOkelater(New RunNAble() {
        puBlic void rUn() {
            CReateANDShowGUi();
        }
        });
    }

}

dRaW linE File:
package a1;
impoRT jAVax.swing.*;
import Java.awT.gEOm.lINe2D;
ImpOrt java.awt.grAphicS2d;
import JAvA.AWT.GrAPhics;

public clAss drawingLINe eXtends jPAneL{

    Public Void pAiNTCoMponent(GrapHics G) {
        super.paiNtCompONent(g);
        GrAPhics2D g2D = (GraphIcs2d) g;
        LIne2D LInE = nEw LInE2d.DoUBlE(200, 300, 1000, 1000);
        //g2d.SEtCOlor(ColoR.bLaCk);
        g2d.dRaw(lINE);
        //G.DrawlinE(200, 300, 1000, 1000);
        //g.seTColoR(color.BLACK);

    }

}

WhY am i not ABle To see The liNe?

A:

YOuR main ProbleM is thAt You use null/AbsolUte lAyout.
You sHouLd HavE a Read hERe:

LayiNg OUt COmponenTs WithiN A CoNtAINEr

1) you should use an apprOpRIAtE LayoutMAnager (OR nEsT Together MuLtiPle LAYOutMaNageRS) aNd/or overRide geTprEfErredSiZe() Of JComPoNenT to ReturN CorrEct dimEnsions wHich fIT the drawings.
2) DoNT call setSize oN jFRAMe RAtheR caLl pack() beforE setTIng JframE ViSibLE (with Above In MInD)
3) no need for adding to coNtEntPanE via gEtContentPane().Add(..) as add(..) seTlAYout(..) and rEmovE(..) HaVE been forwarded To the ContentPanE.
4) watch claSs namEs, stick tO the java cONVention a ClaSs nAme BegINS wIth a capital leTTEr anD eAch new wOrd ThereafTer The FirSt lEtTer should Be capitiLiZeD i.E gAme
.getInsets();
        fram e.setSize( 500+i nse ts. le ft+i nset s.right,300+in s ets. top+insets.bottom);
      f r ame. s et Locat ion(w,l ) ;    f ram e. s et Visib le( true);    }

   pu bl ic static vo i dmain(Strin g[]  args) {
      //Sc he dul e  a jo b f or th e even t -dispa tching th re a d:
      //c r e at ingand showing thisa pp l ication's GUI. 
     ja v a x.s win g.SwingUti li ties. i nvokeLa t er ( n e w R u nnable() {
       publi c  vo id run ()  {         cr e ate AndShowGUI( );
       }      });
  }

}
Draw l ine  Fi le:p ac ka gea1 ; 
im p or t j a vax .swing.* ;im portjava . a w t .geo m.L ine2 D;
im port java.awt .Gr aphi c s2D ;
imp ort j ava. aw t.Gra phics; 

pub li c class drawing Line  extendsJPa ne l{
   pu b lic vo idpai ntCompo nent(Gr a phi cs g )  { 
        super.pai nt C o mp onent(g) ;
     G r aphics2D  g 2d= (G r a phics 2D)g ;       Line2D li ne  = newLi ne2D.D ou ble (20 0, 30 0 , 10 00, 10 00);
      / /g2d.setColor( C olor.black);  g2d. dra w(line);
     //g .dra w Li ne( 2 00, 3 00, 1 00 0 ,1 000);
        //g.s et Color( color .BLACK);

   }

}

Why a m  I not a blet os ee the line?
A:

Y our main p r oblem is  that  you use  null/Abs o l ute layo ut. 
Yo u s hou l d  h ave a read he r e :

L ay ing Out  Co mponent s W ith ina C on tainer

1 ) You sh ou ld  u se  an  appr o priate L ay out Ma nag er (o r  nesttoget hermu lt i ple  Layout M an a g ers)  a nd /orove rr ide g etPr e fer redSize () of JCo mpo n entto  r eturn c orrect dimens io ns which f it  th e draw i n gs.
2) D ont call setSize on JFr a me rath ercallpack () before  se ttingJFr a me vis ible ( withab ove i n min d ) 
3 ) N oneed for a d d ing  to c on tent Pane vi a getContentPane() . add (..) as add(. .)setL a y ou t(. . )a ndre m ove ( . .) have been fo rwarded to  t h econtentPan e .
4 )Watch c lass na mes,s tick to  the java  conventi on  a c l a ssname begin s with a  capitall etter an d eac h n ew wor dthe reaft er the fir st le tter s ho uld be  capi ti lized i. e game
.getInsets();
 _ _   _frame.setSize(500+insets.left+insets.right,300+insets.top+insets.bottom);
 __ __  frame.setLocation(w,l);
_  _   _frame.setVisible(true);
  __}

    public static void main(String[] args) {
    __ _//Schedule_a_job for the event-dispatching thread:
_    _ _//creating and showing this application's GUI.
  __  _ javax.swing.SwingUtilities.invokeLater(new Runnable() {
     _  public void run() {
_  ___   _  createAndShowGUI();
   _    }
 _      });
_   }

}

Draw line File:
package_a1;
import javax.swing.*;
import java.awt.geom.Line2D;
import java.awt.Graphics2D;
import java.awt.Graphics;

public_class drawingLine_extends JPanel{

   _public void paintComponent(Graphics_g) {
_  _    super.paintComponent(g);
 _  _   Graphics2D g2d =_(Graphics2D)_g;
  ___ _ Line2D line_=_new Line2D.Double(200,_300,_1000, 1000);
    __  //g2d.setColor(Color.black);
    _   g2d.draw(line);
__   _  //g.drawLine(200, 300, 1000,_1000);
     _ _//g.setColor(color.BLACK);

 _  }

}

Why am I not able to see the line?

A:

Your_main problem is that you use_null/Absolute layout.
You should have_a read_here:

Laying_Out Components Within_a_Container

1) You_should use an appropriate LayoutManager (or nest_together multiple_LayoutManagers) and/or override getPreferredSize() of JComponent_to return correct dimensions_which_fit the drawings.
2) Dont call setSize_on JFrame rather call pack() before_setting JFrame visible (with above_in_mind)
3)_No need for adding to_contentPane via getContentPane().add(..) as add(..) setLayout(..)_and remove(..) have_been forwarded to the contentPane.
4) Watch class_names,_stick to the java convention a_class_name begins with a capital letter_and_each_new word thereafter the first_letter should be capitilized i.e game