java - how to access Graphics object outside paintComponent() method -


Looking at these methods within the expanded category:

SuperpintConant (G); G.drawImage (image, 0, 0, empty); G.setColor (Color.BLACK); } Public Zero Draw labels (linked list & lt; label & gt; label list) {for (label: label list) {// reproduction (l.getContent), LJA.T.X (), L. GY (Y)); }}

How do I know about how to access the graphics element from inside DrawLabels () with paintComponent ()? (Many) comments about how to deal with graphics items outside of the (colorful) method I have seen, but I can not find my head around an alternate solution.

Any useful suggestions will be appreciated.

How do I go about drawingCamponent () to access the graphics element from within DrawLabels () ?

You do not attempt to directly access the graphics object.

You can pass drawLabels () to paintComponent method and then you draw a graphics object in the Draw Labels () method:

  Public Zero ColorCompany (Graphics G) {super.paintComponent (g); G.drawImage (image, 0, 0, empty); G.setColor (Color.BLACK); Draw labels (live, label list); } For public Zero Draw labels (Graphics G, Linkedit & Lt; Labels & gt; Label List) {for (Label: Label List) {// Drosring (L. Gate Content), L.A.T.X , L.G.E. Y ()); }}    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -