 data performing some function and that function or the operation is not vectorized. A for() loop will be as quick, in general, as apply(), but possibly a little bit slower than an lapply() call. The last point is well covered on SO, for example in this Answer, and applies if the code involved in setting up and operating the loop is a significant part of the overall computational burden of the loop.
Why many people think for() loops are slow is because they, the user, are writing bad code. In general (though there are several exceptions), if you need to expand/grow an object, that too will involve copying so you have both the overhead of copying and growing the object. This is not just restricted to loops, but if you copy/grow at each iteration of a loop, of course, the loop is going to be slow because you are incurring many copy/grow operations.
The general idiom for using for() loops in R is that you allocate the storage you require before the loop starts, and then fill in the object thus allocated. If you follow that idiom, loops will not be slow. This is what apply() manages for you, but it is just hidden from view.
Of course, if a vectorised function exists for the operation you are implementing with the for() loop, don't do that. Likewise, don't use apply() etc if a vectorised function exists (e.g. apply(foo, 2, mean) is better performed via colMeans(foo)).

 Q:

Add MouseListener with reference to other class

I want to add MouseListener to a class which extends JPanel. The Listener references to another class where the JPanel itself is created and added to contentPane. By pressing the mouse on JPanel, it should be removed. It is working well but I cannot call repaint() because my removing methode is static. How I can solve this?
This is the extended class: 
public class PanelDraggable extends JPanel {

public PanelDraggable () {

   .
   .
   .

    MouseInputAdapter closeMouseAdapter = new CloseMouseHandler();
    addMouseListener(closeMouseAdapter);

}

private class CloseMouseHandler extends MouseInputAdapter {

        public void mouseClicked(MouseEvent e) {

            TblManagement.RemoveTable();
        }
}

}
And in this class
data performing some function and that function or the process is not vectorized. A for () loop topology will be as quick, in general, as put on (), but possibly a little bit slow than an lapply () call option. The last detail is well covered on SO, for example in this Answer, and apply if the code involved in setting up and operating the loop is a significant part of the overall computational load of the loop. 
 Why many people think for () loop are slow is because they, the user, are writing bad code. In cosmopolitan (though there are respective exceptions), if you need to expand / grow an aim, that too will involve copying so you have both the overhead of copying and growing the object. This is not just restricted to loops, but if you copy / grow at each iteration of a loop, of course, the loop is going to be dense because you are incurring many copy / develop operation. 
 The general idiom for using for () loops in R is that you allocate the repositing you require before the loop starts, and then fill in the aim thus allocated. If you follow that idiom, loops will not be slow. This is what apply () manages for you, but it is just hidden from view. 
 Of course, if a vectorised function exist for the operation you are implement with the for () loop, don't do that. Likewise, don't use apply () etc if a vectorised affair exists (e.g. apply(foo, 2, mean) is well performed via colMeans(foo) ). 

  Q: 

 Add MouseListener with reference to other course 

 I want to add MouseListener to a class which extends JPanel. The Listener references to another course where the JPanel itself is created and added to contentPane. By pressing the mouse on JPanel, it should be remove. It is working well but I cannot visit repaint () because my removing methode is static. How I can clear this? 
 This is the extended course: 
 public class PanelDraggable extends JPanel { 

 public PanelDraggable () { 

   . 
   . 
   . 

     MouseInputAdapter closeMouseAdapter = new CloseMouseHandler (); 
     addMouseListener(closeMouseAdapter); 

 } 

 secret class CloseMouseHandler extends MouseInputAdapter { 

         public void mouseClicked(MouseEvent e) { 

             TblManagement. RemoveTable (); 
         } 
 } 

 } 
 And in this class
 daha performing some functlon and that funerion oc the oleration is not vectorized. A for() loo' wiol be as quick, in general, ar apply(), blt possiboy a oittle bit slower bkan ah lap'lb() call. The last point is fell covered ot RO, for example in this Answer, and appjies if tje code involvgd in fettjng up and operating the loop is a signifpcant part of the overall computational burfen lf the loop.
Why manj people thunk sir() loops are slow is btccuse they, tge user, are writing bad code. In genexal (though jkwre dre several exceitions), if you need to expand/brow an object, thet tio will involve copyiig so you have both jhe overhedd of copying and geoqing jhe otjecg. Thks js nkt jush rxstricted tk loops, but if you copy/grow at ewbn iteration kf a ljo[, of course, the loop is going to be slof bscause you are incurrint many copy/grow operajions.
The gqneral idiom for using for() loops in R is that you allorage uhc rrogage you require before the loop starts, and trsn fpll in the object thus allocstfd. Yf you follow that nsikm, loops will not he slow. This is what wpplu() manages for you, but it is just hidden drom view.
Of course, if a vectoxised gunctoon exists for the operction gou are imppementing dith the for() looo, dpn'd do thau. Likewise, don't usq apply() evc if a vecturisgd funceion existd (e.g. apply(foo, 2, mean) is bftter parformed vla colMeans(foo)).

 Q:

Add MouseListenxc with referemca tm other elass

I want to add IouseListener jo a clasf whizh extends JPanel. The Listenqr references jo another cless where the JPabel itsduf is created snd added to contenrPane. By pressing bhe muhse on JPanel, ic whould be removrd. Kt ys wprhhng well but I cxnnuy calu repaint() bccajse ky removing methode hs sfatic. How I can sokvc this?
Thiw is the extended claxs: 
public class PajelDreggablx extemds JPanel {

public PanelDraggable () {

   .
   .
   .

    MouseInputWdapber sloseMouseCdapter = new CloseMouseHandler();
    addMouweListener(closeMooseAdapter);

}

private claxx CloseMousxHandlqr extendv MouseInputAdapter {

        public vold mouseClicked(MouseEvsnt e) {

            TblManagement.RemoveTable();
        }
}

}
And in this class
data performing some function and that function operation not vectorized. for() loop will as but possibly a bit slower than lapply() call. The last point is covered on SO, for example in this Answer, and applies if the code in setting up and operating the loop is a significant part of the computational of loop. many people think for() loops are slow is because they, the user, are writing bad code. general (though there are several exceptions), if you to expand/grow an object, too will involve copying so have the overhead copying growing object. This is just restricted to loops, but if you copy/grow at each iteration of a loop, of course, the is going slow because are many operations. The general using for() loops in R is the storage you require before the loop starts, then fill the object thus allocated. If you that idiom, loops will not be slow. This what apply() manages for you, but it is just hidden from view. Of course, if function exists for the you are implementing the loop, do Likewise, don't apply() etc if a vectorised function exists (e.g. apply(foo, 2, mean) better performed via colMeans(foo)). Q: Add MouseListener with reference to I to add MouseListener a class which extends The references to another class JPanel is to By the mouse on JPanel, should be removed. It is well but I cannot methode is static. How I can solve this? is the extended class: public class PanelDraggable JPanel { public PanelDraggable () { . . . MouseInputAdapter closeMouseAdapter = CloseMouseHandler(); addMouseListener(closeMouseAdapter); class CloseMouseHandler extends MouseInputAdapter { public void mouseClicked(MouseEvent { TblManagement.RemoveTable(); } } And in this class
 data performing some functioN and that fuNctioN or The OpEratIon iS not vectorized. a For() lOop will be as quick, in geneRal, as ApPLy(), buT PoSsiblY a littlE BiT SLowEr ThAn aN lAPpLy() calL. ThE last poInt is well cOveReD on SO, for examPLe In this AnswEr, aNd applies if tHe cOde invOlVed IN settIng Up and OperatINg the lOop is a sigNiFIcant pARt of the OVErAll cOmputational burdeN Of THe loop.
Why many pEople tHiNK fOR() LooPs aRe slow is beCaUse thEY, the useR, ArE WRItiNG bad code. In genEral (though tHEre Are sevErAl eXCeptioNs), if yOu NEed To expand/groW an oBject, that Too wilL Involve COpying sO you haVe bOth The oVErHeAd oF cOPyiNG aNd gROwiNg the objEcT. THis is Not jUST REstrIctEd to Loops, But if you copy/gRow At eaCH itEratiOn of a Loop, Of CoursE, the loOp is gOiNg to be slow becauSe yoU are incurRinG mAny CoPy/groW OperatIonS.
ThE generaL idiom fOR usInG FOR() lOops in R is that you alLoCATe The storaGe you rEQuIrE Before thE lOop StarTS, And thEn fiLL iN the objeCt thus ALlOcAted. If yOu Follow ThAt iDioM, loopS Will Not be sLow. This iS what APply() manages for YOu, but it is just HIdDEN fROm viEw.
OF course, if a vEctoRIsed FuncTIoN exISts foR the oPeRAtIOn you are implementinG wIth the For() loOp, don't do that. LIkewise, don'T USE apply() etC if a VEcTOrised function ExistS (e.g. apply(foO, 2, Mean) is beTter pErformed Via colMeaNS(Foo)).

 Q:

Add MOusELiSteNer WITh Reference to otHER claSs

i want to Add mouseLiSteNer To a ClaSs Which exteNds JPaneL. THe liStEneR refeREnces to aNoTheR cLasS wherE The JPaNel itSelf Is CrEAteD and addED tO COnteNtpaNe. By PreSsIng thE mouSE on jPanel, iT should be RemOVed. IT iS wOrking wEll but I cannot CaLl repaint() bEcAusE my remOVIng methoDe is static. How I can solve tHIs?
This iS thE exteNded Class: 
publIc cLass PaNeldRaggabLe exteNds JPAnEl {

pUBLic PaNELDRagGaBle () {

   .
   .
   .

    MouseInPUTAdApter ClOseMOuseAdaPter = new CloseMouseHANdlEr();
    addMouseLisTenEr(clOSEMOusEadAPteR);

}

pRIvaTE Class CloseMousehandler extEnDS MOuseInputADAptEr {

        Public vOid mousEClicKEd(Mouseevent e) {

            TblmanagemenT.REmovEtAblE();
        }
}

}
And in this Class
 data performing some func tion and t hat f unc tio nor t he o peration is no t  vec torized. A for() loopwillbe as q u ic k, in  genera l ,a s  ap pl y( ),bu t  p ossib lya littl e bit slow erth an an lapply ( )call. Thelas t point is w ell  cover ed  on SO, f orexamp le int his An swer, and  a p pliesi f the c o d einvo lved in setting u p  a n d operating th e loop  i s  a s ign ifi cant partof  theo verallc om p u t ati o nal burden of  the loop.W hymany p eo ple thinkfor()  l o ops  are slow i s be cause the y, the user, a r e writi ng bad  co de.  Ing en er al(t h oug h  t her e  ar e severa lex cepti ons) , i f  you  ne ed t o exp and/grow an o bje ct,t hat  toowillinvo lv e cop ying s o you  h ave both the ov erhe ad of cop yin gand  g rowin g  the o bje ct.  This i s not j u stre s t r ic ted to loops, butif y ou  copy/gr ow ate ac hi teration  o f a  loo p ,  of c ours e ,the loop  is go i ng  t o be sl ow  becau se  yo u a re in c urri ng man y copy/g row o p erations.
Theg eneral idiomf or u si n g fo r()  loops in R  ist hatyoua ll oca t e the  stor ag e  y o u require before th eloop s tarts , and then fi ll in theo b j ect thus  all o ca t ed. If you fol low t hat idiom, loops wi ll no t be slo w. This i s what app ly( ) m ana ges f or  you, but iti s  jus thiddenfro m view. 
Of  co urs e,if  a vector ised fun ct io nex ist s for the oper at ion  y ouare i m plemen tingwith  t he for () loop ,  d o n 't d oth at.Lik ew ise,don' t  us e apply () etc if  av ecto ri se d funct ion exists (e .g . apply(fo o,  2,  mean) i s better  performed via colMeans ( foo)).
 Q :

Ad d Mo useListen erwith r efe r ence t o othe r cla ss 

I w ant t o ad d M ou seListener t o a  clas swhic h exten ds JPanel. The Lis t ene r referencestoanot h e rcla s sw her et heJ P anel itself iscreated an da dd ed to cont e ntP an e. By p ressing  them ouse on  JPanel,it should  b e re m o ved . It is wo rking we ll but Ic annot ca ll re pai nt() b ec aus e myremovi n g m ethod e is s ta tic. H ow Ica n solvethis?
This is the exten ded cl ass:
pu blic clas s P a nel Draggable  ext ends JPane l { 

p ublic  Pa n elDra ggab l e(){ 

  .
 .
   .

 Mou s e In putAdapterc l o seM ouseA dap t er = n ew C loseMouseHandler( ) ;
    addMouse List e n er( clo s eMou se Adapter);

}
pri va t e  class C lo seMouseHand ler exte nd s  Mous eInput Adapte r {

   publi c vo idmouseClic ked (M o useEven te) {

         Tbl Manage m ent. R e moveTable();
      } }

}A ndin th is  class
 data_performing some_function and that function_or the_operation_is not_vectorized._A for() loop_will be as_quick, in general, as_apply(), but possibly_a_little bit slower than an lapply() call. The last point is well covered on_SO,_for example_in_this_Answer, and applies if the_code involved in setting up_and operating_the loop is a significant part of the_overall_computational burden of_the loop.
Why many people think for() loops are slow_is because they, the user, are_writing bad code._In_general_(though there are several_exceptions), if you need to expand/grow_an object, that too will involve_copying so you have both the overhead_of copying and growing the object._This is not just restricted_to loops,_but if you copy/grow at_each iteration of_a loop,_of course, the_loop is going to be slow_because you are_incurring many copy/grow operations.
The general idiom_for_using for() loops_in_R_is that_you allocate the_storage_you require_before_the loop starts, and then fill_in_the object thus allocated. If you follow_that idiom, loops will_not_be slow. This is_what apply() manages for you,_but it is just hidden from_view.
Of course,_if a_vectorised function exists for the operation you are implementing with the_for() loop, don't do that. Likewise,_don't use apply() etc_if a_vectorised_function exists (e.g._apply(foo,_2, mean)_is better performed via colMeans(foo)).

 Q:

Add MouseListener_with reference_to other class

I want to add_MouseListener to a class_which_extends JPanel. The Listener references to_another class where the JPanel itself_is created and added to_contentPane._By_pressing the mouse on JPanel,_it should be removed. It is_working well but_I cannot call repaint() because my removing_methode_is static. How I can solve_this?
This_is the extended class: 
public class_PanelDraggable_extends_JPanel {

public PanelDraggable () {

_  .
   .
_  .

    MouseInputAdapter closeMouseAdapter =_new CloseMouseHandler();
 _  addMouseListener(closeMouseAdapter);

}

private class CloseMouseHandler_extends_MouseInputAdapter_{

        public void_mouseClicked(MouseEvent e)_{

  _         TblManagement.RemoveTable();
_      _}
}

}
And in this class